Provides an abstract base class to create new debugging and tracing switches. 
Provides an abstract base class to create new debugging and tracing switches.
Definition switch_base.hpp:36
 
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:42
 
#define core_export_
Define shared library export.
Definition core_export.hpp:13
 
  - Inheritance
 - xtd::object → xtd::diagnostics::switch_base 
 
- Header
 #include <xtd/diagnostics/switch_base>
  
- Namespace
 - xtd::diagnostics 
 
- Library
 - xtd.core
 
- Notes to implementers
 - If you need trace levels, or mechanisms for setting switch levels different from those provided by boolean_switch, source_switch and trace_switch, you can inherit from switch_base. When inheriting from this class, you must implement the switch_setting method. 
 
 | 
| 
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.  
  | 
|   | 
| 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.  
  | 
|   | 
 | 
|   | 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  | 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() [1/2]
  
  
      
        
          | xtd::diagnostics::switch_base::switch_base  | 
          ( | 
          const xtd::string &  | 
          display_name,  | 
         
        
           | 
           | 
          const xtd::string &  | 
          description  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
protected   | 
  
 
Initializes a new instance of the switch_base class. 
- Parameters
 - 
  
    | display_name | The name of the switch.  | 
    | description | The description for the switch.  | 
  
   
- Notes to inheritors
 - To set the value of the switch, set the switch_setting property in the constructor. 
 
 
 
◆ switch_base() [2/2]
Initializes a new instance of the switch_base class. 
- Parameters
 - 
  
    | display_name | The name of the switch.  | 
    | description | The description for the switch.  | 
    | default_switch_value | The default value for the switch.  | 
  
   
 
 
◆ attributes() [1/3]
Gets the custom switch attributes. 
- Returns
 - nA StringDictionary containing the case-insensitive custom attributes for the trace switch. 
 
 
 
◆ attributes() [2/3]
Gets the custom switch attributes. 
- Returns
 - A StringDictionary containing the case-insensitive custom attributes for the trace switch. 
 
 
 
◆ attributes() [3/3]
Sets the custom switch attributes. 
- Parameters
 - 
  
    | attributes | A StringDictionary containing the case-insensitive custom attributes for the trace switch.  | 
  
   
 
 
◆ description()
  
  
      
        
          | const xtd::string & xtd::diagnostics::switch_base::description  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
noexcept   | 
  
 
Gets a description of the switch. 
- Returns
 - The description of the switch. The default value is an empty string (""). 
 
 
 
◆ display_name()
  
  
      
        
          | const xtd::string & xtd::diagnostics::switch_base::display_name  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
noexcept   | 
  
 
Gets a name used to identify the switch. 
- Returns
 - The name used to identify the switch. The default value is an empty string (""). 
 
 
 
◆ switch_setting() [1/2]
  
  
      
        
          | int32 xtd::diagnostics::switch_base::switch_setting  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
protectednoexcept   | 
  
 
Gets the current setting for this switch. 
- Returns
 - The current setting for this switch. The default is zero. 
 
 
 
◆ switch_setting() [2/2]
  
  
      
        
          | void xtd::diagnostics::switch_base::switch_setting  | 
          ( | 
          int32  | 
          switch_setting | ) | 
           | 
         
       
   | 
  
protected   | 
  
 
Sets the current setting for this switch. 
- Parameters
 - 
  
    | switch_setting | The current setting for this switch. The default is zero.  | 
  
   
 
 
◆ value() [1/2]
  
  
      
        
          | const xtd::string & xtd::diagnostics::switch_base::value  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
protectednoexcept   | 
  
 
Gets the value of the switch. 
- Returns
 - A string representing the value of the switch. 
 
- Notes to inheritors
 - You should override the on_value_changed() method and provide a conversion operation that sets the appropriate switch_setting value for your switch. 
 
 
 
◆ value() [2/2]
  
  
      
        
          | void xtd::diagnostics::switch_base::value  | 
          ( | 
          const xtd::string &  | 
          value | ) | 
           | 
         
       
   | 
  
protected   | 
  
 
Sets the value of the switch. 
- Parameters
 - 
  
    | value | A string representing the value of the switch.  | 
  
   
- Notes to inheritors
 - You should override the on_value_changed() method and provide a conversion operation that sets the appropriate switch_setting value for your switch. 
 
 
 
◆ get_supported_attributes()
  
  
      
        
          | virtual std::vector< xtd::string > xtd::diagnostics::switch_base::get_supported_attributes  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
protectedvirtualnoexcept   | 
  
 
Gets the custom attributes supported by the switch. 
- Returns
 - A string array that contains the names of the custom attributes supported by the switch, or null if there no custom attributes are supported. 
 
- Notes to Inheritors
 - When inheriting from the switch_base class or a derived class, you can override the get_supported_attributes() method to provide custom attributes for your class. 
 
 
 
◆ on_switch_setting_changed()
  
  
      
        
          | virtual void xtd::diagnostics::switch_base::on_switch_setting_changed  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
protectedvirtual   | 
  
 
 
◆ on_value_changed()
  
  
      
        
          | virtual void xtd::diagnostics::switch_base::on_value_changed  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
protectedvirtual   | 
  
 
 
◆ equals() [1/2]
  
  
      
        
          | virtual bool xtd::object::equals  | 
          ( | 
          const object &  | 
          obj | ) | 
           const | 
         
       
   | 
  
virtualnoexcept   | 
  
 
Determines whether the specified object is equal to the current object. 
- Parameters
 - 
  
    | obj | The object to compare with the current object.  | 
  
   
- Returns
 - true if the specified object is equal to the current object. otherwise, false. 
 
- Examples
 - The following code example compares the current instance with another object. 
#include <xtd/console>
 
 
auto main() -> int {
  auto object1 = new_ptr<object>();
  auto object2 = new_ptr<object>();
  
  auto object3 = object2;
  object3 = object1;
}
 
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
 
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.hpp:10
 
   
Reimplemented from xtd::object.
 
 
◆ equals() [2/2]
template<typename object_a_t , typename object_b_t > 
  
  
      
        
          | static bool xtd::object::equals  | 
          ( | 
          const object_a_t &  | 
          object_a,  | 
         
        
           | 
           | 
          const object_b_t &  | 
          object_b  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inlinestaticnoexcept   | 
  
 
Determines whether the specified object instances are considered equal. 
- Parameters
 - 
  
    | object_a | The first object to compare.  | 
    | object_b | The second object to compare.  | 
  
   
- Returns
 - true if object_a is the same instance as object_b or if both are null references or if object_a(object_b) returns true. otherwise, false. 
 
- Examples
 - The following code example compares different objects. 
#include <xtd/console>
 
 
auto main() -> int {
  string s1 = "Tom";
  string s2 = "Carol";
  
  s1 = "Tom";
  s2 = "Tom";
  
  s1 = "";
  s2 = "Tom";
  
  s1 = "Carol";
  s2 = "";
  
  s1 = "";
  s2 = "";
}
 
virtual bool equals(const object &obj) const noexcept
Determines whether the specified object is equal to the current object.
 
   
 
 
The documentation for this class was generated from the following file: