xtd 0.2.0
debug_form.h
Go to the documentation of this file.
1 #pragma once
6 #include "trace_form_base.h"
7 #include "icontrol_trace.h"
8 #include <xtd/diagnostics/debug>
9 
11 namespace xtd {
13  namespace forms {
35  public:
37 
40  debug_form() : trace_form_base("Debug") {
41  xtd::diagnostics::debug::listeners().push_back(listener_);
42  #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
43  visible(true);
44  #endif
45  }
47 
51 
53 
57  const xtd::diagnostics::trace_listener& trace_listener() const noexcept {return *listener_;}
62 
64 
66  void flush() override {}
67 
68  void write(const xtd::ustring& debug) override {
69  #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
71  #endif
72  }
73  void write_line(const xtd::ustring& debug) override {
74  #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
76  #endif
77  }
79 
80  private:
81  std::shared_ptr<xtd::diagnostics::trace_listener> listener_ = xtd::forms::control_trace_listener::create(*this);
82  };
83  }
84 }
virtual void write(const xtd::ustring &trace)
Writes trace string to the multiline text.
Provides the abstract base class for the listeners who monitor trace and debug output.
Definition: trace_listener.h:35
const xtd::diagnostics::trace_listener & trace_listener() const noexcept
Gets underlying trace listener.
Definition: debug_form.h:57
virtual void write_line(const xtd::ustring &trace)
Writes trace string to the multiline text followed by a line terminator.
Contains xtd::forms::trace_form_base dialog.
debug_form()
Initializes a new instance of the debug_form class.
Definition: debug_form.h:40
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:73
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:68
Represents a base form for debug_form and trace_form forms. This class cannot be instantiated.
Definition: trace_form_base.h:22
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:46
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:20
Represents a form that displays debug form. This class cannot be inherited.
Definition: debug_form.h:34
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:52
Contains xtd::forms::control_trace_listener listener.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
static listener_collection & listeners() noexcept
Gets the collection of listeners that is monitoring the trace output.
xtd::diagnostics::trace_listener & trace_listener()
Gets underlying trace listener.
Definition: debug_form.h:60
virtual bool visible() const noexcept
Gets a value indicating whether the control and all its child controls are displayed.
void flush() override
Flushes the output buffer and causes buffered data to write to the control.
Definition: debug_form.h:66