xtd 0.2.0
Loading...
Searching...
No Matches
debug_form.h
Go to the documentation of this file.
1
4#pragma once
6#include "trace_form_base.h"
7#include "icontrol_trace.h"
8#include <xtd/diagnostics/debug>
9
11namespace xtd {
13 namespace forms {
37 public:
39
43 xtd::diagnostics::debug::listeners().push_back(listener_);
44 #if !defined(NDEBUG) || defined(DEBUG) || defined(TRACE)
45 visible(true);
46 defined = true;
47 #endif
48 }
50
54
56
65
67
69 void flush() override;
70
71 void write(const xtd::string& debug) override {
72 if (!defined) return;
74 }
75 void write_line(const xtd::string& debug) override {
76 if (!defined) return;
78 }
80
81 protected:
83
89 xtd::uptr<xtd::object> clone() const override;
91
92 private:
94 bool defined = false;
95 };
96 }
97}
Represents text as a sequence of character units.
Definition basic_string.h:79
static listener_collection & listeners() noexcept
Gets the collection of listeners that is monitoring the trace output.
Provides the abstract base class for the listeners who monitor trace and debug output.
Definition trace_listener.h:37
static xtd::sptr< xtd::diagnostics::trace_listener > create(xtd::forms::icontrol_trace &control_trace)
Create new control_trace_listener.
Definition control_trace_listener.h:88
virtual bool visible() const noexcept
Gets a value indicating whether the control and all its child controls are displayed.
Represents a form that displays debug form. This class cannot be inherited.
Definition debug_form.h:36
xtd::uptr< xtd::object > clone() const override
Creates a new object that is a copy of the current instance.
const xtd::diagnostics::trace_listener & trace_listener() const noexcept
Gets underlying trace listener.
debug_form()
Initializes a new instance of the debug_form class.
Definition debug_form.h:42
void write_line(const xtd::string &debug) override
Write debug or trace message on this instance control followed by line terminator.
Definition debug_form.h:75
void write(const xtd::string &debug) override
Write debug or trace message on this instance control.
Definition debug_form.h:71
void flush() override
Flushes the output buffer and causes buffered data to write to the control.
Allow a control to be called by control_trace_listener for writing debug or trace message.
Definition icontrol_trace.h:22
Represents a base form for debug_form and trace_form forms. This class cannot be instantiated.
Definition trace_form_base.h:30
virtual void write_line(const xtd::string &trace)
Writes trace string to the multiline text followed by a line terminator.
virtual void write(const xtd::string &trace)
Writes trace string to the multiline text.
Contains xtd::forms::control_trace_listener listener.
std::unique_ptr< type_t > uptr
The xtd::uptr object is a unique pointer.
Definition uptr.h:25
std::shared_ptr< type_t > sptr
The xtd::sptr object is a shared pointer.
Definition sptr.h:25
@ debug
Build type debug.
Contains xtd::forms::icontrol_trace interface.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition xtd_about_box.h:12
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Contains xtd::forms::trace_form_base dialog.