Provides a simple on/off switch that controls debugging and tracing output.
Provides a simple on/off switch that controls debugging and tracing output.
Definition boolean_switch.hpp:50
Provides an abstract base class to create new debugging and tracing switches.
Definition switch_base.hpp:36
#define core_export_
Define shared library export.
Definition core_export.hpp:13
- Inheritance
- xtd::object → xtd::diagnostics::switch_base → xtd::diagnostics::boolean_switch
- Header
#include <xtd/diagnostics/boolean_switch>
- Namespace
- xtd::diagnostics
- Library
- xtd.core
- Examples
- This example configuration section defines a xtd::diagnostics::boolean_switch with the xtd::diagnostics::boolean_switch::display_name property set to my_switch and the xtd::diagnostics::boolean_switch::enabled value set to true. Within your application, you can use the configured switch value by creating a xtd::diagnostics::boolean_switch with the same name, as shown in the following code example.
private:
public:
static auto main() {
}
}
Represents the standard input, output, and error streams for console applications.
Definition console.hpp:36
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
bool enabled() const
Gets a value indicating whether the switch is enabled or disabled.
const xtd::string & display_name() const noexcept
Gets a name used to identify the switch.
- Note
- These debug and trace compiler switches are not required when using the xtd::diagnostics::boolean_switch class in isolation. They are only required in conjunction with xtd::diagnostics::trace or xtd::diagnostics::debug methods that are conditionally compiled.
- Note
- To improve performance, you can make xtd::diagnostics::boolean_switch members static in your class.
|
const std::map< xtd::string, xtd::string > & | attributes () const noexcept |
| Gets the custom switch attributes.
|
|
std::map< xtd::string, xtd::string > & | attributes () noexcept |
| Gets the custom switch attributes.
|
|
void | attributes (const std::map< xtd::string, xtd::string > &attributes) noexcept |
| Sets the custom switch attributes.
|
|
const xtd::string & | description () const noexcept |
| Gets a description of the switch.
|
|
const xtd::string & | display_name () const noexcept |
| Gets a name used to identify the switch.
|
|
bool | equals (const switch_base &value) const noexcept override |
|
virtual bool | equals (const object &obj) const noexcept |
| Determines whether the specified object is equal to the current object.
|
|
| object ()=default |
| Create a new instance of the ultimate base class object.
|
|
virtual size_t | get_hash_code () const noexcept |
| Serves as a hash function for a particular type.
|
|
virtual type_object | get_type () const noexcept |
| Gets the type of the current instance.
|
|
template<typename object_t > |
xtd::uptr< object_t > | memberwise_clone () const |
| Creates a shallow copy of the current object.
|
|
virtual xtd::string | to_string () const noexcept |
| Returns a xtd::string that represents the current object.
|
|
virtual bool | equals (const switch_base &) const noexcept=0 |
| Indicates whether the current object is equal to another object of the same type.
|
|
template<typename object_a_t , typename object_b_t > |
static bool | equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
| Determines whether the specified object instances are considered equal.
|
|
template<typename object_a_t , typename object_b_t > |
static bool | equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
| Determines whether the specified object instances are considered equal.
|
|
template<typename object_a_t , typename object_b_t > |
static bool | reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
| Determines whether the specified object instances are the same instance.
|
|
| switch_base (const xtd::string &display_name, const xtd::string &description) |
| Initializes a new instance of the switch_base class.
|
|
| switch_base (const xtd::string &display_name, const xtd::string &description, const xtd::string &default_switch_value) |
| Initializes a new instance of the switch_base class.
|
|
int32 | switch_setting () const noexcept |
| Gets the current setting for this switch.
|
|
void | switch_setting (int32 switch_setting) |
| Sets the current setting for this switch.
|
|
const xtd::string & | value () const noexcept |
| Gets the value of the switch.
|
|
void | value (const xtd::string &value) |
| Sets the value of the switch.
|
|
virtual std::vector< xtd::string > | get_supported_attributes () const noexcept |
| Gets the custom attributes supported by the switch.
|
|
virtual void | on_switch_setting_changed () |
| Invoked when the switch_setting property is changed.
|
|