Logo ROOT   6.18/05
Reference Guide
List of all members | Classes | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
ROOT::Experimental::RDrawingAttrBase Class Reference

A collection of graphics attributes, for instance everything describing a line: color, width, opacity and style.

It has a name, so it can be found in the style.

Definition at line 83 of file RDrawingAttr.hxx.

Classes

struct  FromOption_t
 Tag type to disambiguate construction from options. More...
 
struct  Name
 An attribute name part, e.g. "line". More...
 
struct  Path
 Combination of names, e.g. "hist2d.box.line.width". More...
 

Public Member Functions

 RDrawingAttrBase (const Name &name)
 Construct a named attribute that does not have a parent; e.g. More...
 
 RDrawingAttrBase (const Name &name, const RDrawingAttrBase &parent)
 Construct a named attribute that has a parent, e.g. More...
 
 RDrawingAttrBase (const Name &name, RDrawingOptsBase &opts)
 Construct a top-most attribute from its holder. More...
 
 RDrawingAttrBase (const RDrawingAttrBase &other)=default
 Construct as a copy. More...
 
 RDrawingAttrBase (FromOption_t, const Name &name, RDrawingOptsBase &opts)
 Construct a top-most attribute from its holder. More...
 
 RDrawingAttrBase (RDrawingAttrBase &&other)=default
 Construct as a moved-to. More...
 
template<class T >
Get (const Name &name) const
 Get the attribute value for an attribute value of type T. More...
 
const std::weak_ptr< RDrawingAttrHolder > & GetHolderPtr () const
 Actual attribute holder. More...
 
const PathGetPath () const
 Return the attribute names that lead to this attribute, starting with the topmost attribute, i.e. More...
 
bool IsFromStyle (const Name &name) const
 Return true if the attribute's value comes from the styles, i.e. More...
 
bool operator!= (const RDrawingAttrBase &other) const
 Compare unequal to other RDrawingAttrBase. Returns the negated operator==. More...
 
RDrawingAttrBaseoperator= (const RDrawingAttrBase &rhs)
 Copy-assign: this assigns the attribute values to this attribute, without changing the connected drawing options object / holder or attribute path! More...
 
bool operator== (const RDrawingAttrBase &other) const
 Equality compare to other RDrawingAttrBase. More...
 
template<class T >
void Set (const Name &name, const T &val)
 Insert or update the attribute value identified by name to the given value. More...
 

Static Public Attributes

static constexpr const FromOption_t FromOption {}
 

Protected Member Functions

 RDrawingAttrBase ()=default
 Construct a default, unnamed, unconnected attribute. More...
 
std::string GetValueString (const Path &path) const
 Get the attribute value as string, for a given attribute name. More...
 
bool IsFromStyle (const Path &path) const
 Return true if the attribute's value comes from the styles, i.e. More...
 
void SetValueString (const Name &name, const std::string &strVal)
 Insert or update the attribute value identified by the valueIndex (in fValueNames) to the value strVal. More...
 

Protected Attributes

std::weak_ptr< RDrawingAttrHolderfHolder
 The container of the attribute values. More...
 
Path fPath
 The chain of attribute names, as used in style files. More...
 

#include <ROOT/RDrawingAttr.hxx>

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

Constructor & Destructor Documentation

◆ RDrawingAttrBase() [1/7]

ROOT::Experimental::RDrawingAttrBase::RDrawingAttrBase ( )
protecteddefault

Construct a default, unnamed, unconnected attribute.

◆ RDrawingAttrBase() [2/7]

ROOT::Experimental::RDrawingAttrBase::RDrawingAttrBase ( const RDrawingAttrBase other)
default

Construct as a copy.

◆ RDrawingAttrBase() [3/7]

ROOT::Experimental::RDrawingAttrBase::RDrawingAttrBase ( RDrawingAttrBase &&  other)
default

Construct as a moved-to.

◆ RDrawingAttrBase() [4/7]

ROOT::Experimental::RDrawingAttrBase::RDrawingAttrBase ( const Name name)
inline

Construct a named attribute that does not have a parent; e.g.

because it's the top-most attribute in a drawing option object.

Definition at line 161 of file RDrawingAttr.hxx.

◆ RDrawingAttrBase() [5/7]

ROOT::Experimental::RDrawingAttrBase::RDrawingAttrBase ( const Name name,
const RDrawingAttrBase parent 
)

Construct a named attribute that has a parent, e.g.

because it's some line attribute of the histogram attributes.

Definition at line 24 of file RDrawingAttr.cxx.

◆ RDrawingAttrBase() [6/7]

ROOT::Experimental::RDrawingAttrBase::RDrawingAttrBase ( FromOption_t  ,
const Name name,
RDrawingOptsBase opts 
)

Construct a top-most attribute from its holder.

Definition at line 29 of file RDrawingAttr.cxx.

◆ RDrawingAttrBase() [7/7]

ROOT::Experimental::RDrawingAttrBase::RDrawingAttrBase ( const Name name,
RDrawingOptsBase opts 
)
inline

Construct a top-most attribute from its holder.

If this is ambiguous, use the tag overload taking an FromOption_t.

Definition at line 175 of file RDrawingAttr.hxx.

Member Function Documentation

◆ Get()

template<class T >
T ROOT::Experimental::RDrawingAttrBase::Get ( const Name name) const
inline

Get the attribute value for an attribute value of type T.

Definition at line 200 of file RDrawingAttr.hxx.

◆ GetHolderPtr()

const std::weak_ptr< RDrawingAttrHolder > & ROOT::Experimental::RDrawingAttrBase::GetHolderPtr ( ) const
inline

Actual attribute holder.

Definition at line 220 of file RDrawingAttr.hxx.

◆ GetPath()

const Path & ROOT::Experimental::RDrawingAttrBase::GetPath ( ) const
inline

Return the attribute names that lead to this attribute, starting with the topmost attribute, i.e.

the parent that does not have a parent itself, down to the name of *this (the last entry in the vector).

Definition at line 217 of file RDrawingAttr.hxx.

◆ GetValueString()

std::string ROOT::Experimental::RDrawingAttrBase::GetValueString ( const Path path) const
protected

Get the attribute value as string, for a given attribute name.

Definition at line 56 of file RDrawingAttr.cxx.

◆ IsFromStyle() [1/2]

bool ROOT::Experimental::RDrawingAttrBase::IsFromStyle ( const Name name) const

Return true if the attribute's value comes from the styles, i.e.

through RDrawingAttrHolder::GetAttrFromStyle(), instead if from our RDrawingAttrHolder (i.e. explicitly set through Set()).

Definition at line 76 of file RDrawingAttr.cxx.

◆ IsFromStyle() [2/2]

bool ROOT::Experimental::RDrawingAttrBase::IsFromStyle ( const Path path) const
protected

Return true if the attribute's value comes from the styles, i.e.

through RDrawingAttrHolder::GetAttrFromStyle(), instead if from our RDrawingAttrHolder (i.e. explicitly set through Set()).

Definition at line 67 of file RDrawingAttr.cxx.

◆ operator!=()

Compare unequal to other RDrawingAttrBase. Returns the negated operator==.

Definition at line 230 of file RDrawingAttr.hxx.

◆ operator=()

ROOT::Experimental::RDrawingAttrBase & ROOT::Experimental::RDrawingAttrBase::operator= ( const RDrawingAttrBase rhs)

Copy-assign: this assigns the attribute values to this attribute, without changing the connected drawing options object / holder or attribute path!

It gives value semantics to attributes:

DrawingOpts1 o1;
DrawingOpts2 o2;
RAttrLine l1 = o1.DogLine();
RAttrLine l2 = o2.CatLine();
l1.SetWidth(42);
l2 = l1;
// Now o2.CatLine().GetWidth() is 42!

Definition at line 34 of file RDrawingAttr.cxx.

◆ operator==()

bool ROOT::Experimental::RDrawingAttrBase::operator== ( const RDrawingAttrBase other) const

Equality compare to other RDrawingAttrBase.

They are equal if

  • the same set of attributes are custom set (versus are determined from the style), and
  • the values of all the custom set ones compare equal. The set of styles to be taken into account is not compared.

Definition at line 81 of file RDrawingAttr.cxx.

◆ Set()

template<class T >
void ROOT::Experimental::RDrawingAttrBase::Set ( const Name name,
const T &  val 
)
inline

Insert or update the attribute value identified by name to the given value.

Definition at line 209 of file RDrawingAttr.hxx.

◆ SetValueString()

void ROOT::Experimental::RDrawingAttrBase::SetValueString ( const Name name,
const std::string &  strVal 
)
protected

Insert or update the attribute value identified by the valueIndex (in fValueNames) to the value strVal.

Definition at line 50 of file RDrawingAttr.cxx.

Member Data Documentation

◆ fHolder

std::weak_ptr<RDrawingAttrHolder> ROOT::Experimental::RDrawingAttrBase::fHolder
protected

The container of the attribute values.

! I/O not working anyway

Definition at line 134 of file RDrawingAttr.hxx.

◆ fPath

Path ROOT::Experimental::RDrawingAttrBase::fPath
protected

The chain of attribute names, as used in style files.

E.g. "hist1D.hist.box.line".

Definition at line 131 of file RDrawingAttr.hxx.

◆ FromOption

constexpr const FromOption_t ROOT::Experimental::RDrawingAttrBase::FromOption {}
staticconstexpr

Definition at line 169 of file RDrawingAttr.hxx.

Libraries for ROOT::Experimental::RDrawingAttrBase:
[legend]

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