xtd 0.2.0
Loading...
Searching...
No Matches
debugstreambuf.hpp
Go to the documentation of this file.
1
4#pragma once
6#include "object.hpp"
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.hpp:79
Provides an std::stringbuf for xtd::diagnostics::debug.
Definition debugstreambuf.hpp:21
int32 sync() override
Synchronizes the buffers with the associated character sequence.
Definition debugstreambuf.hpp:27
static void write(const xtd::string &message)
Writes a message to the trace listeners in the listeners collection.
Definition debug.hpp:276
static void write_line()
Writes a line terminator to the trace listeners in the listeners collection.
Definition debug.hpp:361
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:42
Contains xtd::diagnostics::debug class.
int32_t int32
Represents a 32-bit signed integer.
Definition int32.hpp:23
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
Contains xtd::object class.