Logo ROOT  
Reference Guide
TFolder.h
Go to the documentation of this file.
1// @(#)root/base:$Id$
2// Author: Rene Brun 02/09/2000
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TFolder
13#define ROOT_TFolder
14
15
16//////////////////////////////////////////////////////////////////////////
17// //
18// TFolder //
19// //
20// Describe a folder: a list of objects and folders //
21// //
22//////////////////////////////////////////////////////////////////////////
23
24#include "TNamed.h"
25
26class TCollection;
27class TBrowser;
28
29
30class TFolder : public TNamed {
31
32protected:
33 TCollection *fFolders; //pointer to the list of folders
34 Bool_t fIsOwner; //true if folder own its contained objects
35
36private:
37 TFolder(const TFolder &folder) = delete; //folders cannot be copied
38 void operator=(const TFolder &)= delete;
39
40public:
41
42 TFolder();
43 TFolder(const char *name, const char *title);
44 virtual ~TFolder();
45 virtual void Add(TObject *obj);
46 TFolder *AddFolder(const char *name, const char *title, TCollection *collection=nullptr);
47 void Browse(TBrowser *b) override;
48 void Clear(Option_t *option="") override;
49 void Copy(TObject &) const override { MayNotUse("Copy(TObject &)"); }
50 virtual const char *FindFullPathName(const char *name) const;
51 virtual const char *FindFullPathName(const TObject *obj) const;
52 TObject *FindObject(const char *name) const override;
53 TObject *FindObject(const TObject *obj) const override;
54 virtual TObject *FindObjectAny(const char *name) const;
56 Bool_t IsFolder() const override { return kTRUE; }
57 Bool_t IsOwner() const;
58 void ls(Option_t *option="") const override; // *MENU*
59 virtual Int_t Occurence(const TObject *obj) const;
60 void RecursiveRemove(TObject *obj) override;
61 virtual void Remove(TObject *obj);
62 void SaveAs(const char *filename="",Option_t *option="") const override; // *MENU*
63 virtual void SetOwner(Bool_t owner=kTRUE);
64
65 ClassDefOverride(TFolder,1) //Describe a folder: a list of objects and folders
66};
67
68#endif
bool Bool_t
Definition: RtypesCore.h:63
int Int_t
Definition: RtypesCore.h:45
const Bool_t kTRUE
Definition: RtypesCore.h:100
const char Option_t
Definition: RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition: Rtypes.h:339
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t b
char name[80]
Definition: TGX11.cxx:110
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
Collection abstract base class.
Definition: TCollection.h:65
A TFolder object is a collection of objects and folders.
Definition: TFolder.h:30
void RecursiveRemove(TObject *obj) override
Recursively remove object from a folder.
Definition: TFolder.cxx:447
void Browse(TBrowser *b) override
Browse this folder.
Definition: TFolder.cxx:211
Bool_t IsFolder() const override
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
Definition: TFolder.h:56
TFolder()
Default constructor used by the Input functions.
Definition: TFolder.cxx:110
virtual TObject * FindObjectAny(const char *name) const
Return a pointer to the first object with name starting at this folder.
Definition: TFolder.cxx:341
TCollection * GetListOfFolders() const
Definition: TFolder.h:55
TFolder * AddFolder(const char *name, const char *title, TCollection *collection=nullptr)
Create a new folder and add it to the list of folders of this folder, return a pointer to the created...
Definition: TFolder.cxx:180
virtual void Add(TObject *obj)
Add object to this folder. obj must be a TObject or a TFolder.
Definition: TFolder.cxx:164
void Clear(Option_t *option="") override
Delete all objects from a folder list.
Definition: TFolder.cxx:219
virtual ~TFolder()
Folder destructor.
Definition: TFolder.cxx:131
void Copy(TObject &) const override
Copy this to obj.
Definition: TFolder.h:49
TObject * FindObject(const char *name) const override
Search object identified by name in the tree of folders inside this folder.
Definition: TFolder.cxx:304
void ls(Option_t *option="") const override
List folder contents.
Definition: TFolder.cxx:386
void SaveAs(const char *filename="", Option_t *option="") const override
Save all objects in this folder in filename.
Definition: TFolder.cxx:466
virtual const char * FindFullPathName(const char *name) const
Return the full pathname corresponding to subpath name if the node is gROOT->GetRootFolder() and retu...
Definition: TFolder.cxx:229
Bool_t fIsOwner
Definition: TFolder.h:34
virtual void SetOwner(Bool_t owner=kTRUE)
Set ownership.
Definition: TFolder.cxx:481
Bool_t IsOwner() const
Folder ownership has been set via.
Definition: TFolder.cxx:367
virtual Int_t Occurence(const TObject *obj) const
Return occurence number of object in the list of objects of this folder.
Definition: TFolder.cxx:425
TCollection * fFolders
Definition: TFolder.h:33
void operator=(const TFolder &)=delete
TFolder(const TFolder &folder)=delete
virtual void Remove(TObject *obj)
Remove object from this folder. obj must be a TObject or a TFolder.
Definition: TFolder.cxx:455
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
Mother of all ROOT objects.
Definition: TObject.h:37
void MayNotUse(const char *method) const
Use this method to signal that a method (defined in a base class) may not be called in a derived clas...
Definition: TObject.cxx:946