Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::Experimental::RAttrBase Class Reference

Base class for all attributes, used with RDrawable.

Author
Sergey Linev s.lin.nosp@m.ev@g.nosp@m.si.de
Date
2019-09-17
Warning
This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome!

Definition at line 31 of file RAttrBase.hxx.

Classes

struct  Rec_t
 
struct  Val_t
 

Public Member Functions

 RAttrBase ()=default
 
virtual ~RAttrBase ()=default
 

Protected Member Functions

 RAttrBase (const RAttrBase &src)
 
 RAttrBase (RAttrBase *parent, const std::string &prefix)
 
 RAttrBase (RDrawable *drawable, const std::string &prefix)
 
const Rec_t AccessAttr (const std::string &name) const
 Find attributes container and full-qualified name for value.
 
const Val_t AccessValue (const std::string &name, bool use_style=true) const
 Search value with given name in attributes.
 
void AssignDrawable (RDrawable *drawable, const std::string &prefix)
 Return value from attributes container - no style or defaults are used.
 
void AssignParent (RAttrBase *parent, const std::string &prefix)
 Assign parent object for this RAttrBase.
 
void Clear ()
 Clear all respective values from drawable. Only defaults can be used.
 
void ClearValue (const std::string &name)
 Clear value if any with specified name.
 
virtual RAttrMap CollectDefaults () const
 Collect all attributes in derived class Works only if such class has dictionary.
 
void CopyTo (RAttrBase &tgt, bool use_style=true) const
 Copy attributes into target object.
 
bool CopyValue (const std::string &name, const RAttrMap::Value_t &value, bool check_type=true)
 Copy attributes from other object.
 
Rec_t EnsureAttr (const std::string &name)
 Ensure attribute with give name exists - creates container for attributes if required.
 
template<typename RET_TYPE , typename MATCH_TYPE = void>
auto Eval (const std::string &name, bool use_dflts=true) const
 Evaluate attribute value.
 
virtual const RAttrMapGetDefaults () const
 Return default values for attributes, empty for base class.
 
const std::string & GetPrefix () const
 
template<typename T >
GetValue (const std::string &name) const
 
template<typename T = void>
bool HasValue (const std::string &name, bool check_defaults=false) const
 
bool IsSame (const RAttrBase &src, bool use_style=true) const
 Check if all values which are evaluated in this object are exactly the same as in tgt object.
 
virtual bool IsValue () const
 
bool IsValueEqual (const std::string &name, const RAttrMap::Value_t &value, bool use_style=false) const
 Check if provided value equal to attribute in the map.
 
void MoveTo (RAttrBase &tgt)
 Move all fields into target object.
 
RAttrBaseoperator= (const RAttrBase &src)
 
void SetNoValue (const std::string &name)
 Set <NoValue> for attribute.
 
void SetValue (const std::string &name, bool value)
 Set boolean value.
 
void SetValue (const std::string &name, const RPadLength &value)
 Set PadLength value.
 
void SetValue (const std::string &name, const std::string &value)
 Set string value.
 
void SetValue (const std::string &name, double value)
 Set double value.
 
void SetValue (const std::string &name, int value)
 Set integer value.
 

Private Attributes

RDrawablefDrawable {nullptr}
 ! drawable used to store attributes
 
std::unique_ptr< RAttrMapfOwnAttr
 own instance when deep copy is created, persistent for RColor and similar classes
 
RAttrBasefParent {nullptr}
 ! parent attributes, prefix applied to it
 
std::string fPrefix
 ! name prefix for all attributes values
 

Friends

bool operator!= (const RAttrBase &lhs, const RAttrBase &rhs)
 
bool operator== (const RAttrBase &lhs, const RAttrBase &rhs)
 
class RAttrMap
 

#include <ROOT/RAttrBase.hxx>

Inheritance diagram for ROOT::Experimental::RAttrBase:
[legend]

Constructor & Destructor Documentation

◆ RAttrBase() [1/4]

ROOT::Experimental::RAttrBase::RAttrBase ( RDrawable drawable,
const std::string &  prefix 
)
inlineprotected

Definition at line 140 of file RAttrBase.hxx.

◆ RAttrBase() [2/4]

ROOT::Experimental::RAttrBase::RAttrBase ( RAttrBase parent,
const std::string &  prefix 
)
inlineprotected

Definition at line 142 of file RAttrBase.hxx.

◆ RAttrBase() [3/4]

ROOT::Experimental::RAttrBase::RAttrBase ( const RAttrBase src)
inlineprotected

Definition at line 144 of file RAttrBase.hxx.

◆ RAttrBase() [4/4]

ROOT::Experimental::RAttrBase::RAttrBase ( )
default

◆ ~RAttrBase()

virtual ROOT::Experimental::RAttrBase::~RAttrBase ( )
virtualdefault

Member Function Documentation

◆ AccessAttr()

const Rec_t ROOT::Experimental::RAttrBase::AccessAttr ( const std::string &  name) const
inlineprotected

Find attributes container and full-qualified name for value.

Definition at line 62 of file RAttrBase.hxx.

◆ AccessValue()

const Val_t ROOT::Experimental::RAttrBase::AccessValue ( const std::string &  name,
bool  use_style = true 
) const
inlineprotected

Search value with given name in attributes.

Definition at line 84 of file RAttrBase.hxx.

◆ AssignDrawable()

void ROOT::Experimental::RAttrBase::AssignDrawable ( RDrawable drawable,
const std::string &  prefix 
)
protected

Return value from attributes container - no style or defaults are used.

Definition at line 100 of file RAttrBase.cxx.

◆ AssignParent()

void ROOT::Experimental::RAttrBase::AssignParent ( RAttrBase parent,
const std::string &  prefix 
)
protected

Assign parent object for this RAttrBase.

Definition at line 112 of file RAttrBase.cxx.

◆ Clear()

void ROOT::Experimental::RAttrBase::Clear ( )
protected

Clear all respective values from drawable. Only defaults can be used.

Definition at line 190 of file RAttrBase.cxx.

◆ ClearValue()

void ROOT::Experimental::RAttrBase::ClearValue ( const std::string &  name)
protected

Clear value if any with specified name.

Definition at line 124 of file RAttrBase.cxx.

◆ CollectDefaults()

ROOT::Experimental::RAttrMap ROOT::Experimental::RAttrBase::CollectDefaults ( ) const
protectedvirtual

Collect all attributes in derived class Works only if such class has dictionary.

In special cases one has to provide implementation - see RAttrColor::CollectDefaults() example

Reimplemented in ROOT::Experimental::RAttrColor.

Definition at line 202 of file RAttrBase.cxx.

◆ CopyTo()

void ROOT::Experimental::RAttrBase::CopyTo ( RAttrBase tgt,
bool  use_style = true 
) const
protected

Copy attributes into target object.

Definition at line 66 of file RAttrBase.cxx.

◆ CopyValue()

bool ROOT::Experimental::RAttrBase::CopyValue ( const std::string &  name,
const RAttrMap::Value_t value,
bool  check_type = true 
)
protected

Copy attributes from other object.

Definition at line 36 of file RAttrBase.cxx.

◆ EnsureAttr()

Rec_t ROOT::Experimental::RAttrBase::EnsureAttr ( const std::string &  name)
inlineprotected

Ensure attribute with give name exists - creates container for attributes if required.

Definition at line 101 of file RAttrBase.hxx.

◆ Eval()

template<typename RET_TYPE , typename MATCH_TYPE = void>
auto ROOT::Experimental::RAttrBase::Eval ( const std::string &  name,
bool  use_dflts = true 
) const
inlineprotected

Evaluate attribute value.

Definition at line 121 of file RAttrBase.hxx.

◆ GetDefaults()

const ROOT::Experimental::RAttrMap & ROOT::Experimental::RAttrBase::GetDefaults ( ) const
protectedvirtual

◆ GetPrefix()

const std::string & ROOT::Experimental::RAttrBase::GetPrefix ( ) const
inlineprotected

Definition at line 160 of file RAttrBase.hxx.

◆ GetValue()

template<typename T >
T ROOT::Experimental::RAttrBase::GetValue ( const std::string &  name) const
inlineprotected

Definition at line 174 of file RAttrBase.hxx.

◆ HasValue()

template<typename T = void>
bool ROOT::Experimental::RAttrBase::HasValue ( const std::string &  name,
bool  check_defaults = false 
) const
inlineprotected

Definition at line 167 of file RAttrBase.hxx.

◆ IsSame()

bool ROOT::Experimental::RAttrBase::IsSame ( const RAttrBase src,
bool  use_style = true 
) const
protected

Check if all values which are evaluated in this object are exactly the same as in tgt object.

Definition at line 88 of file RAttrBase.cxx.

◆ IsValue()

◆ IsValueEqual()

bool ROOT::Experimental::RAttrBase::IsValueEqual ( const std::string &  name,
const RAttrMap::Value_t value,
bool  use_style = false 
) const
protected

Check if provided value equal to attribute in the map.

Definition at line 55 of file RAttrBase.cxx.

◆ MoveTo()

void ROOT::Experimental::RAttrBase::MoveTo ( RAttrBase tgt)
protected

Move all fields into target object.

Definition at line 77 of file RAttrBase.cxx.

◆ operator=()

RAttrBase & ROOT::Experimental::RAttrBase::operator= ( const RAttrBase src)
inlineprotected

Definition at line 146 of file RAttrBase.hxx.

◆ SetNoValue()

void ROOT::Experimental::RAttrBase::SetNoValue ( const std::string &  name)
protected

Set <NoValue> for attribute.

Ensure that value can not be configured via style - defaults will be used Equivalent to css syntax { attrname:; }

Definition at line 134 of file RAttrBase.cxx.

◆ SetValue() [1/5]

void ROOT::Experimental::RAttrBase::SetValue ( const std::string &  name,
bool  value 
)
protected

Set boolean value.

Definition at line 143 of file RAttrBase.cxx.

◆ SetValue() [2/5]

void ROOT::Experimental::RAttrBase::SetValue ( const std::string &  name,
const RPadLength value 
)
protected

Set PadLength value.

Definition at line 179 of file RAttrBase.cxx.

◆ SetValue() [3/5]

void ROOT::Experimental::RAttrBase::SetValue ( const std::string &  name,
const std::string &  value 
)
protected

Set string value.

Definition at line 170 of file RAttrBase.cxx.

◆ SetValue() [4/5]

void ROOT::Experimental::RAttrBase::SetValue ( const std::string &  name,
double  value 
)
protected

Set double value.

Definition at line 161 of file RAttrBase.cxx.

◆ SetValue() [5/5]

void ROOT::Experimental::RAttrBase::SetValue ( const std::string &  name,
int  value 
)
protected

Set integer value.

Definition at line 152 of file RAttrBase.cxx.

Friends And Related Symbol Documentation

◆ operator!=

bool operator!= ( const RAttrBase lhs,
const RAttrBase rhs 
)
friend

Definition at line 189 of file RAttrBase.hxx.

◆ operator==

bool operator== ( const RAttrBase lhs,
const RAttrBase rhs 
)
friend

Definition at line 188 of file RAttrBase.hxx.

◆ RAttrMap

friend class RAttrMap
friend

Definition at line 33 of file RAttrBase.hxx.

Member Data Documentation

◆ fDrawable

RDrawable* ROOT::Experimental::RAttrBase::fDrawable {nullptr}
private

! drawable used to store attributes

Definition at line 35 of file RAttrBase.hxx.

◆ fOwnAttr

std::unique_ptr<RAttrMap> ROOT::Experimental::RAttrBase::fOwnAttr
private

own instance when deep copy is created, persistent for RColor and similar classes

Definition at line 36 of file RAttrBase.hxx.

◆ fParent

RAttrBase* ROOT::Experimental::RAttrBase::fParent {nullptr}
private

! parent attributes, prefix applied to it

Definition at line 38 of file RAttrBase.hxx.

◆ fPrefix

std::string ROOT::Experimental::RAttrBase::fPrefix
private

! name prefix for all attributes values

Definition at line 37 of file RAttrBase.hxx.

Libraries for ROOT::Experimental::RAttrBase:

The documentation for this class was generated from the following files: