library: libTree #include "TBranchBrowsable.h"

# TMethodBrowsable

class description - source file - inheritance tree (.pdf)

## class TMethodBrowsable : public TVirtualBranchBrowsable

| Inheritance Chart:
`TObject`
| <- | `TNamed`
| <- | `TVirtualBranchBrowsable`
| <- | `TMethodBrowsable` |
<- |
`TCollectionMethodBrowsable` |

        protected:

                           TMethodBrowsable(const TBranch* branch, TMethod* m, const TVirtualBranchBrowsable* parent = 0)
               static void GetBrowsableMethodsForClass(TClass* cl, TList& list)

        public:

                              TMethodBrowsable(const TMethodBrowsable&)
                              ~TMethodBrowsable()
               static TClass* Class()
                 static Int_t GetBrowsables(TList& list, const TBranch* branch, const TVirtualBranchBrowsable* parent = 0)
          virtual const char* GetIconName() const
              virtual TClass* IsA() const
                static Bool_t IsMethodBrowsable(const TMethod* m)
                  static void Register()
                 virtual void ShowMembers(TMemberInspector& insp, char* parent)
                 virtual void Streamer(TBuffer& b)
                         void StreamerNVirtual(TBuffer& b)
                  static void Unregister()

### Data Members

        private:

          TMethod* fMethod  pointer to a method

## Class Description

     TVirtualBranchBrowsable is a base class (not really abstract, but useless
     by itself) for helper objects that extend TBranch's browsing support.
     Each registered derived class's generator method is called, which fills
     all created helper objects into a list which can then be browsed.
     For details of what these browser helper objects can do, see e.g.
     TMethodBrowsable, which allows methods to show up in the TBrowser.

     Only registered helper objects are created. By default, only
     TMethodBrowsable, TNonSplitBrowsable, and TCollectionPropertyBrowsable
     are registered (see RegisterDefaultGenerators). You can prevent any of
     their objects to show up in the browser by unregistering the generator:
       TMethodBrowsable::Unregister()
     will stop creating browsable method helper objects from that call on.
     Note that these helper objects are cached (in TBranch::fBrowsables);
     already created (and thus cached) browsables will still appear in the
     browser even after unregistering the corresponding generator.

     You can implement your own browsable objects and thier generator; see
     e.g. the simple TCollectionPropertyBrowsable. Note that you will have
     to register your generator just like any other, and that you should
     implement the following methods for your own class, mainly for
     consistency reasons:
       static void Register() {
         TVirtualBranchBrowsable::RegisterGenerator(GetBrowsables); }
       static void Unregister() {
         TVirtualBranchBrowsable::UnregisterGenerator(GetBrowsables); }
     where GetBrowsables is a static member function of your class, that
     creates the browsable helper objects, and has the signature
       static Int_t GetBrowsables(TList& list, const TBranch* branch,
                                  const TVirtualBranchBrowsable* parent=0);
     It has to return the number of browsable helper objects for parent
     (or, if NULL, for branch) which are added to the list.
    ______________________________________________________________________________

TMethodBrowsable(const TBranch* branch, TMethod* m, const TVirtualBranchBrowsable* parent /* =0 */): TVirtualBranchBrowsable(branch, 0, kFALSE, parent), fMethod(m)

     Constructor.
     Links a TBranchElement to a TMethod, allowing the TBrowser to
     browse simple methods.

     The c'tor sets the name for a method "Class::Method(params) const"
     to "Method(params)", title to TMethod::GetPrototype

void GetBrowsableMethodsForClass(TClass* cl, TList& li)

     Given a class, this methods fills list with TMethodBrowsables
     for the class and its base classes, and returns the number of
     added elements. If called from a TBranch::Browse overload, "branch"
     should be set to the calling TBranch, otherwise "parent" should
     be set to the TVirtualBranchBrowsable being browsed, and branch
     should be the branch of the parent.

Int_t GetBrowsables(TList& li, const TBranch* branch, const TVirtualBranchBrowsable* parent /*=0*/)

     This methods fills list with TMethodBrowsables
     for the branch's or parent's class and its base classes, and returns
     the number of added elements. If called from a TBranch::Browse
     overload, "branch" should be set to the calling TBranch, otherwise
     "parent" should be set to the TVirtualBranchBrowsable being browsed.

Bool_t IsMethodBrowsable(const TMethod* m)

     A TMethod is browsable if it is const, public and not pure virtual,
     if does not have any parameter without default value, and if it has
     a (non-void) return value.
     A method called *, Get*, or get* will not be browsable if there is a
     persistent data member called f*, _*, or m*, as data member access is
     faster than method access. Examples: if one of fX, _X, or mX is a
     persistent data member, the methods GetX(), getX(), and X() will not
     be browsable.

void Register()

     Wrapper for the registration method. Needed against MSVC, which
     assigned different addr to the same method, depending on what
     translation unit you're in...

void Unregister()

     Wrapper for the registration method. Needed against MSVC, which
     assigned different addr to the same method, depending on what
     translation unit you're in...

### Inline Functions

                        void ~TMethodBrowsable()
                 const char* GetIconName() const
                     TClass* Class()
                     TClass* IsA() const
                        void ShowMembers(TMemberInspector& insp, char* parent)
                        void Streamer(TBuffer& b)
                        void StreamerNVirtual(TBuffer& b)
            TMethodBrowsable TMethodBrowsable(const TMethodBrowsable&)

Author: Axel Naumann 14/10/2004
Last update: root/tree:$Name: $:$Id: TBranchBrowsable.cxx,v 1.5 2005/05/18 21:04:54 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *