17 const ROOT::Experimental::RAttrMap &ROOT::Experimental::RAttrBase::GetDefaults()
const
19 static RAttrMap empty;
26 bool ROOT::Experimental::RAttrBase::CopyValue(
const std::string &name,
const RAttrMap::Value_t &value,
bool check_type)
29 const auto *dvalue = GetDefaults().Find(name);
30 if (!dvalue || !dvalue->Compatible(value.Kind()))
34 if (
auto access = EnsureAttr(name)) {
35 access.attr->Add(access.fullname, value.Copy());
45 bool ROOT::Experimental::RAttrBase::IsValueEqual(
const std::string &name,
const RAttrMap::Value_t &value,
bool use_style)
const
47 if (
auto v = AccessValue(name, use_style))
48 return v.value->IsEqual(value);
56 void ROOT::Experimental::RAttrBase::CopyTo(RAttrBase &tgt,
bool use_style)
const
58 for (
const auto &entry : GetDefaults()) {
59 if (
auto v = AccessValue(entry.first, use_style))
60 tgt.CopyValue(entry.first, *v.value);
67 bool ROOT::Experimental::RAttrBase::IsSame(
const RAttrBase &tgt,
bool use_style)
const
69 for (
const auto &entry : GetDefaults()) {
70 if (
auto v = AccessValue(entry.first, use_style))
71 if (!tgt.IsValueEqual(entry.first, *v.value, use_style))
return false;
79 void ROOT::Experimental::RAttrBase::AssignDrawable(RDrawable *drawable,
const std::string &prefix)
87 void ROOT::Experimental::RAttrBase::AssignParent(RAttrBase *parent,
const std::string &prefix)
95 void ROOT::Experimental::RAttrBase::ClearValue(
const std::string &name)
97 if (
auto access = AccessAttr(name))
98 const_cast<RAttrMap*
>(access.attr)->Clear(access.fullname);
101 void ROOT::Experimental::RAttrBase::SetValue(
const std::string &name,
bool value)
103 if (
auto access = EnsureAttr(name))
104 access.attr->AddBool(access.fullname, value);
107 void ROOT::Experimental::RAttrBase::SetValue(
const std::string &name,
int value)
109 if (
auto access = EnsureAttr(name))
110 access.attr->AddInt(access.fullname, value);
113 void ROOT::Experimental::RAttrBase::SetValue(
const std::string &name,
double value)
115 if (
auto access = EnsureAttr(name))
116 access.attr->AddDouble(access.fullname, value);
119 void ROOT::Experimental::RAttrBase::SetValue(
const std::string &name,
const std::string &value)
121 if (
auto access = EnsureAttr(name))
122 access.attr->AddString(access.fullname, value);
126 void ROOT::Experimental::RAttrBase::Clear()
128 for (
const auto &entry : GetDefaults())
129 ClearValue(entry.first);