30using namespace std::string_literals;
44 std::unique_ptr<TIterator>
fIter;
52 if (!
fDir)
return false;
56 if (
lst->GetSize() == 0) {
58 if (
olst->GetSize() > 0) {
72 if (!
fIter)
return false;
118 while ((key =
dynamic_cast<TKey*
>(iter())) !=
nullptr) {
170 std::unique_ptr<RHolder>
holder = std::make_unique<TObjectHolder>(
fObj,
kFALSE);
174 return elem ?
elem->CreateItem() :
nullptr;
214 if (!
gROOT->GetListOfFiles()->FindObject(
fObj))
283 return dir ? std::make_unique<TDirectoryLevelIter>(dir) :
nullptr;
304 if (
f)
return f->GetSize();
311 if (
f)
return f->GetModificationDate().AsSQLString();
389 if (!dir)
return nullptr;
394 if (!
subdir)
return nullptr;
395 return std::make_unique<TDirectoryLevelIter>(
subdir);
437 bool in_dir = dir->FindObject(
tobj) !=
nullptr,
446 return std::make_unique<RAnyObjectHolder>(
obj_class, obj,
true);
452 return fElement->GetDefaultAction();
508 default:
return false;
541 return std::make_shared<TObjectElement>(
fObj);
549 if (
subdir)
return std::make_shared<TDirectoryElement>(
"",
subdir);
552 return std::make_shared<TKeyElement>(
fDir,
fKey);
570 RegisterFile(
"root", [] (
const std::string &fullname) -> std::shared_ptr<RElement> {
571 auto f =
dynamic_cast<TFile *
> (
gROOT->GetListOfFiles()->FindObject(fullname.c_str()));
573 if (!
f)
return nullptr;
574 return std::make_shared<TDirectoryElement>(fullname,
f,
true);
578 return std::make_shared<TDirectoryElement>(
"",
const_cast<TFile*
>(
object->Get<
TFile>()),
true);
#define R__LOG_ERROR(...)
short Short_t
Signed Short integer 2 bytes (short)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
RTFileProvider newRTFileProvider
static bool IsLastKeyCycle()
Is only last cycle from the list of keys is shown.
static EContentKind GetContentKind(const std::string &kind)
Find item with specified name Default implementation, should work for all.
@ kFileName
"filename" - file name if applicable
EActionKind
Possible actions on double-click.
@ kActImage
can be shown in image viewer, can provide image
@ kActDraw6
can be drawn inside ROOT6 canvas
@ kActCanvas
indicate that it is canvas and should be drawn directly
@ kActTree
can be shown in tree viewer
@ kActGeom
can be shown in geometry viewer
@ kActBrowse
just browse (expand) item
@ kActEdit
can provide data for text editor
@ kActDraw7
can be drawn inside ROOT7 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.
Access to TObject basic properties for RBrowsable.
virtual const TObject * CheckObject() const
Check if object still exists.
void ForgetObject() const
Forget object, use when it was deleted behind the scene.
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.
~TDirectoryElement() override=default
bool cd() override
Select directory as active.
bool fIsFile
! is TFile instance registered in global list of files
EActionKind GetDefaultAction() const override
Get default action - browsing for the TFile/TDirectory.
Long64_t GetSize() const override
Size of TDirectory.
std::string GetContent(const std::string &kind) override
Returns element content, depends from kind.
TDirectory * GetDir() const
std::unique_ptr< RLevelIter > GetChildsIter() override
Provide iterator over TDirectory.
bool IsFolder() const override
Check if element can have childs.
TDirectoryElement(const std::string &fname, TDirectory *dir=nullptr, bool isfile=false)
std::string GetMTime() const override
std::string GetName() const override
Name of TDirectoryElement.
const TObject * CheckObject() const override
Check if object still exists.
std::string fFileName
! file name
std::string GetTitle() const override
Title of TDirectoryElement.
Iterator over keys in TDirectory.
TDirectoryLevelIter(TDirectory *dir)
std::shared_ptr< RElement > GetElement() override
Returns full information for current element.
~TDirectoryLevelIter() override=default
bool fKeysIter
! iterating over keys list (default)
std::string GetItemName() const override
Returns current entry name
std::unique_ptr< RItem > CreateItem() override
Create item for the client.
TKey * fKey
! currently selected key
std::shared_ptr< RElement > GetDirElement(bool read_dir)
Return element for current TKey object in TDirectory.
std::string fCurrentName
! current key name
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
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
virtual TList * GetListOfKeys() const
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
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 - browsing for the TFile/TDirectory.
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
std::unique_ptr< RHolder > GetObject() override
Return object associated with the TKey.
std::unique_ptr< RItem > CreateItem() const override
Returns item with element description.
~TKeyElement() override=default
Long64_t GetSize() const override
Size of TDirectory.
bool IsFolder() const override
Check if element can have childs.
TKeyElement(TDirectory *dir, TKey *key)
std::string GetMTime() const override
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.
const char * GetTitle() const override
Returns title (title can contain 32x32 xpm thumbnail/icon).
virtual const char * GetClassName() const
const TDatime & GetDatime() const
Short_t GetCycle() const
Return cycle number associated to this key.
const char * GetName() const override
Returns name of object.
Mother of all ROOT objects.
virtual const char * GetName() const
Returns name of object.
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
virtual const char * GetTitle() const
Returns title of object.
virtual TClass * IsA() const
@ kInvalidObject
if object ctor succeeded but object should not be used
ROOT::RLogChannel & BrowsableLog()
Log channel for Browsable diagnostics.