9#ifndef ROOT7_Browsable_RElement
10#define ROOT7_Browsable_RElement
71 virtual std::string
GetTitle()
const {
return ""; }
77 virtual std::string
GetContent(
const std::string & =
"text");
80 virtual std::unique_ptr<RHolder>
GetObject() {
return nullptr; }
83 virtual bool IsObject(
void *) {
return false; }
86 virtual bool IsFolder()
const {
return false; }
103 virtual bool cd() {
return false; }
105 virtual std::unique_ptr<RItem>
CreateItem()
const;
Basic element of browsable hierarchy.
virtual bool IsExpandByDefault() const
Should item representing element be expand by default.
virtual std::string GetName() const =0
Name of browsable, must be provided in derived classes.
static EContentKind GetContentKind(const std::string &kind)
Find item with specified name Default implementation, should work for all.
virtual bool IsFolder() const
Check if element can have childs.
virtual bool MatchName(const std::string &name) const
Checks if element name match to provided value.
virtual bool cd()
Select element as active.
virtual std::string GetContent(const std::string &="text")
Returns element content, depends from kind.
@ kFileName
"filename" - file name if applicable
@ kJpeg
"jpg" or "jpeg" - plain jpg binary code, returned inside std::string
@ kPng
"png" - plain png binary code, returned inside std::string
@ kJson
"json" representation of object, can be used in code editor
@ kText
"text" - plain text for code editor
@ kImage
"image64" - base64 for supported image formats (png/gif/gpeg)
virtual std::unique_ptr< RHolder > GetObject()
Access object.
virtual std::unique_ptr< RLevelIter > GetChildsIter()
Create iterator for childs elements if any.
virtual EActionKind GetDefaultAction() const
Get default action.
virtual int GetNumChilds()
Returns number of childs By default creates iterator and iterates over all items.
virtual ~RElement()=default
static int ExtractItemIndex(std::string &name)
Extract index from name Index coded by client with ###<indx>$$$ suffix Such coding used by browser to...
EActionKind
Possible actions on double-click.
@ kActImage
can be shown in image viewer, can provide image
@ kActDraw6
can be drawn inside ROOT6 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
@ kActBrowse
just browse (expand) item
@ kActEdit
can provide data for text editor
@ kActDraw7
can be drawn inside ROOT7 canvas
virtual bool IsObject(void *)
Check if element contains provided pointer.
virtual std::string GetTitle() const
Title of browsable (optional)
static int ComparePaths(const RElementPath_t &path1, const RElementPath_t &path2)
Compare two paths, Returns number of elements matches in both paths.
static std::string GetPathAsString(const RElementPath_t &path)
Converts element path back to string.
static std::shared_ptr< RElement > GetSubElement(std::shared_ptr< RElement > &elem, const RElementPath_t &path)
Returns sub element.
virtual std::unique_ptr< RItem > CreateItem() const
Returns item with element description.
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...
virtual bool IsCapable(EActionKind action) const
Check if want to perform action.
virtual bool CheckValid()
Check if element still contains valid content.
Representation of single item in the browser.
Iterator over single level hierarchy like any array, keys list, ...
std::vector< std::string > RElementPath_t
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.