VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkParseData.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00015 /*------------------------------------------------------------------------- 00016 Copyright (c) 2010 David Gobbi. 00017 00018 Contributed to the VisualizationToolkit by the author in May 2010 00019 under the terms of the Visualization Toolkit 2008 copyright. 00020 -------------------------------------------------------------------------*/ 00021 00022 /* 00023 Data structures used by vtkParse. 00024 */ 00025 00026 #ifndef VTK_PARSE_DATA_H 00027 #define VTK_PARSE_DATA_H 00028 00029 #include "vtkParseType.h" 00030 #include "vtkParseString.h" 00031 00032 /* legacy */ 00033 #ifndef VTK_PARSE_LEGACY_REMOVE 00034 #define MAX_ARGS 20 00035 #endif 00036 00040 typedef enum _parse_access_t 00041 { 00042 VTK_ACCESS_PUBLIC = 0, 00043 VTK_ACCESS_PROTECTED = 1, 00044 VTK_ACCESS_PRIVATE = 2 00045 } parse_access_t; 00046 00050 typedef enum _parse_item_t 00051 { 00052 VTK_NAMESPACE_INFO = 1, 00053 VTK_CLASS_INFO = 2, 00054 VTK_STRUCT_INFO = 3, 00055 VTK_UNION_INFO = 4, 00056 VTK_ENUM_INFO = 5, 00057 VTK_FUNCTION_INFO = 6, 00058 VTK_VARIABLE_INFO = 7, 00059 VTK_CONSTANT_INFO = 8, 00060 VTK_TYPEDEF_INFO = 9, 00061 VTK_USING_INFO = 10 00062 } parse_item_t; 00063 00067 typedef struct _ItemInfo 00068 { 00069 parse_item_t Type; 00070 int Index; 00071 } ItemInfo; 00072 00073 /* forward declarations */ 00074 struct _ValueInfo; 00075 struct _FunctionInfo; 00076 struct _FileInfo; 00077 typedef struct _ValueInfo ValueInfo; 00078 typedef struct _FunctionInfo FunctionInfo; 00079 typedef struct _FileInfo FileInfo; 00080 00084 typedef struct _TemplateInfo 00085 { 00086 int NumberOfParameters; 00087 ValueInfo **Parameters; 00088 } TemplateInfo; 00089 00098 struct _ValueInfo 00099 { 00100 parse_item_t ItemType; 00101 parse_access_t Access; 00102 const char *Name; 00103 const char *Comment; 00104 const char *Value; /* for vars or default paramter values */ 00105 unsigned int Type; /* as defined in vtkParseType.h */ 00106 const char *Class; /* classname for type */ 00107 int Count; /* total number of values, if known */ 00108 const char *CountHint; /* hint about how to get the count */ 00109 int NumberOfDimensions; /* dimensionality for arrays */ 00110 const char **Dimensions; /* dimensions for arrays */ 00111 FunctionInfo *Function; /* for function pointer values */ 00112 TemplateInfo *Template; /* template parameters, or NULL */ 00113 int IsStatic; /* for class variables only */ 00114 int IsEnum; /* for constants only */ 00115 }; 00116 00120 struct _FunctionInfo 00121 { 00122 parse_item_t ItemType; 00123 parse_access_t Access; 00124 const char *Name; 00125 const char *Comment; 00126 const char *Class; /* class name for methods */ 00127 const char *Signature; /* function signature as text */ 00128 TemplateInfo *Template; /* template parameters, or NULL */ 00129 int NumberOfParameters; 00130 ValueInfo **Parameters; 00131 ValueInfo *ReturnValue; /* NULL for constructors and destructors */ 00132 const char *Macro; /* the macro that defined this function */ 00133 const char *SizeHint; /* hint the size e.g. for operator[] */ 00134 int IsOperator; 00135 int IsVariadic; 00136 int IsLegacy; /* marked as a legacy method or function */ 00137 int IsStatic; /* methods only */ 00138 int IsVirtual; /* methods only */ 00139 int IsPureVirtual; /* methods only */ 00140 int IsConst; /* methods only */ 00141 int IsExplicit; /* constructors only */ 00142 #ifndef VTK_PARSE_LEGACY_REMOVE 00143 int NumberOfArguments; /* legacy */ 00144 unsigned int ArgTypes[MAX_ARGS]; /* legacy */ 00145 const char *ArgClasses[MAX_ARGS];/* legacy */ 00146 int ArgCounts[MAX_ARGS]; /* legacy */ 00147 unsigned int ReturnType; /* legacy */ 00148 const char *ReturnClass; /* legacy */ 00149 int HaveHint; /* legacy */ 00150 int HintSize; /* legacy */ 00151 int ArrayFailure;/* legacy */ 00152 int IsPublic; /* legacy */ 00153 int IsProtected; /* legacy */ 00154 #endif 00155 }; 00156 00161 typedef struct _EnumInfo 00162 { 00163 parse_item_t ItemType; 00164 parse_access_t Access; 00165 const char *Name; 00166 const char *Comment; 00167 } EnumInfo; 00168 00172 typedef struct _UsingInfo 00173 { 00174 parse_item_t ItemType; 00175 parse_access_t Access; 00176 const char *Name; /* null for using whole namespace */ 00177 const char *Comment; 00178 const char *Scope; /* the namespace or class */ 00179 } UsingInfo; 00180 00184 typedef struct _ClassInfo 00185 { 00186 parse_item_t ItemType; 00187 parse_access_t Access; 00188 const char *Name; 00189 const char *Comment; 00190 TemplateInfo *Template; 00191 int NumberOfSuperClasses; 00192 const char **SuperClasses; 00193 int NumberOfItems; 00194 ItemInfo *Items; 00195 int NumberOfClasses; 00196 struct _ClassInfo **Classes; 00197 int NumberOfFunctions; 00198 FunctionInfo **Functions; 00199 int NumberOfConstants; 00200 ValueInfo **Constants; 00201 int NumberOfVariables; 00202 ValueInfo **Variables; 00203 int NumberOfEnums; 00204 EnumInfo **Enums; 00205 int NumberOfTypedefs; 00206 ValueInfo **Typedefs; 00207 int NumberOfUsings; 00208 UsingInfo **Usings; 00209 int NumberOfNamespaces; 00210 struct _ClassInfo **Namespaces; 00211 int IsAbstract; 00212 int HasDelete; 00213 } ClassInfo; 00214 00218 typedef struct _ClassInfo NamespaceInfo; 00219 00223 struct _FileInfo 00224 { 00225 const char *FileName; 00226 const char *NameComment; 00227 const char *Description; 00228 const char *Caveats; 00229 const char *SeeAlso; 00230 00231 int NumberOfIncludes; 00232 struct _FileInfo **Includes; 00233 ClassInfo *MainClass; 00234 NamespaceInfo *Contents; 00235 StringCache *Strings; 00236 }; 00237 00238 00239 #ifdef __cplusplus 00240 extern "C" { 00241 #endif 00242 00247 void vtkParse_InitFile(FileInfo *file_info); 00248 void vtkParse_InitNamespace(NamespaceInfo *namespace_info); 00249 void vtkParse_InitClass(ClassInfo *cls); 00250 void vtkParse_InitFunction(FunctionInfo *func); 00251 void vtkParse_InitValue(ValueInfo *val); 00252 void vtkParse_InitEnum(EnumInfo *item); 00253 void vtkParse_InitUsing(UsingInfo *item); 00254 void vtkParse_InitTemplate(TemplateInfo *arg); 00263 void vtkParse_CopyNamespace(NamespaceInfo *data, const NamespaceInfo *orig); 00264 void vtkParse_CopyClass(ClassInfo *data, const ClassInfo *orig); 00265 void vtkParse_CopyFunction(FunctionInfo *data, const FunctionInfo *orig); 00266 void vtkParse_CopyValue(ValueInfo *data, const ValueInfo *orig); 00267 void vtkParse_CopyEnum(EnumInfo *data, const EnumInfo *orig); 00268 void vtkParse_CopyUsing(UsingInfo *data, const UsingInfo *orig); 00269 void vtkParse_CopyTemplate(TemplateInfo *data, const TemplateInfo *orig); 00278 void vtkParse_FreeFile(FileInfo *file_info); 00279 void vtkParse_FreeNamespace(NamespaceInfo *namespace_info); 00280 void vtkParse_FreeClass(ClassInfo *cls); 00281 void vtkParse_FreeFunction(FunctionInfo *func); 00282 void vtkParse_FreeValue(ValueInfo *val); 00283 void vtkParse_FreeEnum(EnumInfo *item); 00284 void vtkParse_FreeUsing(UsingInfo *item); 00285 void vtkParse_FreeTemplate(TemplateInfo *arg); 00292 void vtkParse_AddStringToArray( 00293 const char ***valueArray, int *count, const char *value); 00294 00298 void vtkParse_AddItemToArray( 00299 ItemInfo **valueArray, int *count, parse_item_t type, int idx); 00300 00301 00306 void vtkParse_AddIncludeToFile(FileInfo *info, FileInfo *item); 00307 void vtkParse_AddClassToClass(ClassInfo *info, ClassInfo *item); 00308 void vtkParse_AddFunctionToClass(ClassInfo *info, FunctionInfo *item); 00309 void vtkParse_AddEnumToClass(ClassInfo *info, EnumInfo *item); 00310 void vtkParse_AddConstantToClass(ClassInfo *info, ValueInfo *item); 00311 void vtkParse_AddVariableToClass(ClassInfo *info, ValueInfo *item); 00312 void vtkParse_AddTypedefToClass(ClassInfo *info, ValueInfo *item); 00313 void vtkParse_AddUsingToClass(ClassInfo *info, UsingInfo *item); 00314 void vtkParse_AddNamespaceToNamespace(NamespaceInfo *info,NamespaceInfo *item); 00315 void vtkParse_AddClassToNamespace(NamespaceInfo *info, ClassInfo *item); 00316 void vtkParse_AddFunctionToNamespace(NamespaceInfo *info, FunctionInfo *item); 00317 void vtkParse_AddEnumToNamespace(NamespaceInfo *info, EnumInfo *item); 00318 void vtkParse_AddConstantToNamespace(NamespaceInfo *info, ValueInfo *item); 00319 void vtkParse_AddVariableToNamespace(NamespaceInfo *info, ValueInfo *item); 00320 void vtkParse_AddTypedefToNamespace(NamespaceInfo *info, ValueInfo *item); 00321 void vtkParse_AddUsingToNamespace(NamespaceInfo *info, UsingInfo *item); 00322 void vtkParse_AddParameterToFunction(FunctionInfo *info, ValueInfo *item); 00323 void vtkParse_AddParameterToTemplate(TemplateInfo *info, ValueInfo *item); 00329 void vtkParse_AddDefaultConstructors(ClassInfo *data, StringCache *cache); 00330 00331 #ifdef __cplusplus 00332 } /* extern "C" */ 00333 #endif 00334 00335 #endif