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.
switch_base.h
Go to the documentation of this file.
1 #pragma once
5 #include <cstdint>
6 #include <map>
7 #include <vector>
8 #include "../object.h"
9 #include "../ustring.h"
10 #include "source_levels.h"
11 
13 namespace xtd {
15  namespace diagnostics {
26  class switch_base : public object {
27  public:
29  switch_base(const switch_base& value) = default;
30  switch_base& operator=(const switch_base& value) = default;
31  bool operator==(const switch_base& value) const;
32  bool operator!=(const switch_base& value) const;
34 
37  const std::map<xtd::ustring, xtd::ustring>& attributes() const;
40  std::map<xtd::ustring, xtd::ustring>& attributes();
43  void attributes(const std::map<xtd::ustring, xtd::ustring>& attributes);
44 
48  const xtd::ustring& description() const;
49 
53  const xtd::ustring& display_name() const;
54 
55  protected:
68  switch_base(const xtd::ustring& display_name, const xtd::ustring& description, const xtd::ustring& default_switch_value);
69 
72  int32_t switch_setting() const;
76 
82  const xtd::ustring& value() const;
88  void value(const xtd::ustring& value);
89 
95  virtual std::vector<xtd::ustring> get_supported_attributes() const;
96 
98  virtual void on_switch_setting_changed();
99 
104  virtual void on_value_changed();
105 
106  private:
107  xtd::ustring display_name_;
108  xtd::ustring description_;
109  std::map<xtd::ustring, xtd::ustring> attributes_;
110  int32_t switch_setting_ = 0;
111  xtd::ustring value_;
112  };
113  }
114 }
Provides an abstract base class to create new debugging and tracing switches.
Definition: switch_base.h:26
const xtd::ustring & value() const
Gets the value of the switch.
const xtd::ustring & description() const
Gets a description of the switch.
void switch_setting(int32_t switch_setting)
Sets the current setting for this switch.
switch_base(const xtd::ustring &display_name, const xtd::ustring &description)
Initializes a new instance of the switch_base class.
virtual std::vector< xtd::ustring > get_supported_attributes() const
Gets the custom attributes supported by the switch.
void value(const xtd::ustring &value)
Sets the value of the switch.
const xtd::ustring & display_name() const
Gets a name used to identify the switch.
virtual void on_switch_setting_changed()
Invoked when the switch_setting property is changed.
std::map< xtd::ustring, xtd::ustring > & attributes()
Gets the custom switch attributes.
void attributes(const std::map< xtd::ustring, xtd::ustring > &attributes)
Sets the custom switch attributes.
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.
int32_t switch_setting() const
Gets the current setting for this switch.
const std::map< xtd::ustring, xtd::ustring > & attributes() const
Gets the custom switch attributes @rettur nA StringDictionary containing the case-insensitive custom ...
virtual void on_value_changed()
Invoked when the value property is changed.
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition: object.h:26
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17
Contains xtd::diagnostics::source_levels enum class.