Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RLevelIter.cxx
Go to the documentation of this file.
1/*************************************************************************
2 * Copyright (C) 1995-2020, Rene Brun and Fons Rademakers. *
3 * All rights reserved. *
4 * *
5 * For the licensing terms see $ROOTSYS/LICENSE. *
6 * For the list of contributors see $ROOTSYS/README/CREDITS. *
7 *************************************************************************/
8
10
13
14using namespace ROOT::Experimental::Browsable;
15
16/////////////////////////////////////////////////////////////////////
17/// Find item with specified name
18/// Default implementation, should work for all
19/// If index specified, not only name but also index should match
20
21bool RLevelIter::Find(const std::string &name, int indx)
22{
23 int i = -1;
24
25 while (Next()) {
26 if (indx >= 0) {
27 i++;
28 if (i > indx) return false;
29 if (i < indx) continue;
30 }
31
32 if (GetItemName() == name)
33 return true;
34 }
35
36 return false;
37}
38
39/////////////////////////////////////////////////////////////////////
40/// Create generic description item for RBrowser
41
42std::unique_ptr<RItem> RLevelIter::CreateItem()
43{
44 auto have_childs = CanItemHaveChilds();
45
46 return std::make_unique<RItem>(GetItemName(), have_childs ? -1 : 0, have_childs ? "sap-icon://folder-blank" : "sap-icon://document");
47}
48
char name[80]
Definition TGX11.cxx:110
virtual bool Next()=0
Shift to next entry.
virtual std::unique_ptr< RItem > CreateItem()
Create generic description item for RBrowser.
virtual bool Find(const std::string &name, int indx=-1)
Find item with specified name Default implementation, should work for all If index specified,...
virtual std::string GetItemName() const =0
Returns current entry name
virtual bool CanItemHaveChilds() const
Returns true if current item can have childs.