21using namespace std::string_literals;
41template<>
const RAttrMap::Value_t *RAttrMap::Value_t::GetValue<const RAttrMap::Value_t *,std::string>(
const Value_t *rec) {
return rec && rec->CanConvertTo(
RAttrMap::kString) ? rec :
nullptr; }
56 if (!prefix.empty()) prefix.append(
"_");
59 for (
auto &entry : defaults.
m)
60 m[prefix + entry.first] = std::move(entry.second);
76 if (
value ==
"true"s) {
81 if (
value ==
"false"s) {
86 auto beg =
value.begin();
88 bool int_conversion_fails =
false;
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);
104 if ((ivalue >= std::numeric_limits<int>::min()) && (ivalue <= std::numeric_limits<int>::max()))
112 int_conversion_fails =
true;
117 if (!int_conversion_fails && std::find_if(beg,
value.end(), [](
unsigned char c) {
118 return !std::isdigit(c) && (c !=
'.') && (c !=
'-') && (c !=
'+') && (c !=
'e');
121 double dvalue = std::stod(
value);
139 auto entry =
m.find(
name);
140 if ((entry ==
m.end()) || (entry->second->Kind() ==
kNoValue)) {
141 if (!
value)
return false;
153 if(!
value->CanConvertTo(entry->second->Kind())) {
159 if (entry->second->IsEqual(*
value))
162 switch (entry->second->Kind()) {
#define R__LOG_ERROR(...)
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.
const char * GetPrefix() const
virtual RAttrMap CollectDefaults() const =0
virtual bool GetBool() const
static RET_TYPE GetValue(const Value_t *rec)
virtual int GetInt() 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.
RAttrMap()=default
JSON_asbase - store as map object.
Namespace for ROOT features in testing.
ROOT::RLogChannel & GPadLog()
Log channel for GPad diagnostics.