31using namespace std::string_literals;
45 std::unique_ptr<TIterator>
fIter;
54 if (!
fDir)
return false;
58 if (lst->GetSize() == 0) {
60 if (olst->GetSize() > 0) {
62 fIter.reset(olst->MakeIterator());
67 fIter.reset(lst->MakeIterator());
74 if (!
fIter)
return false;
99 bool found_newer =
false;
100 while ((key =
dynamic_cast<TKey*
>(iter())) !=
nullptr) {
107 if (!found_newer)
break;
122 const char *undef =
"<undefined>";
123 const char *value =
gEnv->
GetValue(
"WebGui.LastCycle", undef);
125 std::string svalue = value;
126 if (svalue != undef) {
129 else if (svalue ==
"no")
182 std::shared_ptr<RElement>
GetElement()
override;
248 if (!subdir)
return nullptr;
249 return std::make_unique<TDirectoryLevelIter>(subdir);
273 if (!obj_class->HasDictionary()) {
284 TObject *tobj = (
TObject *) obj_class->DynamicCast(TObject::Class(), obj);
289 return std::make_unique<TObjectHolder>(tobj, !owned_by_dir);
292 return std::make_unique<RAnyObjectHolder>(obj_class, obj,
true);
299 return fElement->GetDefaultAction();
338 default:
return false;
414 return dir ? std::make_unique<TDirectoryLevelIter>(dir) :
nullptr;
448 return std::make_shared<TObjectElement>(
fObj);
454 if (key_class.find(
"TDirectory") == 0) {
456 if (subdir)
return std::make_shared<TDirectoryElement>(
"", subdir);
459 return std::make_shared<TKeyElement>(
fDir,
fKey);
480 RegisterFile(
"root", [] (
const std::string &fullname) -> std::shared_ptr<RElement> {
481 auto f =
dynamic_cast<TFile *
> (
gROOT->GetListOfFiles()->FindObject(fullname.c_str()));
483 if (!
f)
return nullptr;
484 return std::make_shared<TDirectoryElement>(fullname,
f);
487 RegisterBrowse(TFile::Class(), [](std::unique_ptr<RHolder> &
object) -> std::shared_ptr<RElement> {
488 return std::make_shared<TDirectoryElement>(
"",
const_cast<TFile*
>(
object->Get<
TFile>()));
491 RegisterBrowse(TDirectory::Class(), [](std::unique_ptr<RHolder> &
object) -> std::shared_ptr<RElement> {
#define R__LOG_ERROR(...)
RTFileProvider newRTFileProvider
Basic element of browsable hierarchy.
@ kFileName
"filename" - file name if applicable
static EContentKind GetContentKind(const std::string &kind)
Find item with specified name Default implementation, should work for all.
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
Iterator over single level hierarchy like any array, keys list, ...
Provider of different browsing methods for supported classes.
static std::shared_ptr< RElement > BrowseNTuple(const std::string &tuplename, const std::string &filename)
Start browsing of RNTuple.
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 *.
void RegisterFile(const std::string &extension, FileFunc_t func)
void RegisterBrowse(const TClass *cl, BrowseFunc_t func)
static bool CanHaveChilds(const ClassArg &)
Return true if provided class can have childs.
Provides access to ROOT files with extension "root" Other extensions can be registered.
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Element representing TDirectory.
bool cd() override
Select directory as active.
virtual ~TDirectoryElement()=default
EActionKind GetDefaultAction() const override
Get default action - browsing for the TFile/TDirectory.
std::string GetContent(const std::string &kind) override
Returns element content, depends from kind.
std::unique_ptr< RLevelIter > GetChildsIter() override
Provide iterator over TDirectory.
TDirectory * fDir
! subdirectory (ifany)
std::string GetName() const override
Name of TDirectoryElement.
TDirectoryElement(const std::string &fname, TDirectory *dir=nullptr)
std::string fFileName
! file name
std::string GetTitle() const override
Title of TDirectoryElement.
TDirectory * GetDir()
Get TDirectory. Checks if parent file is still there. If not, means it was closed outside ROOT.
Iterator over keys in TDirectory.
TDirectoryLevelIter(TDirectory *dir)
std::shared_ptr< RElement > GetElement() override
Returns full information for current element.
Bool_t fOnlyLastCycle
! show only last cycle in list of keys
std::string GetItemName() const override
Returns current entry name
std::unique_ptr< RItem > CreateItem() override
Create element for the browser.
TKey * fKey
! currently selected key
std::string fCurrentName
! current key name
Bool_t fKeysIter
! iterating over keys list (default)
std::unique_ptr< TIterator > fIter
! created iterator
bool CanItemHaveChilds() const override
Returns true if current item can have childs.
TDirectory * fDir
! current directory handle
TObject * fObj
! currently selected object
virtual ~TDirectoryLevelIter()=default
bool Next() override
Shift to next entry.
Describe directory structure in memory.
virtual TList * GetList() const
virtual TDirectory * GetDirectory(const char *namecycle, Bool_t printError=false, const char *funcname="GetDirectory")
Find a directory using apath.
virtual TFile * GetFile() const
TObject * FindObject(const char *name) const override
Find object by name in the list of memory objects.
virtual Bool_t cd()
Change current directory to "this" directory.
virtual TList * GetListOfKeys() const
virtual void * GetObjectChecked(const char *namecycle, const char *classname)
See documentation of TDirectory::GetObjectCheck(const char *namecycle, const TClass *cl)
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
Element representing TKey from TDirectory.
bool IsCapable(EActionKind action) const override
Check if want to perform action.
EActionKind GetDefaultAction() const override
Get default action.
std::unique_ptr< RLevelIter > GetChildsIter() override
Create iterator for childs elements if any Means we should try to browse inside.
std::string GetTitle() const override
Title of TKeyElement (optional)
std::shared_ptr< RElement > fElement
! holder of read object
virtual ~TKeyElement()=default
std::unique_ptr< RHolder > GetObject() override
Return object associated with TKey, if TDirectory has object of that name it will be returned.
TKeyElement(TDirectory *dir, TKey *key)
std::string GetName() const override
Name of TKeyElement, includes key cycle.
Book space in a file, create I/O buffers, to fill them, (un)compress them.
virtual const char * GetClassName() const
virtual const char * GetTitle() const
Returns title (title can contain 32x32 xpm thumbnail/icon).
Short_t GetCycle() const
Return cycle number associated to this key.
virtual const char * GetTitle() const
Returns title of object.
virtual const char * GetName() const
Returns name of object.
Mother of all ROOT objects.
virtual const char * GetName() const
Returns name of object.
R__ALWAYS_INLINE Bool_t IsZombie() const
virtual const char * GetTitle() const
Returns title of object.
RLogChannel & BrowsableLog()
Log channel for Browsable diagnostics.