00001 #ifndef _FUNCTIONDEFINITION_H_ 00002 #define _FUNCTIONDEFINITION_H_ 00003 // 00004 00005 // 00006 // Copyright (C) 2004-2006 Autodesk, Inc. 00007 // 00008 // This library is free software; you can redistribute it and/or 00009 // modify it under the terms of version 2.1 of the GNU Lesser 00010 // General Public License as published by the Free Software Foundation. 00011 // 00012 // This library is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 // Lesser General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU Lesser General Public 00018 // License along with this library; if not, write to the Free Software 00019 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00020 // 00021 00022 #ifdef _WIN32 00023 #pragma once 00024 #endif 00025 00026 #include <FdoStd.h> 00027 #include <Fdo/Schema/PropertyType.h> 00028 #include <Fdo/Connections/Capabilities/ArgumentDefinition.h> 00029 #include <Fdo/Connections/Capabilities/ReadOnlyArgumentDefinitionCollection.h> 00030 #include <Fdo/Connections/Capabilities/SignatureDefinition.h> 00031 #include <Fdo/Connections/Capabilities/FunctionCategoryType.h> 00032 00033 /// \brief 00034 /// The FdoFunctionDefinition class contains metadata that describes a function and its arguments. 00035 class FdoFunctionDefinition : public FdoIDisposable 00036 { 00037 00038 /// \cond DOXYGEN-IGNORE 00039 00040 protected: 00041 00042 /// Constructs an instance of an FdoFunctionDefinition using the specified arguments. 00043 FdoFunctionDefinition (FdoString *name, 00044 FdoString *description, 00045 FdoDataType returnType, 00046 FdoArgumentDefinitionCollection *arguments, 00047 FdoFunctionCategoryType functionCategoryType); 00048 00049 /// Constructs an instance of an FdoFunctionDefinition using the specified arguments. 00050 FdoFunctionDefinition (FdoString *name, 00051 FdoString *description, 00052 FdoPropertyType returnPropertyType, 00053 FdoDataType returnType, 00054 FdoArgumentDefinitionCollection *arguments, 00055 FdoFunctionCategoryType functionCategoryType); 00056 00057 /// Constructs an instance of an FdoFunctionDefinition using the specified arguments. 00058 FdoFunctionDefinition (FdoString *name, 00059 FdoString *description, 00060 bool isAggregate, 00061 FdoSignatureDefinitionCollection *signatures, 00062 FdoFunctionCategoryType functionCategoryType); 00063 00064 /// Constructs an instance of an FdoFunctionDefinition using default values. 00065 FdoFunctionDefinition(); 00066 00067 virtual ~FdoFunctionDefinition(); 00068 00069 virtual void Dispose(); 00070 00071 /// \endcond 00072 00073 public: 00074 00075 /// \brief 00076 /// Constructs an instance of an FdoFunctionDefinition using the specified arguments. 00077 /// 00078 /// \param name 00079 /// Input the name of the function. 00080 /// \param description 00081 /// Input a brief description. 00082 /// \param returnType 00083 /// Input the function return type 00084 /// \param arguments 00085 /// Input the argument definition list 00086 /// \param functionCategoryType 00087 /// Input the category the function belongs to. If not specified the function is 00088 /// categorized as unspecified. Valid values for this parameter are defined in the 00089 /// enumeration FdoFunctionCategoryType. 00090 /// 00091 /// \return 00092 /// Returns FdoFunctionDefinition 00093 /// 00094 FDO_API static FdoFunctionDefinition *Create (FdoString *name, 00095 FdoString *description, 00096 FdoDataType returnType, 00097 FdoArgumentDefinitionCollection *arguments, 00098 FdoFunctionCategoryType functionCategoryType = FdoFunctionCategoryType_Unspecified); 00099 00100 /// \brief 00101 /// Constructs an instance of an FdoFunctionDefinition using the specified arguments. 00102 /// 00103 /// \param name 00104 /// Input the name of the function. 00105 /// \param description 00106 /// Input a brief description. 00107 /// \param returnPropertyType 00108 /// Input the function return property type 00109 /// \param returnType 00110 /// Input the function return data type (ignore it property type is not data) 00111 /// \param arguments 00112 /// Input the argument definition list 00113 /// \param functionCategoryType 00114 /// Input the category the function belongs to. If not specified the function is 00115 /// categorized as unspecified. Valid values for this parameter are defined in the 00116 /// enumeration FdoFunctionCategoryType. 00117 /// 00118 /// \return 00119 /// Returns FdoFunctionDefinition 00120 /// 00121 FDO_API static FdoFunctionDefinition *Create (FdoString *name, 00122 FdoString *description, 00123 FdoPropertyType returnPropertyType, 00124 FdoDataType returnType, 00125 FdoArgumentDefinitionCollection *arguments, 00126 FdoFunctionCategoryType functionCategoryType = FdoFunctionCategoryType_Unspecified); 00127 00128 /// \brief 00129 /// Constructs an instance of an FdoFunctionDefinition using the specified arguments. 00130 /// 00131 /// \param name 00132 /// Input the name of the function. 00133 /// \param description 00134 /// Input a brief description. 00135 /// \param isAggregate 00136 /// Input a flag indicating whether or not this is an aggregate function. 00137 /// \param signatures 00138 /// Input the list of possible function signatures 00139 /// \param functionCategoryType 00140 /// Input the category the function belongs to. If not specified the function is 00141 /// categorized as unspecified. Valid values for this parameter are defined in the 00142 /// enumeration FdoFunctionCategoryType. 00143 /// 00144 /// \return 00145 /// Returns FdoFunctionDefinition 00146 /// 00147 FDO_API static FdoFunctionDefinition *Create (FdoString *name, 00148 FdoString *description, 00149 bool isAggregate, 00150 FdoSignatureDefinitionCollection *signatures, 00151 FdoFunctionCategoryType functionCategoryType = FdoFunctionCategoryType_Unspecified); 00152 00153 /// \brief 00154 /// Gets the name of the function. 00155 /// 00156 /// \return 00157 /// Returns the name of the function 00158 /// 00159 FDO_API FdoString *GetName(); 00160 00161 /// \brief 00162 /// Gets a brief description of the function. 00163 /// 00164 /// \return 00165 /// Returns the description of the function 00166 /// 00167 FDO_API FdoString *GetDescription(); 00168 00169 /// \brief 00170 /// Gets an array of FdoArgumentDefinition objects required for the function. 00171 /// 00172 /// \return 00173 /// Returns the list of argument definitions 00174 /// 00175 FDO_API FdoReadOnlyArgumentDefinitionCollection *GetArguments(); 00176 00177 /// \brief 00178 /// Gets the FdoPropertyType of the function return value. 00179 /// 00180 /// \return 00181 /// Returns the function return property type 00182 /// 00183 FDO_API FdoPropertyType GetReturnPropertyType(); 00184 00185 /// \brief 00186 /// Gets the FdoDataType of the function return value. This is only valid if 00187 /// the function return property type is FdoPropertyType_DataProperty. 00188 /// 00189 /// \return 00190 /// Returns the function return data type 00191 /// 00192 FDO_API FdoDataType GetReturnType(); 00193 00194 /// \brief 00195 /// Indicates that this object allows its name 00196 /// to change. This function is defined so that this class can 00197 /// be a FdoNamedCollection element. 00198 /// 00199 /// \return 00200 /// Returns false 00201 /// 00202 FDO_API virtual FdoBoolean CanSetName() 00203 { 00204 return false; 00205 } 00206 00207 /// 00208 /// \brief 00209 /// Gets an array of FdoSignatureDefinition objects that describe the different signatures 00210 /// supported by the function. 00211 /// 00212 FDO_API FdoReadOnlySignatureDefinitionCollection *GetSignatures(); 00213 00214 /// 00215 /// \brief 00216 /// Returns true if the function is an aggregate function and false if it is a simple function. 00217 FDO_API bool IsAggregate(); 00218 00219 /// \brief 00220 /// Returns the category for the function described in the current function 00221 /// definition. 00222 /// 00223 /// \return 00224 /// Returns the category for the function described in the current function 00225 /// 00226 FDO_API virtual FdoFunctionCategoryType GetFunctionCategoryType () 00227 { 00228 return m_functionCategoryType; 00229 } 00230 00231 protected: 00232 bool m_isAggregate; 00233 wchar_t *m_name; 00234 wchar_t *m_description; 00235 FdoReadOnlySignatureDefinitionCollection *m_signatures; 00236 FdoFunctionCategoryType m_functionCategoryType; 00237 00238 }; 00239 00240 #endif 00241 00242