xtd - Reference Guide 0.2.0
Go to the documentation of this file.
1 #pragma once
5 #include <iostream>
6 #include "object.h"
7 #include "diagnostics/trace.h"
10 namespace xtd {
17  class tracestreambuf : public object, public std::stringbuf {
18  public:
23  int sync() override {
24  #if defined(TRACE)
25  if (!str().empty()) {
26  if (str() == "\n") xtd::diagnostics::trace::write_line();
27  else if (ustring(str()).ends_with('\n')) xtd::diagnostics::trace::write_line(ustring(str()).trim_end('\n'));
29  str("");
30  }
31  #endif
32  return 0;
33  }
34  };
35 }
Contains xtd::diagnostics::trace class.
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:50
int sync() override
Synchronizes the buffers with the associated character sequence.
Definition: tracestreambuf.h:23
static void write_line()
Writes a line terminator to the trace listeners in the listeners collection.
Definition: trace.h:339
Contains xtd::object class.
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes...
Definition: object.h:30
Provides an std::stringbuf for xtd::diagnostics::trace.
Definition: tracestreambuf.h:17
static void write(const xtd::ustring &message)
Writes a message to the trace listeners in the listeners collection.
Definition: trace.h:253