18using namespace std::string_literals;
43 while (iter->Next()) cnt++;
53 std::string lkind = kind;
54 std::transform(lkind.begin(), lkind.end(), lkind.begin(), ::tolower);
56 if (lkind ==
"text")
return kText;
57 if ((lkind ==
"image") || (lkind ==
"image64"))
return kImage;
58 if (lkind ==
"png")
return kPng;
59 if ((lkind ==
"jpg") || (lkind ==
"jpeg"))
return kJpeg;
60 if (lkind ==
"json")
return kJson;
61 if (lkind ==
"filename")
return kFileName;
72 for (
auto &itemname : path) {
76 auto iter = curr->GetChildsIter();
77 if (!iter || !iter->Find(itemname))
80 curr = iter->GetElement();
106 auto item = std::make_unique<RItem>(
GetName());
121 std::string
slash =
"/";
123 std::string::size_type previous = 0;
124 if (strpath[0] ==
slash[0]) previous++;
126 auto current = strpath.find(
slash, previous);
127 while (current != std::string::npos) {
128 if (current > previous)
129 arr.emplace_back(strpath.substr(previous, current - previous));
130 previous = current + 1;
131 current = strpath.find(
slash, previous);
134 if (previous < strpath.length())
135 arr.emplace_back(strpath.substr(previous));
146 int sz = path1.size();
147 if (sz > (
int) path2.size()) sz = path2.size();
149 for (
int n = 0;
n < sz; ++
n)
150 if (path1[
n] != path2[
n])
162 for (
auto &elem : path) {
164 std::string subname = elem;
179 auto p1 =
name.rfind(
"###"), p2 =
name.rfind(
"$$$");
180 if ((p1 == std::string::npos) || (p2 == std::string::npos) || (p1 >= p2) || (p2 !=
name.length()-3))
return -1;
182 int indx = std::stoi(
name.substr(p1+3,p2-p1-3));
@ 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 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.
static std::shared_ptr< RElement > GetSubElement(std::shared_ptr< RElement > &elem, const RElementPath_t &path)
Returns sub element.
virtual std::unique_ptr< RHolder > GetObject()
Access object.
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 std::string GetTitle() const
Title of browsable (optional)
A log configuration for a channel, e.g.
static TString ConvertToJSON(const TObject *obj, Int_t compact=0, const char *member_name=nullptr)
Converts object, inherited from TObject class, to JSON string Lower digit of compact parameter define...
const char * Data() const
std::vector< std::string > RElementPath_t
RLogChannel & BrowsableLog()
Log channel for Browsable diagnostics.