Scope
ScopeString.h
1 #pragma once
2 
3 #include "ScopeValue.h"
4 
5 namespace scope {
6 
9  : public ScopeValue<std::wstring>
10  , virtual public ScopeValueBase {
11 
12 public:
15  ScopeString(const std::wstring& _str = L"", const std::wstring& _name = L"None")
16  : ScopeValueBase(_name)
17  , ScopeValue(_str, _name) {
18  }
19 
21  ScopeString(const ScopeString& origstr)
22  : ScopeValueBase(origstr.Name())
23  , ScopeValue(origstr.Value(), origstr.Name()) {
24  }
25 
27  using ScopeValue::operator=;
28 
32  ScopeString& operator+=(const ScopeString& r) {
33  Set(Value()+r.Value());
34  return *this;
35  }
36 
37  ScopeString& operator+=(const std::wstring& r) {
38  Set(Value()+r);
39  return *this;
40  }
41 
42  const ScopeString operator+(const ScopeString& r) const { return ScopeString(*this) += r; }
43  const ScopeString operator+(const std::wstring& r) const { return ScopeString(*this) += r; }
49  bool operator==(const ScopeString& r) const { return Value()==r.Value(); }
50  bool operator!=(const ScopeString& r) const { return !((*this)==r); }
51  bool operator==(const std::wstring& r) const { return Value()==r; }
52  bool operator!=(const std::wstring& r) const { return !((*this)==r); }
54 };
55 
56 
57 
58 }
std::wstring Name() const
virtual std::wstring Set(const std::wstring &_v, const bool &_callguisignal=true, const bool &_callothersignal=true, const bool &_callatnochange=false)
Sets the value and calls both change signals if the value actually changed.
Definition: ScopeValue.h:67
ScopeString(const ScopeString &origstr)
Safe copy constructor.
Definition: ScopeString.h:21
std::wstring Value() const
Definition: ScopeValue.h:46
A templated class for a thread-safe value, with signals to GUI or other stuff that are called on valu...
Definition: ScopeValue.h:11
A templated class for a thread-safe std::wstring, with signals that are called on value changes...
Definition: ScopeString.h:8
ScopeString(const std::wstring &_str=L"", const std::wstring &_name=L"None")
Definition: ScopeString.h:15
Base class for a thread-safe value, with signals that are called on value changes.
Definition: ScopeValueBase.h:7