9#ifndef ROOT7_Browsable_RElement
10#define ROOT7_Browsable_RElement
18namespace Experimental {
72 virtual std::string
GetTitle()
const {
return ""; }
78 virtual std::string
GetContent(
const std::string & =
"text");
81 virtual std::unique_ptr<RHolder>
GetObject() {
return nullptr; }
84 virtual bool IsObject(
void *) {
return false; }
87 virtual bool IsFolder()
const {
return false; }
104 virtual bool cd() {
return false; }
106 virtual std::unique_ptr<RItem>
CreateItem()
const;
Basic element of browsable hierarchy.
virtual ~RElement()=default
virtual bool MatchName(const std::string &name) const
Checks if element name match to provided value.
@ kFileName
"filename" - file name if applicable
@ kJson
"json" representation of object, can be used in code editor
@ kImage
"image64" - base64 for supported image formats (png/gif/gpeg)
@ kJpeg
"jpg" or "jpeg" - plain jpg binary code, returned inside std::string
@ kPng
"png" - plain png binary code, returned inside std::string
@ kText
"text" - plain text for code editor
static EContentKind GetContentKind(const std::string &kind)
Find item with specified name Default implementation, should work for all.
virtual std::string GetName() const =0
Name of browsable, must be provided in derived classes.
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 std::string GetContent(const std::string &="text")
Returns element content, depends from kind.
virtual std::unique_ptr< RLevelIter > GetChildsIter()
Create iterator for childs elements if any.
virtual int GetNumChilds()
Returns number of childs By default creates iterator and iterates over all items.
virtual bool CheckValid()
Check if element still contains valid content.
static int ExtractItemIndex(std::string &name)
Extract index from name Index coded by client with ###<indx>$$$ suffix Such coding used by browser to...
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.
virtual bool cd()
Select element as active.
static std::shared_ptr< RElement > GetSubElement(std::shared_ptr< RElement > &elem, const RElementPath_t &path)
Returns sub element.
EActionKind
Possible actions on double-click.
@ kActEdit
can provide data for text editor
@ kActCanvas
indicate that it is canvas and should be drawn directly
@ kActBrowse
just browse (expand) item
@ kActGeom
can be shown in geometry viewer
@ kActDraw7
can be drawn inside ROOT7 canvas
@ kActTree
can be shown in tree viewer
@ kActImage
can be shown in image viewer, can provide image
@ kActDraw6
can be drawn inside ROOT6 canvas
virtual std::unique_ptr< RHolder > GetObject()
Access object.
virtual bool IsFolder() const
Check if element can have childs.
virtual EActionKind GetDefaultAction() const
Get default action.
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 IsObject(void *)
Check if element contains provided pointer.
virtual std::string GetTitle() const
Title of browsable (optional)
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.