xtd - Reference Guide  0.2.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
debug_form.h
Go to the documentation of this file.
1 #pragma once
5 #include "trace_form_base.h"
6 #include "icontrol_trace.h"
7 
9 namespace xtd {
11  namespace forms {
26  public:
28  debug_form() : trace_form_base("Debug") {
29  xtd::diagnostics::debug::listeners().push_back(listener_);
30 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
31  visible(true);
32 #endif
33  }
37 
40  const xtd::diagnostics::trace_listener& trace_listener() const {return *listener_;}
44 
45  void write(const xtd::ustring& debug) override {
46 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
48 #endif
49  }
50  void write_line(const xtd::ustring& debug) override {
51 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
53 #endif
54  }
55 
56  void flush() override {}
57 
58  private:
59  std::shared_ptr<xtd::diagnostics::trace_listener> listener_ = xtd::forms::control_trace_listener::create(*this);
60  };
61  }
62 }
virtual void write(const xtd::ustring &trace)
Writes trace string to the multiline text.
Definition: trace_form_base.h:106
Provides the abstract base class for the listeners who monitor trace and debug output.
Definition: trace_listener.h:28
virtual void write_line(const xtd::ustring &trace)
Writes trace string to the multiline text followed by a line terminator.
Definition: trace_form_base.h:113
Contains xtd::forms::trace_form_base dialog.
debug_form()
Initializes a new instance of the debug_form class.
Definition: debug_form.h:28
static listener_collection & listeners()
Gets the collection of listeners that is monitoring the trace output.
void write_line(const xtd::ustring &debug) override
Write debug or trace message on this instance control followed by line terminator.
Definition: debug_form.h:50
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
void write(const xtd::ustring &debug) override
Write debug or trace message on this instance control.
Definition: debug_form.h:45
Represents a base form for debug_form and trace_form forms. This class cannot be instantiated.
Definition: trace_form_base.h:20
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
Contains xtd::forms::icontrol_trace interface.
Allow a control to be called by control_trace_listener for writing debug or trace message...
Definition: icontrol_trace.h:18
Represents a form that displays debug form. This class cannot be inherited.
Definition: debug_form.h:25
virtual bool visible() const
Gets a value indicating whether the control and all its child controls are displayed.
Definition: control.h:702
static std::shared_ptr< xtd::diagnostics::trace_listener > create(xtd::forms::icontrol_trace &control_trace)
Create new control_trace_listener.
Definition: control_trace_listener.h:38
const xtd::diagnostics::trace_listener & trace_listener() const
Gets underlying trace listener.
Definition: debug_form.h:40
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
xtd::diagnostics::trace_listener & trace_listener()
Gets underlying trace listener.
Definition: debug_form.h:43
void flush() override
Flushes the output buffer and causes buffered data to write to the control.
Definition: debug_form.h:56