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
20Each ROOT method (see TMethod) has a linked list of its arguments.
21This class describes one single method argument.
22The method argument info is obtained via the CINT api.
23See class TCling.
24
25The method argument information is used a.o. in the TContextMenu
26and THtml classes.
27*/
28
30
31////////////////////////////////////////////////////////////////////////////////
32/// Default TMethodArg ctor. TMethodArgs are constructed in TFunction
33/// via a call to TCling::CreateListOfMethodArgs().
34
35TMethodArg::TMethodArg(MethodArgInfo_t *info, TFunction *method) : TDictionary()
36{
37 fDataMember = nullptr;
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
57const 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
66const char *TMethodArg::GetTypeName() const
67{
69}
70
71////////////////////////////////////////////////////////////////////////////////
72/// Get full type description of method argument, e.g.: "class TDirectory*".
73
74const 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() : nullptr);
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
129void TMethodArg::Update(MethodArgInfo_t *info)
130{
132 fInfo = info;
133 if (fInfo) {
135 }
136}
long Long_t
Definition: CPyCppyy.h:50
#define ClassImp(name)
Definition: Rtypes.h:364
R__EXTERN TInterpreter * gCling
Definition: TInterpreter.h:561
All ROOT classes may have RTTI (run time type identification) support added.
Definition: TDataMember.h:31
TList * GetOptions()
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:167
Global functions class (global functions are obtained from CINT).
Definition: TFunction.h:30
virtual const char * MethodArgInfo_TypeName(MethodArgInfo_t *) const
Definition: TInterpreter.h:518
virtual std::string MethodArgInfo_TypeNormalizedName(MethodArgInfo_t *) const =0
virtual Long_t MethodArgInfo_Property(MethodArgInfo_t *) const
Definition: TInterpreter.h:515
virtual void MethodArgInfo_Delete(MethodArgInfo_t *) const
Definition: TInterpreter.h:509
virtual const char * MethodArgInfo_DefaultValue(MethodArgInfo_t *) const
Definition: TInterpreter.h:516
virtual const char * MethodArgInfo_Name(MethodArgInfo_t *) const
Definition: TInterpreter.h:517
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:36
const char * GetFullTypeName() const
Get full type description of method argument, e.g.: "class TDirectory*".
Definition: TMethodArg.cxx:74
MethodArgInfo_t * fInfo
Definition: TMethodArg.h:44
TList * GetOptions() const
Returns list of possible options - according to pointed datamember.
Definition: TMethodArg.cxx:102
const char * GetDefault() const
Get default value of method argument.
Definition: TMethodArg.cxx:57
virtual ~TMethodArg()
TMethodArg dtor deletes adopted CINT MethodArgInfo object.
Definition: TMethodArg.cxx:49
TMethodArg(const TMethodArg &)=delete
void Update(MethodArgInfo_t *info)
Update fInfo (to 0 for unloading and non-zero for reloading).
Definition: TMethodArg.cxx:129
Long_t Property() const
Get property description word. For meaning of bits see EProperty.
Definition: TMethodArg.cxx:93
std::string GetTypeNormalizedName() const
Get the normalized name of the return type.
Definition: TMethodArg.cxx:85
TFunction * fMethod
Definition: TMethodArg.h:45
const char * GetTypeName() const
Get type of method argument, e.g.
Definition: TMethodArg.cxx:66
TDataMember * fDataMember
Definition: TMethodArg.h:46
TDataMember * GetDataMember() const
Returns TDataMember pointed by this methodarg.
Definition: TMethodArg.cxx:120
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