xtd - Reference Guide 0.2.0
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 {
31  class core_export_ switch_base : public xtd::object {
32  public:
34  switch_base(const switch_base& value) = default;
35  switch_base& operator=(const switch_base& value) = default;
36  bool operator==(const switch_base& value) const;
37  bool operator!=(const switch_base& value) const;
39 
41 
45  const std::map<xtd::ustring, xtd::ustring>& attributes() const;
48  std::map<xtd::ustring, xtd::ustring>& attributes();
51  void attributes(const std::map<xtd::ustring, xtd::ustring>& attributes);
52 
56  const xtd::ustring& description() const;
57 
61  const xtd::ustring& display_name() const;
63 
64  protected:
66 
74  switch_base(const xtd::ustring& display_name, const xtd::ustring& description);
80  switch_base(const xtd::ustring& display_name, const xtd::ustring& description, const xtd::ustring& default_switch_value);
82 
84 
88  int32_t switch_setting() const;
91  void switch_setting(int32_t switch_setting);
92 
98  const xtd::ustring& value() const;
104  void value(const xtd::ustring& value);
106 
108 
115  virtual std::vector<xtd::ustring> get_supported_attributes() const;
116 
118  virtual void on_switch_setting_changed();
119 
124  virtual void on_value_changed();
126 
127  private:
128  xtd::ustring display_name_;
129  xtd::ustring description_;
130  std::map<xtd::ustring, xtd::ustring> attributes_;
131  int32_t switch_setting_ = 0;
132  xtd::ustring value_;
133  };
134  }
135 }
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:50
Contains xtd::diagnostics::source_levels enum class.
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes...
Definition: object.h:30
Provides an abstract base class to create new debugging and tracing switches.
Definition: switch_base.h:31