xtd 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 "../iequatable.h"
9 #include "../object.h"
10 #include "../ustring.h"
11 #include "source_levels.h"
12 
14 namespace xtd {
16  namespace diagnostics {
34  class core_export_ switch_base : public xtd::object, public xtd::iequatable<switch_base> {
35  public:
37  switch_base(const switch_base& value) = default;
38  switch_base& operator =(const switch_base& value) = default;
40 
42 
46  const std::map<xtd::ustring, xtd::ustring>& attributes() const noexcept;
49  std::map<xtd::ustring, xtd::ustring>& attributes() noexcept;
52  void attributes(const std::map<xtd::ustring, xtd::ustring>& attributes) noexcept;
53 
57  const xtd::ustring& description() const noexcept;
58 
62  const xtd::ustring& display_name() const noexcept;
64 
66 
68  bool equals(const switch_base& value) const noexcept override;
70 
71  protected:
73 
81  switch_base(const xtd::ustring& display_name, const xtd::ustring& description);
87  switch_base(const xtd::ustring& display_name, const xtd::ustring& description, const xtd::ustring& default_switch_value);
89 
91 
95  int32 switch_setting() const noexcept;
98  void switch_setting(int32 switch_setting);
99 
105  const xtd::ustring& value() const noexcept;
111  void value(const xtd::ustring& value);
113 
115 
122  virtual std::vector<xtd::ustring> get_supported_attributes() const noexcept;
123 
125  virtual void on_switch_setting_changed();
126 
131  virtual void on_value_changed();
133 
134  private:
135  xtd::ustring display_name_;
136  xtd::ustring description_;
137  std::map<xtd::ustring, xtd::ustring> attributes_;
138  int32 switch_setting_ = 0;
139  xtd::ustring value_;
140  };
141  }
142 }
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:46
Defines a generalized method that a value type or class implements to create a type-specific method f...
Definition: iequatable.h:18
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:32
Provides an abstract base class to create new debugging and tracing switches.
Definition: switch_base.h:34
int_least32_t int32
Represents a 32-bit signed integer.
Definition: types.h:129