Provides a simple on/off switch that controls debugging and tracing output.
Constructors | |
boolean_switch (const xtd::ustring &display_name, const xtd::ustring &description) | |
Initializes a new instance of the xtd::diagnostics::boolean_switch class with the specified display name and description. More... | |
boolean_switch (const xtd::ustring &display_name, const xtd::ustring &description, const xtd::ustring &default_switch_value) | |
Initializes a new instance of the xtd::diagnostics::boolean_switch class with the specified display name, description, and default switch value. More... | |
Properties | |
bool | enabled () const |
Gets a value indicating whether the switch is enabled or disabled. More... | |
void | enabled (bool enabled) |
Sets a value indicating whether the switch is enabled or disabled. More... | |
Protected methods | |
void | on_value_changed () override |
Determines whether the new value of the Value property can be parsed as a Boolean value. More... | |
Additional Inherited Members | |
Public Member Functions inherited from xtd::diagnostics::switch_base | |
const std::map< xtd::ustring, xtd::ustring > & | attributes () const noexcept |
Gets the custom switch attributes nA StringDictionary containing the case-insensitive custom attributes for the trace switch. More... | |
std::map< xtd::ustring, xtd::ustring > & | attributes () noexcept |
Gets the custom switch attributes. More... | |
void | attributes (const std::map< xtd::ustring, xtd::ustring > &attributes) noexcept |
Sets the custom switch attributes. More... | |
const xtd::ustring & | description () const noexcept |
Gets a description of the switch. More... | |
const xtd::ustring & | display_name () const noexcept |
Gets a name used to identify the switch. More... | |
bool | equals (const switch_base &value) const noexcept override |
Public Member Functions inherited from xtd::object | |
object ()=default | |
Create a new instance of the ultimate base class object. More... | |
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... | |
virtual type_object | get_type () const noexcept |
Gets the type of the current instance. More... | |
template<typename object_t > | |
std::unique_ptr< object_t > | memberwise_clone () const noexcept |
Creates a shallow copy of the current object. More... | |
virtual xtd::ustring | to_string () const noexcept |
Returns a sxd::ustring that represents the current object. More... | |
Public Member Functions inherited from xtd::iequatable< switch_base > | |
virtual bool | equals (const switch_base &) const noexcept=0 |
Indicates whether the current object is equal to another object of the same type. More... | |
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... | |
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... | |
int32 | switch_setting () const noexcept |
Gets the current setting for this switch. More... | |
void | switch_setting (int32 switch_setting) |
Sets the current setting for this switch. More... | |
const xtd::ustring & | value () const noexcept |
Gets the value of the switch. More... | |
void | value (const xtd::ustring &value) |
Sets the value of the switch. More... | |
virtual std::vector< xtd::ustring > | get_supported_attributes () const noexcept |
Gets the custom attributes supported by the switch. More... | |
virtual void | on_switch_setting_changed () |
Invoked when the switch_setting property is changed. More... | |
xtd::diagnostics::boolean_switch::boolean_switch | ( | const xtd::ustring & | display_name, |
const xtd::ustring & | description | ||
) |
Initializes a new instance of the xtd::diagnostics::boolean_switch class with the specified display name and description.
display_name | The name to display on a user interface. |
description | The description of the switch. |
xtd::diagnostics::boolean_switch::boolean_switch | ( | const xtd::ustring & | display_name, |
const xtd::ustring & | description, | ||
const xtd::ustring & | default_switch_value | ||
) |
Initializes a new instance of the xtd::diagnostics::boolean_switch class with the specified display name, description, and default switch value.
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. |
bool xtd::diagnostics::boolean_switch::enabled | ( | ) | const |
Gets a value indicating whether the switch is enabled or disabled.
void xtd::diagnostics::boolean_switch::enabled | ( | bool | enabled | ) |
Sets a value indicating whether the switch is enabled or disabled.
enabled | true if the switch is enabled; otherwise, false. The default is false. |
|
overrideprotectedvirtual |
Determines whether the new value of the Value property can be parsed as a Boolean value.
Reimplemented from xtd::diagnostics::switch_base.