4 #include "AttributeModifier.h"
16 template<
int notificationLevel>
26 const char*
c_str()
const {
return mValue.c_str(); }
28 void* getRawValue() final {
return (
void*)mValue.data(); }
29 size_t MemorySize() const final {
return mValue.size(); };
32 virtual bool getValue(kstl::string& value)
const override
34 kstl::string tmpValue = this->mValue;
35 CALL_GETMODIFIER(notificationLevel, tmpValue);
39 virtual bool getValue(usString& value)
const override
41 kstl::string tmpValue = this->mValue;
42 CALL_GETMODIFIER(notificationLevel, tmpValue);
46 virtual bool getValue(
void*& value)
const override
48 value = (
void*)&mValue;
52 virtual bool getValue(
float& value)
const override
54 value = (float)atof(mValue.c_str());
61 virtual bool setValue(
const char* value)
override
66 kstl::string tmpValue = value;
67 CALL_SETMODIFIER(notificationLevel, tmpValue);
68 this->mValue = tmpValue;
69 DO_NOTIFICATION(notificationLevel);
72 virtual bool setValue(
const kstl::string& value)
override
77 kstl::string tmpValue = value;
78 CALL_SETMODIFIER(notificationLevel, tmpValue);
79 this->mValue = tmpValue;
80 DO_NOTIFICATION(notificationLevel);
84 #undef DECLARE_SET_NUMERIC
85 #define DECLARE_SET_NUMERIC(type) virtual bool setValue(type value) override { \
86 if (this->isReadOnly())\
88 kstl::string tmpValue = std::to_string(value); \
89 CALL_SETMODIFIER(notificationLevel, tmpValue); \
90 this->mValue = tmpValue; \
91 DO_NOTIFICATION(notificationLevel); \
95 EXPAND_MACRO_FOR_NUMERIC_TYPES(NOQUALIFIER, NOQUALIFIER, DECLARE_SET_NUMERIC);
100 auto& operator+=(
const kstl::string& attribute)
108 auto& operator+=(
const char* attribute)
110 *
this += kstl::string{ attribute };