6 #include "AttributeModifier.h"
17 template<
int notificationLevel>
25 maUSStringHeritage(
CoreModifiable& owner,
bool isInitAttribute, KigsID ID,
const kstl::string& value ) : CoreModifiableAttributeData<usString>(owner, isInitAttribute, ID)
27 mValue = usString{ value };
30 void* getRawValue() final {
return (
void*)mValue.us_str(); }
31 size_t MemorySize() const final {
return mValue.length()*
sizeof(u16); };
34 virtual bool getValue(kstl::string& value)
const override
36 usString copy(mValue);
37 value = copy.ToString();
40 virtual bool getValue(usString& value)
const override
45 virtual bool getValue(
void*& value)
const override
47 value = (
void*)&mValue;
53 virtual bool setValue(
const char* value)
override
58 mValue = usString(value);
60 DO_NOTIFICATION(notificationLevel);
64 virtual bool setValue(
const kstl::string& value)
override
71 DO_NOTIFICATION(notificationLevel);
75 virtual bool setValue(
const unsigned short* value)
override
81 DO_NOTIFICATION(notificationLevel);
85 virtual bool setValue(
const usString& value)
override
91 DO_NOTIFICATION(notificationLevel);
95 virtual bool setValue(
const UTF8Char* value)
override
102 DO_NOTIFICATION(notificationLevel);
107 #undef DECLARE_SET_NUMERIC
108 #define DECLARE_SET_NUMERIC(type) virtual bool setValue(type value) override { \
109 if (this->isReadOnly())\
111 usString tmpValue = std::to_string(value); \
112 CALL_SETMODIFIER(notificationLevel, tmpValue); \
113 this->mValue = tmpValue; \
114 DO_NOTIFICATION(notificationLevel); \
118 EXPAND_MACRO_FOR_NUMERIC_TYPES(NOQUALIFIER, NOQUALIFIER, DECLARE_SET_NUMERIC);
142 bool operator==(
const usString& L_value)
const
144 return (mValue == L_value);
146 bool operator==(
unsigned short* L_value)
const
148 return (mValue == L_value);
150 bool operator!=(
const usString& L_value)
const
152 return (mValue != L_value);
154 bool operator!=(
unsigned short* L_value)
const
156 return (mValue != L_value);
160 auto& operator+=(
const usString& value)
165 auto& operator+=(
unsigned short* value)
172 usString L_tmp = usString(
"");
173 if(value.getValue(L_tmp))
180 const unsigned short*
us_str()
const {
return mValue.us_str(); }
181 kstl::string ToString() {
return mValue.ToString(); }
182 void strcpywUtoC(
char * _Dest,
const unsigned short * src) { mValue.strcpywUtoC(_Dest, src); }
183 kstl::vector<usString> SplitByCharacter(
unsigned short value)
const {
return mValue.SplitByCharacter(value); }
184 unsigned int strlen()
const {
return mValue.strlen(); }
193 #endif //_MAUSSTRING_H