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.
|
#include <trace_switch.h>
Provides a multilevel switch to control tracing and debug output without recompiling your code.
Inherits xtd::diagnostics::switch_base.
Public Member Functions | |
trace_switch (const xtd::ustring &display_name, const xtd::ustring &description) | |
Initializes a new instance of the xtd::diagnostics::trace_switch class, using the specified display name and description. More... | |
trace_switch (const xtd::ustring &display_name, const xtd::ustring &description, const xtd::ustring &default_switch_value) | |
Initializes a new instance of the xtd::diagnostics::trace_switch class, using the specified display name, description, and default value for the switch. More... | |
xtd::diagnostics::trace_level | level () const |
Gets the trace level that determines the messages the switch allows. More... | |
void | level (xtd::diagnostics::trace_level level) |
Sets the trace level that determines the messages the switch allows. More... | |
bool | trace_error () const |
Gets a value indicating whether the switch allows error-handling messages. More... | |
bool | trace_info () const |
Gets a value indicating whether the switch allows informational messages. More... | |
bool | trace_verbose () const |
Gets a value indicating whether the switch allows all messages. More... | |
bool | trace_warning () const |
Gets a value indicating whether the switch allows warning messages. More... | |
Public Member Functions inherited from xtd::diagnostics::switch_base | |
std::map< xtd::ustring, xtd::ustring > & | attributes () |
Gets the custom switch attributes. More... | |
const std::map< xtd::ustring, xtd::ustring > & | attributes () const |
Gets the custom switch attributes @rettur nA StringDictionary containing the case-insensitive custom attributes for the trace switch. More... | |
void | attributes (const std::map< xtd::ustring, xtd::ustring > &attributes) |
Sets the custom switch attributes. More... | |
const xtd::ustring & | description () const |
Gets a description of the switch. More... | |
const xtd::ustring & | display_name () const |
Gets a name used to identify the switch. More... | |
Public Member Functions inherited from xtd::object | |
object ()=default | |
Create a new instance of the ultimate base class object. More... | |
virtual bool | equals (const object &obj) const noexcept |
Determines whether the specified object is equal to the current object. More... | |
virtual size_t | get_hash_code () const noexcept |
Serves as a hash function for a particular type. More... | |
template<typename object_t > | |
std::unique_ptr< object_t > | memberwise_clone () const |
Gets the type of the current instance. More... | |
virtual xtd::ustring | to_string () const noexcept |
Returns a std::string that represents the current object. More... | |
Protected Member Functions | |
void | on_switch_setting_changed () override |
Invoked when the switch_setting property is changed. More... | |
void | on_value_changed () override |
Invoked when the value property is changed. More... | |
Protected Member Functions inherited from xtd::diagnostics::switch_base | |
switch_base (const xtd::ustring &display_name, const xtd::ustring &description) | |
Initializes a new instance of the switch_base class. More... | |
switch_base (const xtd::ustring &display_name, const xtd::ustring &description, const xtd::ustring &default_switch_value) | |
Initializes a new instance of the switch_base class. More... | |
virtual std::vector< xtd::ustring > | get_supported_attributes () const |
Gets the custom attributes supported by the switch. More... | |
int32_t | switch_setting () const |
Gets the current setting for this switch. More... | |
void | switch_setting (int32_t switch_setting) |
Sets the current setting for this switch. More... | |
const xtd::ustring & | value () const |
Gets the value of the switch. More... | |
void | value (const xtd::ustring &value) |
Sets the value of the switch. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from xtd::object | |
static bool | equals (const object &object_a, const object &object_b) noexcept |
Determines whether the specified object instances are considered equal. More... | |
static bool | reference_equals (const object &object_a, const object &object_b) noexcept |
Determines whether the specified object instances are the same instance. More... | |
xtd::diagnostics::trace_switch::trace_switch | ( | const xtd::ustring & | display_name, |
const xtd::ustring & | description | ||
) |
Initializes a new instance of the xtd::diagnostics::trace_switch class, using the specified display name and description.
display_name | The name to display on a user interface. |
description | The description of the switch. |
xtd::diagnostics::trace_switch::trace_switch | ( | const xtd::ustring & | display_name, |
const xtd::ustring & | description, | ||
const xtd::ustring & | default_switch_value | ||
) |
Initializes a new instance of the xtd::diagnostics::trace_switch class, using the specified display name, description, and default value for the switch.
display_name | The name to display on a user interface. |
description | The description of the switch. |
default_switch_value | The default value of the switch. |
xtd::diagnostics::trace_level xtd::diagnostics::trace_switch::level | ( | ) | const |
Gets the trace level that determines the messages the switch allows.
void xtd::diagnostics::trace_switch::level | ( | xtd::diagnostics::trace_level | level | ) |
Sets the trace level that determines the messages the switch allows.
level | One of the xtd::diagnostics::trace_level values that specifies the level of messages that are allowed by the switch. |
|
overrideprotectedvirtual |
Invoked when the switch_setting property is changed.
Reimplemented from xtd::diagnostics::switch_base.
|
overrideprotectedvirtual |
Invoked when the value property is changed.
Reimplemented from xtd::diagnostics::switch_base.
bool xtd::diagnostics::trace_switch::trace_error | ( | ) | const |
Gets a value indicating whether the switch allows error-handling messages.
bool xtd::diagnostics::trace_switch::trace_info | ( | ) | const |
Gets a value indicating whether the switch allows informational messages.
bool xtd::diagnostics::trace_switch::trace_verbose | ( | ) | const |
Gets a value indicating whether the switch allows all messages.
bool xtd::diagnostics::trace_switch::trace_warning | ( | ) | const |
Gets a value indicating whether the switch allows warning messages.