21using namespace std::string_literals;
23template<>
bool RAttrMap::Value_t::Get<bool>()
const {
return GetBool(); }
24template<>
int RAttrMap::Value_t::Get<int>()
const {
return GetInt(); }
25template<>
double RAttrMap::Value_t::Get<double>()
const {
return GetDouble(); }
26template<> std::string RAttrMap::Value_t::Get<std::string>()
const {
return GetString(); }
27template<>
RPadLength RAttrMap::Value_t::Get<RPadLength>()
const {
return GetString(); }
28template<>
RColor RAttrMap::Value_t::Get<RColor>()
const {
return GetString(); }
30template<>
bool RAttrMap::Value_t::GetValue<bool,void>(
const Value_t *rec) {
return rec ? rec->GetBool() :
false; }
31template<>
int RAttrMap::Value_t::GetValue<int,void>(
const Value_t *rec) {
return rec ? rec->GetInt() : 0; }
32template<>
double RAttrMap::Value_t::GetValue<double,void>(
const Value_t *rec) {
return rec ? rec->GetDouble() : 0.; }
33template<> std::string RAttrMap::Value_t::GetValue<std::string,void>(
const Value_t *rec) {
return rec ? rec->GetString() :
""s; }
34template<>
RPadLength RAttrMap::Value_t::GetValue<RPadLength,void>(
const Value_t *rec) {
return rec ? rec->GetString() :
""s; }
37template<>
const RAttrMap::Value_t *RAttrMap::Value_t::GetValue<const RAttrMap::Value_t *,void>(
const Value_t *rec) {
return rec; }
38template<>
const RAttrMap::Value_t *RAttrMap::Value_t::GetValue<const RAttrMap::Value_t *,bool>(
const Value_t *rec) {
return rec && rec->CanConvertTo(
RAttrMap::kBool) ? rec :
nullptr; }
39template<>
const RAttrMap::Value_t *RAttrMap::Value_t::GetValue<const RAttrMap::Value_t *,int>(
const Value_t *rec) {
return rec && rec->CanConvertTo(
RAttrMap::kInt) ? rec :
nullptr; }
40template<>
const RAttrMap::Value_t *RAttrMap::Value_t::GetValue<const RAttrMap::Value_t *,double>(
const Value_t *rec) {
return rec && rec->CanConvertTo(
RAttrMap::kDouble) ? rec :
nullptr; }
42template<>
const RAttrMap::Value_t *RAttrMap::Value_t::GetValue<const RAttrMap::Value_t *,RPadLength>(
const Value_t *rec) {
return rec && rec->CanConvertTo(
RAttrMap::kString) ? rec :
nullptr; }
43template<>
const RAttrMap::Value_t *RAttrMap::Value_t::GetValue<const RAttrMap::Value_t *,RColor>(
const Value_t *rec) {
return rec && rec->CanConvertTo(
RAttrMap::kString) ? rec :
nullptr; }
56 if (!prefix.empty()) prefix.append(
"_");
76 if (
value ==
"true"s) {
81 if (
value ==
"false"s) {
92 }
else if ((
value.length() > 2) && (*
beg ==
'0') && (
value[1] ==
'x')) {
98 if (std::find_if(
beg,
value.end(), [](
unsigned char c) { return !std::isdigit(c); }) ==
value.end()) {
102 auto ivalue = std::stoll(base == 16 ?
value.substr(2) :
value,
nullptr, base);
118 return !std::isdigit(c) && (c !=
'.') && (c !=
'-') && (c !=
'+') && (c !=
'e');
141 if (!
value)
return false;
153 if(!
value->CanConvertTo(
entry->second->Kind())) {
162 switch (
entry->second->Kind()) {
#define R__LOG_ERROR(...)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Base class for attributes aggregations like lines or fill attributes.
Base class for all attributes, used with RDrawable.
const char * GetPrefix() const
virtual RAttrMap CollectDefaults() const =0
virtual bool GetBool() const
RAttrMap & AddString(const std::string &name, const std::string &value)
RAttrMap & AddDouble(const std::string &name, double value)
RAttrMap & AddNoValue(const std::string &name)
std::unordered_map< std::string, std::unique_ptr< Value_t > > m
JSON_object.
RAttrMap & AddInt(const std::string &name, int value)
bool Change(const std::string &name, Value_t *value=nullptr)
Change attribute using string value and kind Used to change attributes from JS side Returns true if v...
RAttrMap & AddBool(const std::string &name, bool value)
RAttrMap & AddDefaults(const RAttrBase &vis)
Add defaults values form sub attribute.
void AddBestMatch(const std::string &name, const std::string &value)
Add attribute, converting to best possible type Tested boolean, int, double.
const_iterator end() const
ROOT::RLogChannel & GPadLog()
Log channel for GPad diagnostics.