Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::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 34 of file RElement.hxx.

Public Types

enum  EActionKind {
  kActNone , kActBrowse , kActEdit , kActImage ,
  kActDraw6 , kActDraw7 , kActCanvas , kActTree ,
  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 bool CheckValid ()
 Check if element still contains valid content.
 
virtual std::unique_ptr< RItemCreateItem () const
 Returns item with element description.
 
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 IsFolder () const
 Check if element can have childs.
 
virtual bool IsObject (void *)
 Check if element contains provided pointer.
 
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::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

kActTree 

can be shown in tree viewer

kActGeom 

can be shown in geometry viewer

Definition at line 50 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 37 of file RElement.hxx.

Constructor & Destructor Documentation

◆ ~RElement()

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

Member Function Documentation

◆ cd()

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

Select element as active.

Reimplemented in TDirectoryElement.

Definition at line 103 of file RElement.hxx.

◆ CheckValid()

virtual bool ROOT::Browsable::RElement::CheckValid ( )
inlinevirtual

Check if element still contains valid content.

Reimplemented in ROOT::Browsable::TObjectElement.

Definition at line 91 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 145 of file RElement.cxx.

◆ CreateItem()

std::unique_ptr< RItem > RElement::CreateItem ( ) const
virtual

Returns item with element description.

Reimplemented in ROOT::Browsable::TObjectElement, RNTupleElement, and TKeyElement.

Definition at line 105 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 178 of file RElement.cxx.

◆ GetChildsIter()

◆ 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::Browsable::RSysFile, TTreeBrowsingElement, TDirectoryElement, and ROOT::Browsable::RWrapper.

Definition at line 90 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 52 of file RElement.cxx.

◆ GetDefaultAction()

◆ GetName()

virtual std::string ROOT::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 39 of file RElement.cxx.

◆ GetObject()

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

Access object.

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

Definition at line 80 of file RElement.hxx.

◆ GetPathAsString()

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

Converts element path back to string.

Definition at line 160 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 69 of file RElement.cxx.

◆ GetTitle()

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

◆ IsCapable()

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

◆ IsExpandByDefault()

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

Should item representing element be expand by default.

Reimplemented in ROOT::Browsable::RWrapper.

Definition at line 100 of file RElement.hxx.

◆ IsFolder()

virtual bool ROOT::Browsable::RElement::IsFolder ( ) const
inlinevirtual

Check if element can have childs.

Reimplemented in ROOT::Browsable::TObjectElement, TDirectoryElement, TKeyElement, ROOT::Browsable::TGeoVolumeElement, and ROOT::Browsable::TGeoManagerElement.

Definition at line 86 of file RElement.hxx.

◆ IsObject()

virtual bool ROOT::Browsable::RElement::IsObject ( void *  )
inlinevirtual

Check if element contains provided pointer.

Reimplemented in ROOT::Browsable::TObjectElement.

Definition at line 83 of file RElement.hxx.

◆ MatchName()

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

Checks if element name match to provided value.

Reimplemented in ROOT::Browsable::RSysFile.

Definition at line 68 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 116 of file RElement.cxx.


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