xtd 0.2.0
Loading...
Searching...
No Matches
tracestreambuf.h
Go to the documentation of this file.
1
4#pragma once
5#include "diagnostics/trace.h"
6#include "object.h"
7#include <iostream>
8
10namespace xtd {
17 class tracestreambuf : public object, public std::stringbuf {
18 protected:
20
23 int32 sync() override {
24 #if defined(TRACE)
25 if (!str().empty()) {
26 if (str() == "\n") xtd::diagnostics::trace::write_line();
27 else if (string(str()).ends_with('\n')) xtd::diagnostics::trace::write_line(string(str()).trim_end('\n'));
29 str("");
30 }
31 #endif
32 return 0;
33 }
35 };
36}
static void write_line()
Writes a line terminator to the trace listeners in the listeners collection.
Definition trace.h:343
static void write(const xtd::string &message)
Writes a message to the trace listeners in the listeners collection.
Definition trace.h:257
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:42
Provides an std::stringbuf for xtd::diagnostics::trace.
Definition tracestreambuf.h:17
int32 sync() override
Synchronizes the buffers with the associated character sequence.
Definition tracestreambuf.h:23
int32_t int32
Represents a 32-bit signed integer.
Definition int32.h:23
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Contains xtd::object class.
Contains xtd::diagnostics::trace class.