Logo ROOT  
Reference Guide
TMethodArg.cxx
Go to the documentation of this file.
1// @(#)root/meta:$Id$
2// Author: Rene Brun 04/02/95
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#include "TMethodArg.h"
13#include "TROOT.h"
14#include "TInterpreter.h"
15#include "Strlen.h"
16#include "TMethod.h"
17#include "TMethodCall.h"
18#include "TDataMember.h"
19
20/** \class TMethodArg
21Each ROOT method (see TMethod) has a linked list of its arguments.
22This class describes one single method argument.
23The method argument info is obtained via the CINT api.
24See class TCling.
25
26The method argument information is used a.o. in the TContextMenu
27and THtml classes.
28*/
29
31
32////////////////////////////////////////////////////////////////////////////////
33/// Default TMethodArg ctor. TMethodArgs are constructed in TFunction
34/// via a call to TCling::CreateListOfMethodArgs().
35
36TMethodArg::TMethodArg(MethodArgInfo_t *info, TFunction *method) : TDictionary()
37{
38 fDataMember = 0;
39 fInfo = info;
40 fMethod = method;
41 if (fInfo) {
44 }
45}
46
47////////////////////////////////////////////////////////////////////////////////
48/// TMethodArg dtor deletes adopted CINT MethodArgInfo object.
49
51{
53}
54
55////////////////////////////////////////////////////////////////////////////////
56/// Get default value of method argument.
57
58const char *TMethodArg::GetDefault() const
59{
61}
62
63////////////////////////////////////////////////////////////////////////////////
64/// Get type of method argument, e.g.: "class TDirectory*" -> "TDirectory"
65/// Result needs to be used or copied immediately.
66
67const char *TMethodArg::GetTypeName() const
68{
70}
71
72////////////////////////////////////////////////////////////////////////////////
73/// Get full type description of method argument, e.g.: "class TDirectory*".
74
75const char *TMethodArg::GetFullTypeName() const
76{
78}
79
80////////////////////////////////////////////////////////////////////////////////
81/// Get the normalized name of the return type. A normalized name is fully
82/// qualified and has all typedef desugared except for the 'special' typedef
83/// which include Double32_t, Float16_t, [U]Long64_t and std::string. It
84/// also has std:: removed [This is subject to change].
85
87{
89}
90
91////////////////////////////////////////////////////////////////////////////////
92/// Get property description word. For meaning of bits see EProperty.
93
95{
97}
98
99////////////////////////////////////////////////////////////////////////////////
100/// Returns list of possible options - according to pointed datamember.
101/// If there is no datamember field assigned to this methodarg - returns 0.
102
104{
105 return (TList*)(fDataMember ? fDataMember->GetOptions() : 0);
106}
107
108////////////////////////////////////////////////////////////////////////////////
109/// Returns TDataMember pointed by this methodarg.
110/// If you want to specify list of options or current value for your
111/// MethodArg (i.e. it is used as initial values in argument-asking dialogs
112/// popped up from context-meny),you can get this value from one of data
113/// members of the class.
114///
115/// The only restriction is, that this DataMember object must have its
116/// Getter/Setter methods set-up correctly - for details look at TDataMember.
117/// To learn how to specify the data member to which the argument should
118/// "point", look at TMethod. This is TMethod which sets up fDataMember,
119/// so it could work correctly.
120
122{
123 return fDataMember;
124}
125
126////////////////////////////////////////////////////////////////////////////////
127/// Update fInfo (to 0 for unloading and non-zero for reloading).
128/// This takes ownership of 'info'
129
130void TMethodArg::Update(MethodArgInfo_t *info)
131{
133 fInfo = info;
134 if (fInfo) {
136 }
137}
long Long_t
Definition: RtypesCore.h:50
#define ClassImp(name)
Definition: Rtypes.h:365
R__EXTERN TInterpreter * gCling
Definition: TInterpreter.h:556
All ROOT classes may have RTTI (run time type identification) support added.
Definition: TDataMember.h:31
TList * GetOptions() const
Returns list of options - list of TOptionListItems.
This class defines an abstract interface that must be implemented by all classes that contain diction...
Definition: TDictionary.h:162
Global functions class (global functions are obtained from CINT).
Definition: TFunction.h:28
virtual const char * MethodArgInfo_Name(MethodArgInfo_t *) const
Definition: TInterpreter.h:512
virtual std::string MethodArgInfo_TypeNormalizedName(MethodArgInfo_t *) const =0
virtual const char * MethodArgInfo_DefaultValue(MethodArgInfo_t *) const
Definition: TInterpreter.h:511
virtual Long_t MethodArgInfo_Property(MethodArgInfo_t *) const
Definition: TInterpreter.h:510
virtual void MethodArgInfo_Delete(MethodArgInfo_t *) const
Definition: TInterpreter.h:504
virtual const char * MethodArgInfo_TypeName(MethodArgInfo_t *) const
Definition: TInterpreter.h:513
virtual const char * TypeName(const char *s)=0
A doubly linked list.
Definition: TList.h:44
Each ROOT method (see TMethod) has a linked list of its arguments.
Definition: TMethodArg.h:31
const char * GetFullTypeName() const
Get full type description of method argument, e.g.: "class TDirectory*".
Definition: TMethodArg.cxx:75
MethodArgInfo_t * fInfo
Definition: TMethodArg.h:39
TList * GetOptions() const
Returns list of possible options - according to pointed datamember.
Definition: TMethodArg.cxx:103
const char * GetDefault() const
Get default value of method argument.
Definition: TMethodArg.cxx:58
virtual ~TMethodArg()
TMethodArg dtor deletes adopted CINT MethodArgInfo object.
Definition: TMethodArg.cxx:50
void Update(MethodArgInfo_t *info)
Update fInfo (to 0 for unloading and non-zero for reloading).
Definition: TMethodArg.cxx:130
Long_t Property() const
Get property description word. For meaning of bits see EProperty.
Definition: TMethodArg.cxx:94
std::string GetTypeNormalizedName() const
Get the normalized name of the return type.
Definition: TMethodArg.cxx:86
TFunction * fMethod
Definition: TMethodArg.h:40
const char * GetTypeName() const
Get type of method argument, e.g.
Definition: TMethodArg.cxx:67
TDataMember * fDataMember
Definition: TMethodArg.h:41
TDataMember * GetDataMember() const
Returns TDataMember pointed by this methodarg.
Definition: TMethodArg.cxx:121
TMethodArg(const TMethodArg &)
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition: TNamed.cxx:164
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:140