Warning, file /include/root/TBranchBrowsable.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TBranchBrowsable
0013 #define ROOT_TBranchBrowsable
0014
0015 #include "TNamed.h"
0016
0017 #include "TList.h"
0018
0019 #include <list>
0020
0021 class TMethod;
0022 class TBowser;
0023 class TClass;
0024 class TBranch;
0025 class TBranchElement;
0026 class TString;
0027 class TStreamerElement;
0028
0029 class TVirtualBranchBrowsable: public TNamed {
0030 public:
0031
0032
0033
0034
0035 typedef Int_t (*MethodCreateListOfBrowsables_t)
0036 (TList &, const TBranch *branch, const TVirtualBranchBrowsable *parent);
0037
0038 ~TVirtualBranchBrowsable() override;
0039
0040 void Browse(TBrowser *b) override;
0041
0042
0043 const char* GetIconName() const override
0044 {
0045 if (IsFolder())
0046 return "TBranchElement-folder";
0047 else
0048 return "TBranchElement-leaf";
0049 }
0050
0051 void GetScope(TString &scope) const;
0052
0053
0054 bool IsFolder() const override { return (GetLeaves() && GetLeaves()->GetSize()); }
0055
0056 static Int_t FillListOfBrowsables(TList &list, const TBranch *branch,
0057 const TVirtualBranchBrowsable *parent = nullptr);
0058
0059
0060 const TBranch* GetBranch() const { return fBranch; }
0061
0062
0063 const TVirtualBranchBrowsable* GetParent() const { return fParent; }
0064
0065
0066 TClass *GetClassType() const { return fClass; }
0067
0068
0069 bool TypeIsPointer() const { return fTypeIsPointer; }
0070
0071 TList *GetLeaves() const;
0072
0073
0074
0075
0076 protected:
0077 TVirtualBranchBrowsable(const TBranch *b, TClass *type, bool typeIsPointer,
0078 const TVirtualBranchBrowsable *parent = nullptr);
0079 static TClass* GetCollectionContainedType(const TBranch *b,
0080 const TVirtualBranchBrowsable *parent, TClass *&contained);
0081 static std::list<MethodCreateListOfBrowsables_t>& GetRegisteredGenerators();
0082 static void RegisterGenerator(MethodCreateListOfBrowsables_t generator);
0083 static void UnregisterGenerator(MethodCreateListOfBrowsables_t generator);
0084
0085 void SetType(TClass* type) { fClass = type; }
0086
0087
0088 void SetTypeIsPointer(bool set=true) { fTypeIsPointer = set; }
0089
0090 private:
0091 static void RegisterDefaultGenerators();
0092 const TBranch *fBranch{nullptr};
0093 const TVirtualBranchBrowsable *fParent{nullptr};
0094 TList *fLeaves{nullptr};
0095 TClass *fClass{nullptr};
0096 bool fTypeIsPointer{false};
0097 static std::list<MethodCreateListOfBrowsables_t> fgGenerators;
0098 static bool fgGeneratorsSet;
0099 ClassDefOverride(TVirtualBranchBrowsable, 0);
0100 };
0101
0102
0103 class TMethodBrowsable: public TVirtualBranchBrowsable {
0104 public:
0105 ~TMethodBrowsable() override {};
0106
0107 static Int_t GetBrowsables(TList &list, const TBranch *branch,
0108 const TVirtualBranchBrowsable *parent = nullptr);
0109
0110
0111 const char* GetIconName() const override
0112 {
0113 if (IsFolder())
0114 return "TMethodBrowsable-branch";
0115 return "TMethodBrowsable-leaf";
0116 }
0117 static bool IsMethodBrowsable(const TMethod *m);
0118 static void Register();
0119 static void Unregister();
0120
0121 protected:
0122 static void GetBrowsableMethodsForClass(TClass *cl, TList &list);
0123 TMethodBrowsable(const TBranch *branch, TMethod *m,
0124 const TVirtualBranchBrowsable *parent = nullptr);
0125
0126 private:
0127 TMethod *fMethod{nullptr};
0128 ClassDefOverride(TMethodBrowsable,0);
0129 };
0130
0131
0132 class TNonSplitBrowsable: public TVirtualBranchBrowsable {
0133 public:
0134 ~TNonSplitBrowsable() override {}
0135
0136 static Int_t GetBrowsables(TList &list, const TBranch *branch,
0137 const TVirtualBranchBrowsable *parent = nullptr);
0138 static void Register();
0139 static void Unregister();
0140
0141 protected:
0142 TNonSplitBrowsable(const TStreamerElement *element, const TBranch *branch,
0143 const TVirtualBranchBrowsable *parent = nullptr);
0144
0145 private:
0146 ClassDefOverride(TNonSplitBrowsable, 0);
0147 };
0148
0149
0150 class TCollectionPropertyBrowsable: public TVirtualBranchBrowsable {
0151 public:
0152 ~TCollectionPropertyBrowsable() override {}
0153
0154 void Browse(TBrowser *b) override;
0155 static Int_t GetBrowsables(TList &list, const TBranch *branch,
0156 const TVirtualBranchBrowsable *parent = nullptr);
0157
0158 const char *GetDraw() const { return fDraw.Data(); }
0159 static void Register();
0160 static void Unregister();
0161
0162 protected:
0163
0164
0165 TCollectionPropertyBrowsable(const char *name, const char *title,
0166 const char *draw, const TBranch *branch,
0167 const TVirtualBranchBrowsable *parent = nullptr) :
0168 TVirtualBranchBrowsable(branch, nullptr, false, parent), fDraw(draw)
0169 {
0170 SetNameTitle(name, title);
0171 }
0172
0173 private:
0174 TString fDraw;
0175 ClassDefOverride(TCollectionPropertyBrowsable, 0);
0176 };
0177
0178 class TCollectionMethodBrowsable: public TMethodBrowsable {
0179 public:
0180 ~TCollectionMethodBrowsable() override {};
0181
0182 static Int_t GetBrowsables(TList &list, const TBranch *branch,
0183 const TVirtualBranchBrowsable *parent = nullptr);
0184 static void Register();
0185 static void Unregister();
0186
0187 protected:
0188 TCollectionMethodBrowsable(const TBranch* branch, TMethod* m,
0189 const TVirtualBranchBrowsable* parent = nullptr);
0190
0191 ClassDefOverride(TCollectionMethodBrowsable,0);
0192 };
0193
0194 #endif