30using namespace std::string_literals;
44 std::unique_ptr<TIterator>
fIter;
53 if (!
fDir)
return false;
57 if (lst->GetSize() == 0) {
59 if (olst->GetSize() > 0) {
61 fIter.reset(olst->MakeIterator());
66 fIter.reset(lst->MakeIterator());
73 if (!
fIter)
return false;
117 bool found_newer =
false;
118 while ((key =
dynamic_cast<TKey*
>(iter())) !=
nullptr) {
125 if (!found_newer)
break;
140 const char *undef =
"<undefined>";
143 std::string svalue =
value;
144 if (svalue != undef) {
147 else if (svalue ==
"no")
184 std::unique_ptr<RHolder> holder = std::make_unique<TObjectHolder>(
fObj,
kFALSE);
188 return elem ? elem->CreateItem() :
nullptr;
228 if (!
gROOT->GetListOfFiles()->FindObject(
fObj))
297 return dir ? std::make_unique<TDirectoryLevelIter>(dir) :
nullptr;
318 if (
f)
return f->GetSize();
325 if (
f)
return f->GetModificationDate().AsSQLString();
403 if (!dir)
return nullptr;
405 auto subdir = dir->GetDirectory(
fKeyName.c_str());
407 subdir = dir->GetDirectory(
GetName().c_str());
408 if (!subdir)
return nullptr;
409 return std::make_unique<TDirectoryLevelIter>(subdir);
433 if (!obj_class->HasDictionary()) {
443 void *obj = dir->GetObjectChecked(namecycle.c_str(), obj_class);
451 bool in_dir = dir->
FindObject(tobj) !=
nullptr,
454 if (in_dir && !special_class)
457 return std::make_unique<TObjectHolder>(tobj, !special_class);
460 return std::make_unique<RAnyObjectHolder>(obj_class, obj,
true);
466 return fElement->GetDefaultAction();
522 default:
return false;
535 auto item = std::make_unique<TObjectItem>(
GetName(), is_folder ? -1 : 0);
555 return std::make_shared<TObjectElement>(
fObj);
561 if (read_dir && (key_class.find(
"TDirectory") == 0)) {
563 if (subdir)
return std::make_shared<TDirectoryElement>(
"", subdir);
566 return std::make_shared<TKeyElement>(
fDir,
fKey);
584 RegisterFile(
"root", [] (
const std::string &fullname) -> std::shared_ptr<RElement> {
585 auto f =
dynamic_cast<TFile *
> (
gROOT->GetListOfFiles()->FindObject(fullname.c_str()));
587 if (!
f)
return nullptr;
588 return std::make_shared<TDirectoryElement>(fullname,
f,
true);
592 return std::make_shared<TDirectoryElement>(
"",
const_cast<TFile*
>(
object->Get<
TFile>()),
true);
#define R__LOG_ERROR(...)
RTFileProvider newRTFileProvider
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
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.
const char * AsSQLString() const
Return the date & time in SQL compatible string format, like: 1997-01-15 20:16:28.
Element representing TDirectory.
bool cd() override
Select directory as active.
bool fIsFile
! is TFile instance registered in global list of files
virtual ~TDirectoryElement()=default
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.
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
bool fOnlyLastCycle
! show only last cycle in list of keys
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
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
virtual TList * GetListOfKeys() const
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
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
virtual ~TKeyElement()=default
std::unique_ptr< RHolder > GetObject() override
Return object associated with the TKey.
std::unique_ptr< RItem > CreateItem() const override
Returns item with element description.
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.
TObject * FindObject(const char *name) const override
Find an object in this list using its name.
TIterator * MakeIterator(Bool_t dir=kIterForward) const override
Return a list iterator.
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::Experimental::RLogChannel & BrowsableLog()
Log channel for Browsable diagnostics.