9#ifndef ROOT7_Browsable_RElement
10#define ROOT7_Browsable_RElement
18namespace Experimental {
69 virtual std::string
GetTitle()
const {
return ""; }
77 virtual std::string
GetContent(
const std::string & =
"text");
80 virtual std::unique_ptr<RHolder>
GetObject() {
return nullptr; }
92 virtual bool cd() {
return false; }
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.
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
@ 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 EActionKind GetDefaultAction() const
Get default action.
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 std::string GetTitle() const
Title of browsable (optional)
Iterator over single level hierarchy like any array, keys list, ...
std::vector< std::string > RElementPath_t
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...