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 int IsPack; /* for pack expansions */ 00116 }; 00117 00121 struct _FunctionInfo 00122 { 00123 parse_item_t ItemType; 00124 parse_access_t Access; 00125 const char *Name; 00126 const char *Comment; 00127 const char *Class; /* class name for methods */ 00128 const char *Signature; /* function signature as text */ 00129 TemplateInfo *Template; /* template parameters, or NULL */ 00130 int NumberOfParameters; 00131 ValueInfo **Parameters; 00132 ValueInfo *ReturnValue; /* NULL for constructors and destructors */ 00133 const char *Macro; /* the macro that defined this function */ 00134 const char *SizeHint; /* hint the size e.g. for operator[] */ 00135 int IsOperator; 00136 int IsVariadic; 00137 int IsLegacy; /* marked as a legacy method or function */ 00138 int IsStatic; /* methods only */ 00139 int IsVirtual; /* methods only */ 00140 int IsPureVirtual; /* methods only */ 00141 int IsConst; /* methods only */ 00142 int IsDeleted; /* methods only */ 00143 int IsFinal; /* methods only */ 00144 int IsExplicit; /* constructors only */ 00145 #ifndef VTK_PARSE_LEGACY_REMOVE 00146 int NumberOfArguments; /* legacy */ 00147 unsigned int ArgTypes[MAX_ARGS]; /* legacy */ 00148 const char *ArgClasses[MAX_ARGS];/* legacy */ 00149 int ArgCounts[MAX_ARGS]; /* legacy */ 00150 unsigned int ReturnType; /* legacy */ 00151 const char *ReturnClass; /* legacy */ 00152 int HaveHint; /* legacy */ 00153 int HintSize; /* legacy */ 00154 int ArrayFailure;/* legacy */ 00155 int IsPublic; /* legacy */ 00156 int IsProtected; /* legacy */ 00157 #endif 00158 }; 00159 00163 typedef struct _UsingInfo 00164 { 00165 parse_item_t ItemType; 00166 parse_access_t Access; 00167 const char *Name; /* null for using whole namespace */ 00168 const char *Comment; 00169 const char *Scope; /* the namespace or class */ 00170 } UsingInfo; 00171 00175 typedef struct _ClassInfo 00176 { 00177 parse_item_t ItemType; 00178 parse_access_t Access; 00179 const char *Name; 00180 const char *Comment; 00181 TemplateInfo *Template; 00182 int NumberOfSuperClasses; 00183 const char **SuperClasses; 00184 int NumberOfItems; 00185 ItemInfo *Items; 00186 int NumberOfClasses; 00187 struct _ClassInfo **Classes; 00188 int NumberOfFunctions; 00189 FunctionInfo **Functions; 00190 int NumberOfConstants; 00191 ValueInfo **Constants; 00192 int NumberOfVariables; 00193 ValueInfo **Variables; 00194 int NumberOfEnums; 00195 struct _ClassInfo **Enums; 00196 int NumberOfTypedefs; 00197 ValueInfo **Typedefs; 00198 int NumberOfUsings; 00199 UsingInfo **Usings; 00200 int NumberOfNamespaces; 00201 struct _ClassInfo **Namespaces; 00202 int IsAbstract; 00203 int IsFinal; 00204 int HasDelete; 00205 } ClassInfo; 00206 00212 typedef struct _ClassInfo EnumInfo; 00213 00217 typedef struct _ClassInfo NamespaceInfo; 00218 00222 struct _FileInfo 00223 { 00224 const char *FileName; 00225 const char *NameComment; 00226 const char *Description; 00227 const char *Caveats; 00228 const char *SeeAlso; 00229 00230 int NumberOfIncludes; 00231 struct _FileInfo **Includes; 00232 ClassInfo *MainClass; 00233 NamespaceInfo *Contents; 00234 StringCache *Strings; 00235 }; 00236 00237 00238 #ifdef __cplusplus 00239 extern "C" { 00240 #endif 00241 00246 void vtkParse_InitFile(FileInfo *file_info); 00247 void vtkParse_InitNamespace(NamespaceInfo *namespace_info); 00248 void vtkParse_InitClass(ClassInfo *cls); 00249 void vtkParse_InitFunction(FunctionInfo *func); 00250 void vtkParse_InitValue(ValueInfo *val); 00251 void vtkParse_InitEnum(EnumInfo *item); 00252 void vtkParse_InitUsing(UsingInfo *item); 00253 void vtkParse_InitTemplate(TemplateInfo *arg); 00262 void vtkParse_CopyNamespace(NamespaceInfo *data, const NamespaceInfo *orig); 00263 void vtkParse_CopyClass(ClassInfo *data, const ClassInfo *orig); 00264 void vtkParse_CopyFunction(FunctionInfo *data, const FunctionInfo *orig); 00265 void vtkParse_CopyValue(ValueInfo *data, const ValueInfo *orig); 00266 void vtkParse_CopyEnum(EnumInfo *data, const EnumInfo *orig); 00267 void vtkParse_CopyUsing(UsingInfo *data, const UsingInfo *orig); 00268 void vtkParse_CopyTemplate(TemplateInfo *data, const TemplateInfo *orig); 00277 void vtkParse_FreeFile(FileInfo *file_info); 00278 void vtkParse_FreeNamespace(NamespaceInfo *namespace_info); 00279 void vtkParse_FreeClass(ClassInfo *cls); 00280 void vtkParse_FreeFunction(FunctionInfo *func); 00281 void vtkParse_FreeValue(ValueInfo *val); 00282 void vtkParse_FreeEnum(EnumInfo *item); 00283 void vtkParse_FreeUsing(UsingInfo *item); 00284 void vtkParse_FreeTemplate(TemplateInfo *arg); 00291 void vtkParse_AddStringToArray( 00292 const char ***valueArray, int *count, const char *value); 00293 00297 void vtkParse_AddItemToArray( 00298 ItemInfo **valueArray, int *count, parse_item_t type, int idx); 00299 00300 00305 void vtkParse_AddIncludeToFile(FileInfo *info, FileInfo *item); 00306 void vtkParse_AddClassToClass(ClassInfo *info, ClassInfo *item); 00307 void vtkParse_AddFunctionToClass(ClassInfo *info, FunctionInfo *item); 00308 void vtkParse_AddEnumToClass(ClassInfo *info, EnumInfo *item); 00309 void vtkParse_AddConstantToClass(ClassInfo *info, ValueInfo *item); 00310 void vtkParse_AddVariableToClass(ClassInfo *info, ValueInfo *item); 00311 void vtkParse_AddTypedefToClass(ClassInfo *info, ValueInfo *item); 00312 void vtkParse_AddUsingToClass(ClassInfo *info, UsingInfo *item); 00313 void vtkParse_AddNamespaceToNamespace(NamespaceInfo *info,NamespaceInfo *item); 00314 void vtkParse_AddClassToNamespace(NamespaceInfo *info, ClassInfo *item); 00315 void vtkParse_AddFunctionToNamespace(NamespaceInfo *info, FunctionInfo *item); 00316 void vtkParse_AddEnumToNamespace(NamespaceInfo *info, EnumInfo *item); 00317 void vtkParse_AddConstantToNamespace(NamespaceInfo *info, ValueInfo *item); 00318 void vtkParse_AddVariableToNamespace(NamespaceInfo *info, ValueInfo *item); 00319 void vtkParse_AddTypedefToNamespace(NamespaceInfo *info, ValueInfo *item); 00320 void vtkParse_AddUsingToNamespace(NamespaceInfo *info, UsingInfo *item); 00321 void vtkParse_AddParameterToFunction(FunctionInfo *info, ValueInfo *item); 00322 void vtkParse_AddParameterToTemplate(TemplateInfo *info, ValueInfo *item); 00328 void vtkParse_AddDefaultConstructors(ClassInfo *data, StringCache *cache); 00329 00330 #ifdef __cplusplus 00331 } /* extern "C" */ 00332 #endif 00333 00334 #endif