Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::Experimental::Browsable::RElement Class Referenceabstract

Basic element of browsable hierarchy.

Provides access to data, creates iterator if any

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

Definition at line 33 of file RElement.hxx.

Public Types

enum  EActionKind {
  kActNone , kActBrowse , kActEdit , kActImage ,
  kActDraw6 , kActDraw7 , kActCanvas , kActGeom
}
 Possible actions on double-click. More...
 
enum  EContentKind {
  kNone , kText , kImage , kPng ,
  kJpeg , kJson , kFileName
}
 

Public Member Functions

virtual ~RElement ()=default
 
virtual bool cd ()
 Select element as active.
 
virtual std::unique_ptr< RLevelIterGetChildsIter ()
 Create iterator for childs elements if any.
 
virtual std::string GetContent (const std::string &="text")
 Returns element content, depends from kind.
 
virtual EActionKind GetDefaultAction () const
 Get default action.
 
virtual std::string GetName () const =0
 Name of browsable, must be provided in derived classes.
 
virtual int GetNumChilds ()
 Returns number of childs By default creates iterator and iterates over all items.
 
virtual std::unique_ptr< RHolderGetObject ()
 Access object.
 
virtual std::string GetTitle () const
 Title of browsable (optional)
 
virtual bool IsCapable (EActionKind action) const
 Check if want to perform action.
 
virtual bool IsExpandByDefault () const
 Should item representing element be expand by default.
 
virtual bool MatchName (const std::string &name) const
 Checks if element name match to provided value.
 

Static Public Member Functions

static int ComparePaths (const RElementPath_t &path1, const RElementPath_t &path2)
 Compare two paths, Returns number of elements matches in both paths.
 
static int ExtractItemIndex (std::string &name)
 Extract index from name Index coded by client with ###<indx>$$$ suffix Such coding used by browser to identify element by index.
 
static EContentKind GetContentKind (const std::string &kind)
 Find item with specified name Default implementation, should work for all.
 
static std::string GetPathAsString (const RElementPath_t &path)
 Converts element path back to string.
 
static std::shared_ptr< RElementGetSubElement (std::shared_ptr< RElement > &elem, const RElementPath_t &path)
 Returns sub element.
 
static RElementPath_t ParsePath (const std::string &str)
 Parse string path to produce RElementPath_t One should avoid to use string pathes as much as possible.
 

#include <ROOT/Browsable/RElement.hxx>

Inheritance diagram for ROOT::Experimental::Browsable::RElement:
[legend]

Member Enumeration Documentation

◆ EActionKind

Possible actions on double-click.

Enumerator
kActNone 

do nothing

kActBrowse 

just browse (expand) item

kActEdit 

can provide data for text editor

kActImage 

can be shown in image viewer, can provide image

kActDraw6 

can be drawn inside ROOT6 canvas

kActDraw7 

can be drawn inside ROOT7 canvas

kActCanvas 

indicate that it is canvas and should be drawn directly

kActGeom 

can be shown in geometry viewer

Definition at line 49 of file RElement.hxx.

◆ EContentKind

Enumerator
kNone 

not recognized

kText 

"text" - plain text for code editor

kImage 

"image64" - base64 for supported image formats (png/gif/gpeg)

kPng 

"png" - plain png binary code, returned inside std::string

kJpeg 

"jpg" or "jpeg" - plain jpg binary code, returned inside std::string

kJson 

"json" representation of object, can be used in code editor

kFileName 

"filename" - file name if applicable

Definition at line 36 of file RElement.hxx.

Constructor & Destructor Documentation

◆ ~RElement()

virtual ROOT::Experimental::Browsable::RElement::~RElement ( )
virtualdefault

Member Function Documentation

◆ cd()

virtual bool ROOT::Experimental::Browsable::RElement::cd ( )
inlinevirtual

Select element as active.

Reimplemented in TDirectoryElement.

Definition at line 92 of file RElement.hxx.

◆ ComparePaths()

int RElement::ComparePaths ( const RElementPath_t path1,
const RElementPath_t path2 
)
static

Compare two paths, Returns number of elements matches in both paths.

Definition at line 131 of file RElement.cxx.

◆ ExtractItemIndex()

int RElement::ExtractItemIndex ( std::string &  name)
static

Extract index from name Index coded by client with ###<indx>$$$ suffix Such coding used by browser to identify element by index.

Definition at line 164 of file RElement.cxx.

◆ GetChildsIter()

std::unique_ptr< RLevelIter > RElement::GetChildsIter ( )
virtual

◆ GetContent()

std::string RElement::GetContent ( const std::string &  kind = "text")
virtual

Returns element content, depends from kind.

Returns string content like text file content or json representation.

Can be "text" or "image64" or "json"

Reimplemented in ROOT::Experimental::Browsable::RSysFile, TDirectoryElement, and ROOT::Experimental::Browsable::RWrapper.

Definition at line 87 of file RElement.cxx.

◆ GetContentKind()

RElement::EContentKind RElement::GetContentKind ( const std::string &  kind)
static

Find item with specified name Default implementation, should work for all.

Definition at line 49 of file RElement.cxx.

◆ GetDefaultAction()

virtual EActionKind ROOT::Experimental::Browsable::RElement::GetDefaultAction ( ) const
inlinevirtual

◆ GetName()

virtual std::string ROOT::Experimental::Browsable::RElement::GetName ( ) const
pure virtual

◆ GetNumChilds()

int RElement::GetNumChilds ( )
virtual

Returns number of childs By default creates iterator and iterates over all items.

Reimplemented in TBrBrowsableElement, TFolderElement, and TCollectionElement.

Definition at line 36 of file RElement.cxx.

◆ GetObject()

virtual std::unique_ptr< RHolder > ROOT::Experimental::Browsable::RElement::GetObject ( )
inlinevirtual

◆ GetPathAsString()

std::string RElement::GetPathAsString ( const RElementPath_t path)
static

Converts element path back to string.

Definition at line 146 of file RElement.cxx.

◆ GetSubElement()

std::shared_ptr< RElement > RElement::GetSubElement ( std::shared_ptr< RElement > &  elem,
const RElementPath_t path 
)
static

Returns sub element.

Definition at line 66 of file RElement.cxx.

◆ GetTitle()

virtual std::string ROOT::Experimental::Browsable::RElement::GetTitle ( ) const
inlinevirtual

◆ IsCapable()

virtual bool ROOT::Experimental::Browsable::RElement::IsCapable ( EActionKind  action) const
inlinevirtual

Check if want to perform action.

Reimplemented in ROOT::Experimental::Browsable::RWrapper, TKeyElement, RFieldElement, and ROOT::Experimental::Browsable::TObjectElement.

Definition at line 86 of file RElement.hxx.

◆ IsExpandByDefault()

virtual bool ROOT::Experimental::Browsable::RElement::IsExpandByDefault ( ) const
inlinevirtual

Should item representing element be expand by default.

Reimplemented in ROOT::Experimental::Browsable::RWrapper.

Definition at line 89 of file RElement.hxx.

◆ MatchName()

virtual bool ROOT::Experimental::Browsable::RElement::MatchName ( const std::string &  name) const
inlinevirtual

Checks if element name match to provided value.

Reimplemented in ROOT::Experimental::Browsable::RSysFile.

Definition at line 66 of file RElement.hxx.

◆ ParsePath()

RElementPath_t RElement::ParsePath ( const std::string &  str)
static

Parse string path to produce RElementPath_t One should avoid to use string pathes as much as possible.

Definition at line 102 of file RElement.cxx.


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