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