00001 // @(#)root/meta:$Id: TMethodArg.cxx 24077 2008-05-31 19:39:09Z brun $ 00002 // Author: Rene Brun 04/02/95 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * 00006 * All rights reserved. * 00007 * * 00008 * For the licensing terms see $ROOTSYS/LICENSE. * 00009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00010 *************************************************************************/ 00011 00012 #include "TMethodArg.h" 00013 #include "TROOT.h" 00014 #include "TInterpreter.h" 00015 #include "Strlen.h" 00016 #include "TMethod.h" 00017 #include "TMethodCall.h" 00018 #include "TDataMember.h" 00019 00020 ////////////////////////////////////////////////////////////////////////// 00021 // // 00022 // Each ROOT method (see TMethod) has a linked list of its arguments. // 00023 // This class describes one single method argument. // 00024 // The method argument info is obtained via the CINT api. // 00025 // See class TCint. // 00026 // // 00027 // The method argument information is used a.o. in the TContextMenu // 00028 // and THtml classes. // 00029 // // 00030 ////////////////////////////////////////////////////////////////////////// 00031 00032 ClassImp(TMethodArg) 00033 00034 //______________________________________________________________________________ 00035 TMethodArg::TMethodArg(MethodArgInfo_t *info, TFunction *method) : TDictionary() 00036 { 00037 // Default TMethodArg ctor. TMethodArgs are constructed in TFunction 00038 // via a call to TCint::CreateListOfMethodArgs(). 00039 00040 fDataMember = 0; 00041 fInfo = info; 00042 fMethod = method; 00043 if (fInfo) { 00044 SetName(gCint->MethodArgInfo_Name(fInfo)); 00045 SetTitle(gCint->MethodArgInfo_TypeName(fInfo)); 00046 } 00047 } 00048 00049 //______________________________________________________________________________ 00050 TMethodArg::~TMethodArg() 00051 { 00052 // TMethodArg dtor deletes adopted CINT MethodArgInfo object. 00053 00054 if (fInfo) gCint->MethodArgInfo_Delete(fInfo); 00055 } 00056 00057 //______________________________________________________________________________ 00058 const char *TMethodArg::GetDefault() const 00059 { 00060 // Get default value of method argument. 00061 00062 return gCint->MethodArgInfo_DefaultValue(fInfo); 00063 } 00064 00065 //______________________________________________________________________________ 00066 const char *TMethodArg::GetTypeName() const 00067 { 00068 // Get type of method argument, e.g.: "class TDirectory*" -> "TDirectory" 00069 // Result needs to be used or copied immediately. 00070 00071 return gCint->TypeName(gCint->MethodArgInfo_TypeName(fInfo)); 00072 } 00073 00074 //______________________________________________________________________________ 00075 const char *TMethodArg::GetFullTypeName() const 00076 { 00077 // Get full type description of method argument, e.g.: "class TDirectory*". 00078 00079 return gCint->MethodArgInfo_TypeName(fInfo); 00080 } 00081 00082 //______________________________________________________________________________ 00083 Long_t TMethodArg::Property() const 00084 { 00085 // Get property description word. For meaning of bits see EProperty. 00086 00087 return gCint->MethodArgInfo_Property(fInfo); 00088 } 00089 00090 //______________________________________________________________________________ 00091 TList *TMethodArg::GetOptions() const 00092 { 00093 // Returns list of possible options - according to pointed datamember. 00094 // If there is no datamember field assigned to this methodarg - returns 0. 00095 00096 return (TList*)(fDataMember ? fDataMember->GetOptions() : 0); 00097 } 00098 00099 //______________________________________________________________________________ 00100 TDataMember *TMethodArg::GetDataMember() const 00101 { 00102 // Returns TDataMember pointed by this methodarg. 00103 // If you want to specify list of options or current value for your 00104 // MethodArg (i.e. it is used as initial values in argument-asking dialogs 00105 // popped up from context-meny),you can get this value from one of data 00106 // members of the class. 00107 // The only restriction is, that this DataMember object must have its 00108 // Getter/Setter methods set-up correctly - for details look at TDataMember. 00109 // To learn how to specify the data member to which the argument should 00110 // "point", look at TMethod. This is TMethod which sets up fDataMember, 00111 // so it could work correctly. 00112 00113 return fDataMember; 00114 } 00115