xtd 0.2.0
Loading...
Searching...
No Matches
debugstreambuf.h
Go to the documentation of this file.
1
4#pragma once
5#include "diagnostics/debug.h"
6#include "object.h"
7#include <iostream>
8
10namespace xtd {
21 class debugstreambuf : public object, public std::stringbuf {
22 protected:
24
27 int32 sync() override {
28 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
29 if (!str().empty()) {
30 if (str() == "\n") xtd::diagnostics::debug::write_line();
31 else if (xtd::string(str()).ends_with('\n')) xtd::diagnostics::debug::write_line(xtd::string(str()).trim_end('\n'));
33 str("");
34 }
35 #endif
36 return 0;
37 }
39 };
40}
Represents text as a sequence of character units.
Definition basic_string.h:79
Provides an std::stringbuf for xtd::diagnostics::debug.
Definition debugstreambuf.h:21
int32 sync() override
Synchronizes the buffers with the associated character sequence.
Definition debugstreambuf.h:27
static void write(const xtd::string &message)
Writes a message to the trace listeners in the listeners collection.
Definition debug.h:276
static void write_line()
Writes a line terminator to the trace listeners in the listeners collection.
Definition debug.h:361
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:42
Contains xtd::diagnostics::debug class.
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.