xtd - Reference Guide  0.1.2
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
debugstreambuf.h
Go to the documentation of this file.
1
4#pragma once
5#include <iostream>
6#include "object.h"
7#include "diagnostics/debug.h"
8
10namespace xtd {
17 class debugstreambuf : public object, public std::stringbuf {
18 public:
19 int sync() override {
20#if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
21 if (!str().empty()) {
22 if (str() == "\n") xtd::diagnostics::debug::write_line();
23 else if (xtd::ustring(str()).ends_with('\n')) xtd::diagnostics::debug::write_line(xtd::ustring(str()).trim_end('\n'));
25 str("");
26 }
27#endif
28 return 0;
29 }
30 };
31}
Provides an std::stringbuf for xtd::diagnostics::debug.
Definition debugstreambuf.h:17
static void write_line()
Writes a line terminator to the trace listeners in the listeners collection.
Definition debug.h:336
static void write(const xtd::ustring &message)
Writes a message to the trace listeners in the listeners collection.
Definition debug.h:251
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.h:26
Represents text as a sequence of UTF-8 code units.
Definition ustring.h:48
Contains xtd::diagnostics::debug class.
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition system_report.h:17
Contains xtd::object class.