16 #if defined(WIN32_VC) || defined(WIN64_VC)    17 #define WINDOWS_LEAN_AND_MEAN    19 #undef WINDOWS_LEAN_AND_MEAN    32 void MultiplexStreamBuf::Output::
    35     switch (_output_type) {
    37       assert(_out != 
nullptr);
    42       assert(_fout != 
nullptr);
    55 void MultiplexStreamBuf::Output::
    56 write_string(
const string &str) {
    57   switch (_output_type) {
    59     assert(_out != 
nullptr);
    60     _out->write(str.data(), str.length());
    65     assert(_fout != 
nullptr);
    66     fwrite(str.data(), str.length(), 1, _fout);
    71 #if defined(WIN32_VC) || defined(WIN64_VC)    72     OutputDebugString(str.c_str());
    82 MultiplexStreamBuf() {
    83 #ifndef PHAVE_IOSTREAM    94 ~MultiplexStreamBuf() {
    99   for (oi = _outputs.begin(); oi != _outputs.end(); ++oi) {
   111            MultiplexStreamBuf::OutputType output_type,
   112            std::ostream *out, FILE *fout, 
bool owns_obj) {
   115   o._buffer_type = buffer_type;
   116   o._output_type = output_type;
   119   o._owns_obj = owns_obj;
   123   _outputs.push_back(o);
   134   write_chars(
"", 0, 
true);
   142 int MultiplexStreamBuf::
   146   std::streamsize n = pptr() - pbase();
   149     write_chars(pbase(), n, 
false);
   156     write_chars(&c, 1, 
false);
   167 int MultiplexStreamBuf::
   171   std::streamsize n = pptr() - pbase();
   178   write_chars(pbase(), n, 
false);
   193 void MultiplexStreamBuf::
   194 write_chars(
const char *start, 
int length, 
bool flush) {
   195   size_t orig = _line_buffer.length();
   198     latest = string(start, length);
   205     line = _line_buffer + latest;
   211     _line_buffer += latest;
   212     size_t eol = _line_buffer.rfind(
'\n', orig);
   213     if (eol != string::npos) {
   214       line = _line_buffer.substr(0, eol + 1);
   215       _line_buffer = _line_buffer.substr(eol + 1);
   219   Outputs::iterator oi;
   220   for (oi = _outputs.begin(); oi != _outputs.end(); ++oi) {
   222     switch (out._buffer_type) {
   225       if (!latest.empty()) {
   226         out.write_string(latest);
   233         out.write_string(line);
 PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void flush()
Forces out all output that hasn't yet been written.
void add_output(BufferType buffer_type, OutputType output_type, std::ostream *out=nullptr, FILE *fout=nullptr, bool owns_obj=false)
Adds the indicated output destinition to the set of things that will be written to when characters ar...