xtd - Reference Guide  0.1.1
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
trace_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  trace_form() : trace_form_base("Trace") {
29  xtd::diagnostics::trace::listeners().push_back(listener_);
30 #if 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& trace) override {
46 #if defined(TRACE)
48 #endif
49  }
50  void write_line(const xtd::ustring& trace) override {
51 #if 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 }
Provides the abstract base class for the listeners who monitor trace and debug output.
Definition: trace_listener.h:28
static listener_collection & listeners()
Gets the collection of listeners that is monitoring the trace output.
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
virtual bool visible() const
Gets a value indicating whether the control and all its child controls are displayed.
Definition: control.h:674
Allow a control to be called by control_trace_listener for writing debug or trace message.
Definition: icontrol_trace.h:18
Represents a base form for debug_form and trace_form forms. This class cannot be instantiated.
Definition: trace_form_base.h:20
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:118
virtual void write(const xtd::ustring &trace)
Writes trace string to the multiline text.
Definition: trace_form_base.h:111
Represents a form that displays trace form. This class cannot be inherited.
Definition: trace_form.h:25
trace_form()
Initializes a new instance of the trace_form class.
Definition: trace_form.h:28
void write(const xtd::ustring &trace) override
Write debug or trace message on this instance control.
Definition: trace_form.h:45
const xtd::diagnostics::trace_listener & trace_listener() const
Gets underlying trace listener.
Definition: trace_form.h:40
void write_line(const xtd::ustring &trace) override
Write debug or trace message on this instance control followed by line terminator.
Definition: trace_form.h:50
xtd::diagnostics::trace_listener & trace_listener()
Gets underlying trace listener.
Definition: trace_form.h:43
void flush() override
Flushes the output buffer and causes buffered data to write to the control.
Definition: trace_form.h:56
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
@ end
The END key.
Contains xtd::forms::icontrol_trace interface.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17
Contains xtd::forms::trace_form_base dialog.