31 const auto *dvalue = GetDefaults().Find(
name);
32 if (!dvalue || !dvalue->CanConvertFrom(value.
Kind()))
36 if (
auto access = EnsureAttr(
name)) {
37 access.attr->Add(access.fullname, value.
Copy());
49 if (
auto v = AccessValue(
name, use_style))
50 return v.value->CanConvertFrom(value.
Kind()) &&
v.value->IsEqual(value);
60 for (
const auto &entry : GetDefaults()) {
61 if (
auto v = AccessValue(entry.first, use_style))
82 for (
const auto &entry : GetDefaults()) {
83 if (
auto v = AccessValue(entry.first, use_style))
84 if (!tgt.
IsValueEqual(entry.first, *
v.value, use_style))
return false;
116 if (
auto access = AccessAttr(
name))
117 access.attr->Clear(access.fullname);
126 if (
auto access = AccessAttr(
name))
127 access.attr->AddNoValue(access.fullname);
135 if (
auto access = EnsureAttr(
name))
136 access.attr->AddBool(access.fullname, value);
144 if (
auto access = EnsureAttr(
name))
145 access.attr->AddInt(access.fullname, value);
153 if (
auto access = EnsureAttr(
name))
154 access.attr->AddDouble(access.fullname, value);
162 if (
auto access = EnsureAttr(
name))
163 access.attr->AddString(access.fullname, value);
182 for (
const auto &entry : GetDefaults())
183 ClearValue(entry.first);
Base class for all attributes, used with RDrawable.
bool IsValueEqual(const std::string &name, const RAttrMap::Value_t &value, bool use_style=false) const
Check if provided value equal to attribute in the map.
std::unique_ptr< RAttrMap > fOwnAttr
own instance when deep copy is created, persistent for RColor and similar classes
void Clear()
Clear all respective values from drawable. Only defaults can be used.
void SetNoValue(const std::string &name)
Set <NoValue> for attribute.
bool CopyValue(const std::string &name, const RAttrMap::Value_t &value, bool check_type=true)
Copy attributes from other object.
void MoveTo(RAttrBase &tgt)
Move all fields into target object.
RDrawable * fDrawable
! drawable used to store attributes
void ClearValue(const std::string &name)
Clear value if any with specified name.
void AssignDrawable(RDrawable *drawable, const std::string &prefix)
Return value from attributes container - no style or defaults are used.
RAttrBase * fParent
! parent attributes, prefix applied to it
void SetValue(const std::string &name, bool value)
Set boolean value.
bool IsSame(const RAttrBase &src, bool use_style=true) const
Check if all values which are evaluated in this object are exactly the same as in tgt object.
void AssignParent(RAttrBase *parent, const std::string &prefix)
Assign parent object for this RAttrBase.
std::string fPrefix
! name prefix for all attributes values
virtual const RAttrMap & GetDefaults() const
Return default values for attributes, empty for base class.
void CopyTo(RAttrBase &tgt, bool use_style=true) const
Copy attributes into target object.
virtual EValuesKind Kind() const =0
virtual std::unique_ptr< Value_t > Copy() const =0
Base class for drawable entities: objects that can be painted on a RPad.
std::string AsString() const
Converts RPadLength to string like "0.1 + 25px" User coordinates not (yet) supported.
void swap(RDirectoryEntry &e1, RDirectoryEntry &e2) noexcept