Logo ROOT   6.18/05
Reference Guide
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
ROOT::Experimental::RStyle Class Reference

A set of defaults for graphics attributes, e.g.

for histogram fill color, line width, frame offsets etc.

Definition at line 34 of file RStyle.hxx.

Public Types

using Attrs_t = std::unordered_map< std::string, std::string >
 A map of attribute name to string attribute values/. More...
 

Public Member Functions

 RStyle ()=default
 Default constructor, creating an unnamed, empty style. More...
 
 RStyle (std::string_view name)
 Creates a named but empty style. More...
 
 RStyle (std::string_view name, Attrs_t &&attrs)
 Constructor taking the style name and a set of attributes (e.g. read from the config files). More...
 
std::string GetAttribute (const std::string &attrName, const std::string &className={}) const
 Get the style value as a string, given an attribute name. More...
 
const std::string & GetName () const
 Get this stryle's name. (No setter as that would upset the unordered_map.) More...
 

Static Public Member Functions

static RStyleGet (std::string_view name)
 Get the RStyle named name from the global style collection, or nullptr if that doesn't exist. More...
 
static RStyleGetCurrent ()
 Get the current RStyle. More...
 
static RStyleRegister (RStyle &&style)
 Move-register style in the global style collection, possibly replacing a global style with the same name. More...
 
static void SetCurrent (const RStyle &style)
 Set the current RStyle by copying style into the static current style object. More...
 

Private Attributes

Attrs_t fAttrs
 
std::string fName
 Mapping of user coordinates to normal coordinates. More...
 

#include <ROOT/RStyle.hxx>

Member Typedef Documentation

◆ Attrs_t

using ROOT::Experimental::RStyle::Attrs_t = std::unordered_map<std::string, std::string>

A map of attribute name to string attribute values/.

Definition at line 37 of file RStyle.hxx.

Constructor & Destructor Documentation

◆ RStyle() [1/3]

ROOT::Experimental::RStyle::RStyle ( )
default

Default constructor, creating an unnamed, empty style.

◆ RStyle() [2/3]

ROOT::Experimental::RStyle::RStyle ( std::string_view  name)
inlineexplicit

Creates a named but empty style.

Definition at line 49 of file RStyle.hxx.

◆ RStyle() [3/3]

ROOT::Experimental::RStyle::RStyle ( std::string_view  name,
Attrs_t &&  attrs 
)
inline

Constructor taking the style name and a set of attributes (e.g. read from the config files).

Definition at line 52 of file RStyle.hxx.

Member Function Documentation

◆ Get()

RStyle * RStyle::Get ( std::string_view  name)
static

Get the RStyle named name from the global style collection, or nullptr if that doesn't exist.

Definition at line 56 of file RStyle.cxx.

◆ GetAttribute()

std::string RStyle::GetAttribute ( const std::string &  attrName,
const std::string &  className = {} 
) const

Get the style value as a string, given an attribute name.

Strips leading "foo." from the name until the first entry in the style is found. E.g. if the default style has not entry for "Hist.1D.Fill.Color", the value might be initialized to the default style's entry for the more general "1D.Fill.Color". The className is the name of a CSS-style class, possibly overriding the generic attribute.

Definition at line 87 of file RStyle.cxx.

◆ GetCurrent()

RStyle & RStyle::GetCurrent ( )
static

Get the current RStyle.

Definition at line 81 of file RStyle.cxx.

◆ GetName()

const std::string & ROOT::Experimental::RStyle::GetName ( ) const
inline

Get this stryle's name. (No setter as that would upset the unordered_map.)

Definition at line 55 of file RStyle.hxx.

◆ Register()

RStyle & RStyle::Register ( RStyle &&  style)
static

Move-register style in the global style collection, possibly replacing a global style with the same name.

Definition at line 49 of file RStyle.cxx.

◆ SetCurrent()

static void ROOT::Experimental::RStyle::SetCurrent ( const RStyle style)
inlinestatic

Set the current RStyle by copying style into the static current style object.

Definition at line 74 of file RStyle.hxx.

Member Data Documentation

◆ fAttrs

Attrs_t ROOT::Experimental::RStyle::fAttrs
private

Definition at line 42 of file RStyle.hxx.

◆ fName

std::string ROOT::Experimental::RStyle::fName
private

Mapping of user coordinates to normal coordinates.

Definition at line 41 of file RStyle.hxx.

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

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