xtd 0.2.0
trace_form.h
Go to the documentation of this file.
1 #pragma once
6 #include "icontrol_trace.h"
7 #include "trace_form_base.h"
8 #include <xtd/diagnostics/trace>
9 
11 namespace xtd {
13  namespace forms {
35  public:
37 
40  trace_form() : trace_form_base("Trace") {
41  xtd::diagnostics::trace::listeners().push_back(listener_);
42  #if 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 write(const xtd::ustring& trace) override {
67  #if defined(TRACE)
69  #endif
70  }
71  void write_line(const xtd::ustring& trace) override {
72  #if defined(TRACE)
74  #endif
75  }
76 
77  void flush() override {}
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
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.
void write(const xtd::ustring &trace) override
Write debug or trace message on this instance control.
Definition: trace_form.h:66
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
trace_form()
Initializes a new instance of the trace_form class.
Definition: trace_form.h:40
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.
static listener_collection & listeners() noexcept
Gets the collection of listeners that is monitoring the trace output.
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 trace form. This class cannot be inherited.
Definition: trace_form.h:34
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:71
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
xtd::diagnostics::trace_listener & trace_listener()
Gets underlying trace listener.
Definition: trace_form.h:60
Contains xtd::forms::control_trace_listener listener.
const xtd::diagnostics::trace_listener & trace_listener() const noexcept
Gets underlying trace listener.
Definition: trace_form.h:57
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
void flush() override
Flushes the output buffer and causes buffered data to write to the control.
Definition: trace_form.h:77
virtual bool visible() const noexcept
Gets a value indicating whether the control and all its child controls are displayed.