25 fPath(parent.GetPath() +
name), fHolder(parent.GetHolderPtr())
30 fPath{
name.fStr}, fHolder(opts.GetHolder())
36 auto otherHolder = rhs.
fHolder.lock();
40 auto thisHolder = fHolder.lock();
45 thisHolder->EraseAttributesInPath(fPath);
46 thisHolder->CopyAttributesInPath(fPath, *otherHolder, rhs.
fPath);
52 if (
auto holder = GetHolderPtr().lock())
53 holder->At(GetPath() +
name) = strVal;
58 auto holder = GetHolderPtr().lock();
62 if (
const std::string *pStr = holder->AtIf(path))
64 return holder->GetAttrFromStyle(path);
69 auto holder = GetHolderPtr().lock();
73 return !holder->AtIf(path);
78 return IsFromStyle(GetPath() +
name);
83 auto thisHolder = GetHolderPtr().lock();
85 if (!thisHolder && !otherHolder)
87 if (!thisHolder != !otherHolder)
91 return thisHolder->Equal(*otherHolder.get(), GetPath(), other.
GetPath());
96 return std::stof(val);
101 return std::stod(val);
106 return std::stoi(val);
111 return std::to_string(val);
116 return std::to_string(val);
121 return std::to_string(val);
126 auto it = fAttrNameVals.find(path.
fStr);
127 if (it != fAttrNameVals.end())
135 << path.
fStr <<
": not yet implemented!";
141 std::vector<Map_t::const_iterator> thisIters = GetAttributesInPath(thisPath);
144 if (thisIters.size() != otherIters.size())
147 for (
auto thisIter: thisIters) {
157 if (thisIter->second != otherIter->second)
163std::vector<ROOT::Experimental::RDrawingAttrHolder::Map_t::const_iterator>
166 std::vector<Map_t::const_iterator> ret;
167 const std::string &stem = path.
fStr;
168 for (
auto i = fAttrNameVals.begin(),
e = fAttrNameVals.end(); i !=
e; ++i)
169 if (i->first.compare(0, stem.length(), stem) == 0) {
172 if (stem.length() == i->first.length()
173 || i->first[stem.length()] ==
'.')
182 auto iters = GetAttributesInPath(path);
183 for (
auto iter: iters)
184 fAttrNameVals.erase(iter);
191 if (targetPath != sourcePath) {
192 for (
auto sourceIter: sourceIters)
193 fAttrNameVals.emplace(sourceIter->first, sourceIter->second);
195 for (
auto sourceIter: sourceIters) {
196 std::string newPath = targetPath.
fStr + sourceIter->first.substr(sourcePath.
fStr.length());
197 fAttrNameVals.emplace(newPath, sourceIter->second);
#define R__WARNING_HERE(GROUP)
A collection of graphics attributes, for instance everything describing a line: color,...
RDrawingAttrBase()=default
Construct a default, unnamed, unconnected attribute.
std::string GetValueString(const Path &path) const
Get the attribute value as string, for a given attribute name.
bool IsFromStyle(const Path &path) const
Return true if the attribute's value comes from the styles, i.e.
const Path & GetPath() const
Return the attribute names that lead to this attribute, starting with the topmost attribute,...
void SetValueString(const Name &name, const std::string &strVal)
Insert or update the attribute value identified by the valueIndex (in fValueNames) to the value strVa...
const std::weak_ptr< RDrawingAttrHolder > & GetHolderPtr() const
Actual attribute holder.
RDrawingAttrBase & operator=(const RDrawingAttrBase &rhs)
Copy-assign: this assigns the attribute values to this attribute, without changing the connected draw...
bool operator==(const RDrawingAttrBase &other) const
Equality compare to other RDrawingAttrBase.
Path fPath
The chain of attribute names, as used in style files.
std::weak_ptr< RDrawingAttrHolder > fHolder
The container of the attribute values.
A container of (stringified) attributes for which values have been provided.
bool Equal(const RDrawingAttrHolder &other, const Path_t &thisPath, const Path_t &otherPath)
Equality compare the attributes within path to those of other within otherpath.
const std::string * AtIf(const Path_t &path) const
Get an attribute value as pointer to string, given its name path, or nullptr if the attribute does no...
std::vector< Map_t::const_iterator > GetAttributesInPath(const Path_t &path) const
Extract contained attributes for a given path (including sub-attributes); returns iterators to a subs...
std::string GetAttrFromStyle(const Path_t &path)
Get the (stringified) value of the named attribute from the Style.
void CopyAttributesInPath(const Path_t &targetPath, const RDrawingAttrHolder &source, const Path_t &sourcePath)
Copy attributes within otherPath into.
Map_t fAttrNameVals
Map attribute paths to their values.
void EraseAttributesInPath(const Path_t &path)
Erase all custom set attributes for a given path (including sub-attributes).
std::string ToAttributeString(const RColor &val)
Return a std::string representation of a RColor, suitable as input to ColorFromString().
RColor FromAttributeString(const std::string &str, const std::string &name, RColor *)
Initialize a RColor from a string value.
Tag type to disambiguate construction from options.
An attribute name part, e.g. "line".
Combination of names, e.g. "hist2d.box.line.width".
std::string fStr
Path in its dotted form.