ROOT 6.12/07 Reference Guide |
Definition at line 33 of file TDrawingOptsReader.hxx.
Public Types | |
using | Attrs_t = std::unordered_map< std::string, std::string > |
Public Member Functions | |
TDrawingOptsReader (Attrs_t &attrs) | |
bool | AddFromStyleFile (std::string_view filename) |
Adds attributes specified in filename to those already existing in fAttrs . More... | |
TColor | Parse (std::string_view attr, const TColor &deflt, std::vector< std::string_view >={}) |
Convenience overloads: More... | |
long long | Parse (std::string_view attr, long long deflt, std::vector< std::string_view > opts={}) |
double | Parse (std::string_view attr, double deflt, std::vector< std::string_view >={}) |
TColor | ParseColor (std::string_view attr, const TColor &deflt) |
Parse a TColor from attr's value. More... | |
double | ParseFP (std::string_view attr, double deflt) |
Parse a floating point attribute. More... | |
long long | ParseInt (std::string_view attr, long long deflt, std::vector< std::string_view > opts={}) |
Parse an integer attribute, or if opts is given, return the index of the string from the options file in opts . More... | |
Static Public Member Functions | |
static Attrs_t | ReadDefaults () |
Reads the attribute config values from .rootstylerc . More... | |
Private Attributes | |
Attrs_t & | fAttrs |
Attributes to operate on. More... | |
using ROOT::Experimental::Internal::TDrawingOptsReader::Attrs_t = std::unordered_map<std::string, std::string> |
Definition at line 35 of file TDrawingOptsReader.hxx.
|
inline |
Definition at line 42 of file TDrawingOptsReader.hxx.
bool TDrawingOptsReader::AddFromStyleFile | ( | std::string_view | filename | ) |
Adds attributes specified in filename
to those already existing in fAttrs
.
Overwrites values for attributes that already exist in attrs
!
true
on success, false
if the file cannot be found or the syntax is wrong. Prints an error if the syntax is wrong (but not if the file does not exist). Definition at line 62 of file TDrawingOptsReader.cxx.
|
inline |
Convenience overloads:
Definition at line 69 of file TDrawingOptsReader.hxx.
|
inline |
Definition at line 70 of file TDrawingOptsReader.hxx.
|
inline |
Definition at line 74 of file TDrawingOptsReader.hxx.
ROOT::Experimental::TColor TDrawingOptsReader::ParseColor | ( | std::string_view | attr, |
const TColor & | deflt | ||
) |
Parse a TColor from attr's value.
Colors can be specified as RGBA (red green blue alpha) or RRGGBBAA: #fa7f #ffa07bff For all predefined colors in TColor, colors can be specified as name without leading 'k', e.g. red
for TColor::kRed
. Prints an error and returns TColor::kBlack
if the attribute string cannot be parsed or if the attribute has no entry in fAttrs
.
Definition at line 41 of file TDrawingOptsReader.cxx.
double TDrawingOptsReader::ParseFP | ( | std::string_view | attr, |
double | deflt | ||
) |
Parse a floating point attribute.
Returns 0.
and prints an error if the attribute string cannot be parsed as a floating point number. Prints an error if the attribute has no entry in fAttrs
.
Definition at line 56 of file TDrawingOptsReader.cxx.
long long TDrawingOptsReader::ParseInt | ( | std::string_view | attr, |
long long | deflt, | ||
std::vector< std::string_view > | opts = {} |
||
) |
Parse an integer attribute, or if opts
is given, return the index of the string from the options file in opts
.
Returns 0
(and prints an error) if the string cannot be found in opts, or if the integer cannot be parsed or if the attribute has no entry in fAttrs
.
Definition at line 49 of file TDrawingOptsReader.cxx.
|
static |
Reads the attribute config values from .rootstylerc
.
If the style entry is not found there, tries ~/.rootstylerc
and finally $ROOTSYS/system.rootstylerc
.
Definition at line 30 of file TDrawingOptsReader.cxx.
|
private |
Attributes to operate on.
Definition at line 39 of file TDrawingOptsReader.hxx.