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 {
19 class debugstreambuf : public object, public std::stringbuf {
20 protected:
22
25 int32 sync() override {
26 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
27 if (!str().empty()) {
28 if (str() == "\n") xtd::diagnostics::debug::write_line();
29 else if (xtd::ustring(str()).ends_with('\n')) xtd::diagnostics::debug::write_line(xtd::ustring(str()).trim_end('\n'));
31 str("");
32 }
33 #endif
34 return 0;
35 }
37 };
38}
Provides an std::stringbuf for xtd::diagnostics::debug.
Definition debugstreambuf.h:19
int32 sync() override
Synchronizes the buffers with the associated character sequence.
Definition debugstreambuf.h:25
static void write_line()
Writes a line terminator to the trace listeners in the listeners collection.
Definition debug.h:374
static void write(const xtd::ustring &message)
Writes a message to the trace listeners in the listeners collection.
Definition debug.h:289
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:32
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:47
Contains xtd::diagnostics::debug class.
int_least32_t int32
Represents a 32-bit signed integer.
Definition types.h:131
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Contains xtd::object class.