Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TObjectElement.cxx
Go to the documentation of this file.
1/*************************************************************************
2 * Copyright (C) 1995-2021, 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
14
15#include <ROOT/RLogger.hxx>
16
17#include "TBrowser.h"
18#include "TBrowserImp.h"
19#include "TFolder.h"
20#include "TList.h"
21#include "TColor.h"
22#include "TDirectory.h"
23#include "TFile.h"
24#include "TBufferJSON.h"
25
26#include <sstream>
27
28using namespace std::string_literals;
29
30using namespace ROOT::Browsable;
31
32
33/** \class TObjectLevelIter
34\ingroup rbrowser
35
36Iterator over list of elements, designed for support TBrowser usage
37*/
38
40
41 std::vector<std::shared_ptr<RElement>> fElements;
42
43 int fCounter{-1};
44
45public:
46 explicit TObjectLevelIter() {}
47
48 virtual ~TObjectLevelIter() = default;
49
50 void AddElement(std::shared_ptr<RElement> &&elem)
51 {
52 fElements.emplace_back(std::move(elem));
53 }
54
55 auto NumElements() const { return fElements.size(); }
56
57 bool Next() override { return ++fCounter < (int) fElements.size(); }
58
59 // use default implementation for now
60 // bool Find(const std::string &name) override { return FindDirEntry(name); }
61
62 std::string GetItemName() const override { return fElements[fCounter]->GetName(); }
63
64 bool CanItemHaveChilds() const override
65 {
66 std::shared_ptr<TObjectElement> telem = std::dynamic_pointer_cast<TObjectElement>(fElements[fCounter]);
67 return telem ? telem->IsFolder() : false;
68 }
69
70 /** Create element for the browser */
71 std::unique_ptr<RItem> CreateItem() override
72 {
73 return fElements[fCounter] ? fElements[fCounter]->CreateItem() : nullptr;
74 }
75
76 /** Returns full information for current element */
77 std::shared_ptr<RElement> GetElement() override
78 {
79 return fElements[fCounter];
80 }
81
82 bool Find(const std::string &name, int indx = -1) override
83 {
84 if ((indx >= 0) && (indx < (int) fElements.size()) && (name == fElements[indx]->GetName())) {
85 fCounter = indx;
86 return true;
87 }
88
89 return RLevelIter::Find(name, -1);
90 }
91
92};
93
94// ===============================================================================================================
95
96class TMyBrowserImp : public TBrowserImp {
97 TObjectLevelIter *fIter{nullptr}; ///<! back-reference on iterator
98 const TObject *fBrowseObj{nullptr}; ///<! object which will be browsed
99 bool fDuplicated{false}; ///<! is object was duplicated?
100 bool fIgnore{false}; ///<! ignore browsing, used during TBrowser constructor
101
102public:
103
104 TMyBrowserImp(TObjectLevelIter *iter, TObject *obj) : TBrowserImp(nullptr), fIter(iter), fBrowseObj(obj) {}
105 virtual ~TMyBrowserImp() = default;
106
107 void SetIgnore(bool on = true) { fIgnore = on; }
108
109 bool IsDuplicated() const { return fDuplicated; }
110
111 void Add(TObject* obj, const char* name, Int_t) override
112 {
113 if (fIgnore) return;
114
115 // prevent duplication of object itself - ignore such browsing
116 if (fBrowseObj == obj) fDuplicated = true;
117 if (fDuplicated) return;
118
119 std::unique_ptr<RHolder> holder = std::make_unique<TObjectHolder>(obj);
120
121 std::shared_ptr<RElement> elem = RProvider::Browse(holder);
122
123 if (name && *name) {
124 std::shared_ptr<TObjectElement> telem = std::dynamic_pointer_cast<TObjectElement>(elem);
125 if (telem) telem->SetName(name);
126 }
127
128 fIter->AddElement(std::move(elem));
129 }
130
131 void BrowseObj(TObject* obj) override
132 {
133 if (fIgnore) return;
134
135 Add(obj, nullptr, 0);
136 }
137
138};
139
140// ===============================================================================================================
141
142/** \class TCollectionIter
143\ingroup rbrowser
144
145Iterator over elements in TCollection
146*/
147
149
151
152public:
153 explicit TCollectionIter(const TFolder *f) : RLevelIter(), fIter(f->GetListOfFolders()) {}
154
155 explicit TCollectionIter(const TCollection *coll) : RLevelIter(), fIter(coll) {}
156
157 virtual ~TCollectionIter() = default;
158
159 bool Next() override { return fIter.Next() != nullptr; }
160
161 std::string GetItemName() const override
162 {
163 auto obj = *fIter;
164 if (!obj) return ""s;
165 std::string name = obj->GetName();
166
167 if (name.empty()) {
168 std::unique_ptr<RHolder> holder = std::make_unique<TObjectHolder>(obj, kFALSE);
169 auto elem = RProvider::Browse(holder);
170 if (elem) name = elem->CreateItem()->GetName();
171 }
172 return name;
173 }
174
175 /** Check if item can be expanded */
176 bool CanItemHaveChilds() const override
177 {
178 auto obj = *fIter;
179 if (!obj || !obj->IsFolder())
180 return false;
181 return !RProvider::NotShowChilds(obj->IsA());
182 }
183
184 /** Create item for current TObject */
185 std::unique_ptr<RItem> CreateItem() override
186 {
187 auto obj = *fIter;
188 if (!obj) return RLevelIter::CreateItem();
189
190 std::unique_ptr<RHolder> holder = std::make_unique<TObjectHolder>(obj, kFALSE);
191
192 auto elem = RProvider::Browse(holder);
193
194 if (!elem)
195 elem = std::make_shared<TObjectElement>(holder);
196
197 return elem->CreateItem();
198 }
199
200 /** Returns full information for current element */
201 std::shared_ptr<RElement> GetElement() override
202 {
203 std::unique_ptr<RHolder> holder = std::make_unique<TObjectHolder>(*fIter, kFALSE);
204
205 return RProvider::Browse(holder);
206 }
207
208};
209
210
211// ==============================================================================================
212
213/** \class TFolderElement
214\ingroup rbrowser
215
216Browsable element for TFolder
217*/
218
219
221
222public:
223
224 TFolderElement(std::unique_ptr<RHolder> &obj) : TObjectElement(obj) { }
225
226 std::unique_ptr<RLevelIter> GetChildsIter() override
227 {
228 auto folder = fObject->Get<TFolder>();
229 if (folder)
230 return std::make_unique<TCollectionIter>(folder->GetListOfFolders());
231
233 }
234
235 int GetNumChilds() override
236 {
237 auto folder = fObject->Get<TFolder>();
238 return folder && folder->GetListOfFolders() ? folder->GetListOfFolders()->GetEntries() : 0;
239 }
240};
241
242// ==============================================================================================
243
244/** \class TCollectionElement
245\ingroup rbrowser
246
247Browsable element for TCollection
248*/
249
250
252public:
253
254 TCollectionElement(std::unique_ptr<RHolder> &obj) : TObjectElement(obj) {}
255
256 std::unique_ptr<RLevelIter> GetChildsIter() override
257 {
258 auto coll = fObject->Get<TCollection>();
259 if (coll && (coll->GetSize() > 0))
260 return std::make_unique<TCollectionIter>(coll);
261
263 }
264
265 int GetNumChilds() override
266 {
267 auto coll = fObject->Get<TCollection>();
268 return coll ? coll->GetSize() : 0;
269 }
270};
271
272// =================================================================================
273
274////////////////////////////////////////////////////////////////////////////////
275/// Constructor with plain TObject* as argument - ownership is not defined
276
277TObjectElement::TObjectElement(TObject *obj, const std::string &name, bool _hide_childs)
278{
279 SetObject(obj);
280 fName = name;
281 if (fName.empty())
282 fName = fObj->GetName();
283 SetHideChilds(_hide_childs);
284}
285
286////////////////////////////////////////////////////////////////////////////////
287/// Constructor with std::unique_ptr<RHolder> as argument
288
289TObjectElement::TObjectElement(std::unique_ptr<RHolder> &obj, const std::string &name, bool _hide_childs)
290{
291 fObject = std::move(obj); // take responsibility
292 fObj = const_cast<TObject *>(fObject->Get<TObject>()); // try to cast into TObject
293
294 fName = name;
295 if (!fObj)
296 fObject.reset();
297 else if (fName.empty())
298 fName = fObj->GetName();
299
300 SetHideChilds(_hide_childs);
301}
302
303////////////////////////////////////////////////////////////////////////////////
304/// Constructor with std::unique_ptr<RHolder> as argument
305
307{
308 fObject = std::make_unique<TObjectHolder>(obj);
309 fObj = obj;
310}
311
312////////////////////////////////////////////////////////////////////////////////
313/// Forget object, use when it was deleted behind the scene
314
316{
317 auto elem = const_cast<TObjectElement *>(this);
318 elem->fObj = nullptr;
319 if (elem->fObject) {
320 elem->fObject->Forget();
321 elem->fObject.reset();
322 }
323}
324
325////////////////////////////////////////////////////////////////////////////////
326/// Check if object still exists
327
329{
330 if (!fObj)
331 return nullptr;
332 if (fObj->IsZombie()) {
333 ForgetObject();
334 return nullptr;
335 }
336 return fObj;
337}
338
339////////////////////////////////////////////////////////////////////////////////
340/// Returns true if object can have child elements
341
343{
344 if (IsHideChilds())
345 return false;
346
347 return CheckObject() ? fObj->IsFolder() : false;
348}
349
350////////////////////////////////////////////////////////////////////////////////
351/// Returns name of the TObject
352
353std::string TObjectElement::GetName() const
354{
355 if (!fName.empty())
356 return fName;
357
358 return CheckObject() ? fObj->GetName() : "";
359}
360
361////////////////////////////////////////////////////////////////////////////////
362/// Returns title of the TObject
363
364std::string TObjectElement::GetTitle() const
365{
366 return CheckObject() ? fObj->GetTitle() : "";
367}
368
369////////////////////////////////////////////////////////////////////////////////
370/// Create iterator for childs elements if any
371
372std::unique_ptr<RLevelIter> TObjectElement::GetChildsIter()
373{
374 if (!IsFolder())
375 return nullptr;
376
377 auto iter = std::make_unique<TObjectLevelIter>();
378
379 TMyBrowserImp *imp = new TMyBrowserImp(iter.get(), fObj);
380
381 // ignore browsing during TBrowser constructor, avoid gROOT adding
382 imp->SetIgnore(true);
383
384 // must be new, otherwise TBrowser constructor ignores imp
385 TBrowser *br = new TBrowser("name", "title", imp);
386
387 imp->SetIgnore(false);
388
389 fObj->Browse(br);
390
391 auto dupl = imp->IsDuplicated();
392
393 delete br; // also will destroy implementation
394
395 if (dupl || (iter->NumElements() == 0)) return nullptr;
396
397 return iter;
398}
399
400////////////////////////////////////////////////////////////////////////////////
401/// Returns copy of TObject holder - if possible
402
403std::unique_ptr<RHolder> TObjectElement::GetObject()
404{
405 if (!fObject)
406 return nullptr;
407
408 return fObject->Copy();
409}
410
411////////////////////////////////////////////////////////////////////////////////
412/// Returns true if holding specified object
413
415{
416 return (fObj && (fObj == obj));
417
418 // return fObject && (fObject->get_object<TObject>() == obj);
419}
420
421////////////////////////////////////////////////////////////////////////////////
422/// Returns true if object is still valid
423
425{
426 return CheckObject() != nullptr;
427}
428
429////////////////////////////////////////////////////////////////////////////////
430/// Returns class for contained object
431
433{
434 return CheckObject() ? fObj->IsA() : nullptr;
435}
436
437////////////////////////////////////////////////////////////////////////////////
438/// Provides default action which can be performed with the object
439
441{
442 auto cl = GetClass();
443 if (!cl) return kActNone;
444 std::string clname = cl->GetName();
445 if ("TCanvas"s == clname) return kActCanvas;
446 if (("TTree"s == clname) || ("TNtuple"s == clname)) return kActTree;
447 if (("TGeoManager"s == clname) || (clname.compare(0, 10, "TGeoVolume"s) == 0) || (clname.compare(0, 8, "TGeoNode"s) == 0)) return kActGeom;
448 if (RProvider::CanDraw6(cl)) return kActDraw6;
449 if (RProvider::CanDraw7(cl)) return kActDraw7;
450 if (RProvider::CanHaveChilds(cl)) return kActBrowse;
451 return kActNone;
452}
453
454////////////////////////////////////////////////////////////////////////////////
455/// Create item
456
457std::unique_ptr<RItem> TObjectElement::CreateItem() const
458{
459 auto obj = CheckObject();
460 if (!obj)
461 return RElement::CreateItem();
462
463 auto isfolder = !IsHideChilds() && IsFolder();
464
465 auto item = std::make_unique<TObjectItem>(obj->GetName(), isfolder ? -1 : 0);
466
467 if (item->GetName().empty())
468 item->SetName(GetName());
469
470 item->SetTitle(obj->GetTitle());
471 if (item->GetTitle().empty())
472 item->SetTitle(GetTitle());
473
474 item->SetClassName(obj->ClassName());
475 item->SetIcon(RProvider::GetClassIcon(obj->IsA(), isfolder));
476
477 auto sz = GetSize();
478 if (sz > 0)
479 item->SetSize(sz);
480
481 auto tm = GetMTime();
482 if (!tm.empty())
483 item->SetMTime(tm);
484
485 return item;
486}
487
488////////////////////////////////////////////////////////////////////////////////
489/// Check object capability
490
492{
493 auto cl = GetClass();
494 if (!cl) return false;
495
496 std::string clname = cl->GetName();
497
498 switch(action) {
499 case kActBrowse: return RProvider::CanHaveChilds(cl);
500 case kActEdit: return true;
501 case kActImage:
502 case kActDraw6: return RProvider::CanDraw6(cl); // if can draw in TCanvas, can produce image
503 case kActDraw7: return RProvider::CanDraw7(cl);
504 case kActCanvas: return "TCanvas"s == clname;
505 case kActTree: return ("TTree"s == clname) || ("TNtuple"s == clname) ||
506 (clname.compare(0, 7, "TBranch"s) == 0) || (clname.compare(0, 5, "TLeaf"s) == 0);
507 case kActGeom: return ("TGeoManager"s == clname) || (clname.compare(0, 10, "TGeoVolume"s) == 0) || (clname.compare(0, 8, "TGeoNode"s) == 0);
508 default: return false;
509 }
510
511 return false;
512}
513
514////////////////////////////////////////////////////////////////////////////////
515/// Creates iterator for TCollection object
516
517std::unique_ptr<RLevelIter> TObjectElement::GetCollectionIter(const TCollection *coll)
518{
519 return std::make_unique<TCollectionIter>(coll);
520}
521
522////////////////////////////////////////////////////////////////////////////////
523/// Element representing TColor
524
526
527public:
528 TColorElement(std::unique_ptr<RHolder> &obj) : TObjectElement(obj)
529 {
530 if (fName.empty()) {
531 auto col = fObject->Get<TColor>();
532 if (col)
533 fName = "Color"s + std::to_string(col->GetNumber());
534 }
535 }
536
537 EActionKind GetDefaultAction() const override { return kActEdit; }
538
539};
540
541// ==============================================================================================
542
543/** \class RTObjectProvider
544\ingroup rbrowser
545
546Provider for all known TObject-based classes
547*/
548
550
551public:
552 //////////////////////////////////////////////////////////////////////////////////
553 // Register TObject-based class with standard browsing/drawing libs
554
555 void RegisterTObject(const std::string &clname, const std::string &iconname, bool can_browse = false, int can_draw = 3, const std::string &drawopt = ""s)
556 {
557 RegisterClass(clname,
558 iconname,
559 can_browse ? "dflt"s : ""s,
560 can_draw & 1 ? "libROOTObjectDraw6Provider"s : ""s,
561 can_draw & 2 ? "libROOTObjectDraw7Provider"s : ""s,
562 drawopt);
563 }
564
566 {
567 RegisterClass("TTree", "sap-icon://tree", "libROOTBranchBrowseProvider");
568 RegisterClass("TNtuple", "sap-icon://tree", "libROOTBranchBrowseProvider");
569 RegisterClass("TBranchElement", "sap-icon://e-care", "libROOTBranchBrowseProvider", "libROOTLeafDraw6Provider", "libROOTLeafDraw7Provider");
570 RegisterClass("TLeaf", "sap-icon://e-care", ""s, "libROOTLeafDraw6Provider", "libROOTLeafDraw7Provider");
571 RegisterClass("TBranch", "sap-icon://e-care", "libROOTBranchBrowseProvider"s, "libROOTLeafDraw6Provider", "libROOTLeafDraw7Provider");
572 RegisterClass("TVirtualBranchBrowsable", "sap-icon://e-care", ""s, "libROOTLeafDraw6Provider", "libROOTLeafDraw7Provider");
573 RegisterClass("TColor", "sap-icon://palette");
574 RegisterClass("TStyle", "sap-icon://badge");
575
576 RegisterTObject("TDirectory", "sap-icon://folder-blank", true, 0);
577 RegisterTObject("TClass", "sap-icon://tag-cloud-chart", false, 0);
578 RegisterTObject("TQClass", "sap-icon://tag-cloud-chart", false, 0);
579 RegisterTObject("TH1", "sap-icon://bar-chart", false, 3, ""s);
580 RegisterTObject("TH2", "sap-icon://pixelate", false, 3, "col"s);
581 RegisterTObject("TH3", "sap-icon://product");
582 RegisterTObject("TProfile", "sap-icon://vertical-bar-chart", false, 3, ""s);
583 RegisterTObject("TGraph", "sap-icon://line-chart");
584 RegisterTObject("TCanvas", "sap-icon://business-objects-experience", false, 1); // only can use TWebCanvas
585 RegisterTObject("TASImage", "sap-icon://picture", false, 1); // only can use TWebCanvas
586
587 RegisterTObject("THStack", "sap-icon://multiple-bar-chart");
588 RegisterTObject("TMultiGraph", "sap-icon://multiple-line-chart");
589
590 RegisterTObject("TCollection", "sap-icon://list", true, 0);
591
592 RegisterClass("TGeoManager", "sap-icon://overview-chart", "libROOTGeoBrowseProvider");
593 RegisterClass("TGeoVolume", "sap-icon://product", "libROOTGeoBrowseProvider");
594 RegisterClass("TGeoNode", "sap-icon://product", "libROOTGeoBrowseProvider");
595
596 RegisterBrowse(TFolder::Class(), [](std::unique_ptr<RHolder> &object) -> std::shared_ptr<RElement> {
597 return std::make_shared<TFolderElement>(object);
598 });
599
600 RegisterBrowse(TCollection::Class(), [](std::unique_ptr<RHolder> &object) -> std::shared_ptr<RElement> {
601 return std::make_shared<TCollectionElement>(object);
602 });
603
604 RegisterBrowse(TColor::Class(), [](std::unique_ptr<RHolder> &object) -> std::shared_ptr<RElement> {
605 return std::make_shared<TColorElement>(object);
606 });
607
608 RegisterBrowse(nullptr, [](std::unique_ptr<RHolder> &object) -> std::shared_ptr<RElement> {
609 if (object->CanCastTo<TObject>())
610 return std::make_shared<TObjectElement>(object, "", NotShowChilds(object->GetClass()));
611 return nullptr;
612 });
613
614 }
615
#define f(i)
Definition RSha256.hxx:104
constexpr Bool_t kFALSE
Definition RtypesCore.h:94
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
char name[80]
Definition TGX11.cxx:110
RTObjectProvider newRTObjectProvider
EActionKind
Possible actions on double-click.
Definition RElement.hxx:50
@ kActImage
can be shown in image viewer, can provide image
Definition RElement.hxx:54
@ kActDraw6
can be drawn inside ROOT6 canvas
Definition RElement.hxx:55
@ kActCanvas
indicate that it is canvas and should be drawn directly
Definition RElement.hxx:57
@ kActTree
can be shown in tree viewer
Definition RElement.hxx:58
@ kActGeom
can be shown in geometry viewer
Definition RElement.hxx:59
@ kActBrowse
just browse (expand) item
Definition RElement.hxx:52
@ kActEdit
can provide data for text editor
Definition RElement.hxx:53
@ kActDraw7
can be drawn inside ROOT7 canvas
Definition RElement.hxx:56
virtual std::unique_ptr< RItem > CreateItem() const
Returns item with element description.
Definition RElement.cxx:105
Iterator over single level hierarchy like any array, keys list, ...
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,...
Provider of different browsing methods for supported classes.
Definition RProvider.hxx:37
static bool CanDraw6(const ClassArg &)
Return true if provided class can be drawn on the TCanvas.
static std::shared_ptr< RElement > Browse(std::unique_ptr< RHolder > &obj)
Create browsable element for the object Created element may take ownership over the object.
static bool CanDraw7(const ClassArg &)
Return true if provided class can be drawn on the RCanvas.
static std::string GetClassIcon(const ClassArg &, bool=false)
Return icon name for the given class - either class name or TClass *.
static bool CanHaveChilds(const ClassArg &)
Return true if provided class can have childs.
static bool NotShowChilds(const ClassArg &)
Check if showing of sub-elements was disabled.
Access to TObject basic properties for RBrowsable.
std::unique_ptr< RHolder > GetObject() override
Return copy of TObject holder - if possible.
virtual std::string GetMTime() const
const TClass * GetClass() const
Returns class for contained object.
bool CheckValid() override
Returns true if object is still valid.
bool IsCapable(EActionKind) const override
Check object capability.
static std::unique_ptr< RLevelIter > GetCollectionIter(const TCollection *)
Creates iterator for TCollection object.
TObjectElement(TObject *obj, const std::string &name="", bool _hide_childs=false)
Constructor with plain TObject* as argument - ownership is not defined.
void SetHideChilds(bool on)
Set flag to hide all potential object childs.
void SetObject(TObject *obj)
Constructor with std::unique_ptr<RHolder> as argument.
std::unique_ptr< RHolder > fObject
std::string GetTitle() const override
Title of TObject.
virtual const TObject * CheckObject() const
Check if object still exists.
std::unique_ptr< RLevelIter > GetChildsIter() override
Create iterator for childs elements if any.
bool IsObject(void *) override
Returns true if holding specified object.
EActionKind GetDefaultAction() const override
Provides default action which can be performed with the object.
std::string GetName() const override
Name of TObject.
bool IsFolder() const override
Returns true if object can have child elements.
bool IsHideChilds() const
Is flag to hide all potential object childs set.
virtual Long64_t GetSize() const
void ForgetObject() const
Forget object, use when it was deleted behind the scene.
std::unique_ptr< RItem > CreateItem() const override
Create item.
Provider for all known TObject-based classes.
void RegisterTObject(const std::string &clname, const std::string &iconname, bool can_browse=false, int can_draw=3, const std::string &drawopt=""s)
ABC describing GUI independent browser implementation protocol.
Definition TBrowserImp.h:29
Using a TBrowser one can browse all ROOT objects.
Definition TBrowser.h:37
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:81
Browsable element for TCollection.
int GetNumChilds() override
Returns number of childs By default creates iterator and iterates over all items.
std::unique_ptr< RLevelIter > GetChildsIter() override
Create iterator for childs elements if any.
TCollectionElement(std::unique_ptr< RHolder > &obj)
Iterator over elements in TCollection.
std::unique_ptr< RItem > CreateItem() override
Create item for current TObject.
TCollectionIter(const TFolder *f)
bool CanItemHaveChilds() const override
Check if item can be expanded.
bool Next() override
Shift to next entry.
virtual ~TCollectionIter()=default
TCollectionIter(const TCollection *coll)
std::shared_ptr< RElement > GetElement() override
Returns full information for current element.
std::string GetItemName() const override
Returns current entry name
Collection abstract base class.
Definition TCollection.h:65
static TClass * Class()
virtual Int_t GetEntries() const
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Element representing TColor.
EActionKind GetDefaultAction() const override
Get default action.
TColorElement(std::unique_ptr< RHolder > &obj)
The color creation and management class.
Definition TColor.h:21
static TClass * Class()
Browsable element for TFolder.
TFolderElement(std::unique_ptr< RHolder > &obj)
std::unique_ptr< RLevelIter > GetChildsIter() override
Create iterator for childs elements if any.
int GetNumChilds() override
Returns number of childs By default creates iterator and iterates over all items.
<div class="legacybox"><h2>Legacy Code</h2> TFolder is a legacy interface: there will be no bug fixes...
Definition TFolder.h:30
TCollection * GetListOfFolders() const
Definition TFolder.h:55
static TClass * Class()
TObject * Next()
bool fDuplicated
! is object was duplicated?
virtual ~TMyBrowserImp()=default
TObjectLevelIter * fIter
! back-reference on iterator
void BrowseObj(TObject *obj) override
void Add(TObject *obj, const char *name, Int_t) override
void SetIgnore(bool on=true)
bool fIgnore
! ignore browsing, used during TBrowser constructor
const TObject * fBrowseObj
! object which will be browsed
bool IsDuplicated() const
TMyBrowserImp(TObjectLevelIter *iter, TObject *obj)
void Copy(TObject &named) const override
Copy this to obj.
Definition TNamed.cxx:94
Iterator over list of elements, designed for support TBrowser usage.
std::unique_ptr< RItem > CreateItem() override
Create element for the browser.
std::vector< std::shared_ptr< RElement > > fElements
bool CanItemHaveChilds() const override
Returns true if current item can have childs.
std::string GetItemName() const override
Returns current entry name
void AddElement(std::shared_ptr< RElement > &&elem)
auto NumElements() const
bool Next() override
Shift to next entry.
std::shared_ptr< RElement > GetElement() override
Returns full information for current element.
bool Find(const std::string &name, int indx=-1) override
Find item with specified name Default implementation, should work for all If index specified,...
virtual ~TObjectLevelIter()=default
Mother of all ROOT objects.
Definition TObject.h:41
virtual Bool_t IsFolder() const
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
Definition TObject.cxx:560
virtual const char * GetName() const
Returns name of object.
Definition TObject.cxx:444
virtual void Browse(TBrowser *b)
Browse object. May be overridden for another default action.
Definition TObject.cxx:204
R__ALWAYS_INLINE Bool_t IsZombie() const
Definition TObject.h:153
virtual const char * GetTitle() const
Returns title of object.
Definition TObject.cxx:488
virtual TClass * IsA() const
Definition TObject.h:243