]> SALOME platform Git repositories - modules/paravis.git/blob - src/VTKWrapping/ParaView/vtkParseData.h
Salome HOME
Synchronize adm files
[modules/paravis.git] / src / VTKWrapping / ParaView / vtkParseData.h
1 /*=========================================================================
2
3   Program:   Visualization Toolkit
4   Module:    vtkParseData.h
5
6   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7   All rights reserved.
8   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10      This software is distributed WITHOUT ANY WARRANTY; without even
11      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12      PURPOSE.  See the above copyright notice for more information.
13
14 =========================================================================*/
15 /*-------------------------------------------------------------------------
16   Copyright (c) 2010 David Gobbi.
17
18   Contributed to the VisualizationToolkit by the author in May 2010
19   under the terms of the Visualization Toolkit 2008 copyright.
20 -------------------------------------------------------------------------*/
21
22 /*
23   Data structures used by vtkParse.
24 */
25
26 #ifndef VTK_PARSE_DATA_H
27 #define VTK_PARSE_DATA_H
28
29 #include "vtkParseType.h"
30 #include "vtkParseString.h"
31
32 /* legacy */
33 #ifndef VTK_PARSE_LEGACY_REMOVE
34 #define MAX_ARGS 20
35 #endif
36
37 /**
38  * Access flags
39  */
40 typedef enum _parse_access_t
41 {
42   VTK_ACCESS_PUBLIC    = 0,
43   VTK_ACCESS_PROTECTED = 1,
44   VTK_ACCESS_PRIVATE   = 2
45 } parse_access_t;
46
47 /**
48  * ItemType constants
49  */
50 typedef enum _parse_item_t
51 {
52   VTK_NAMESPACE_INFO = 1,
53   VTK_CLASS_INFO     = 2,
54   VTK_STRUCT_INFO    = 3,
55   VTK_UNION_INFO     = 4,
56   VTK_ENUM_INFO      = 5,
57   VTK_FUNCTION_INFO  = 6,
58   VTK_VARIABLE_INFO  = 7,
59   VTK_CONSTANT_INFO  = 8,
60   VTK_TYPEDEF_INFO   = 9,
61   VTK_USING_INFO     = 10
62 } parse_item_t;
63
64 /**
65  * ItemInfo just contains an index
66  */
67 typedef struct _ItemInfo
68 {
69   parse_item_t   Type;
70   int            Index;
71 } ItemInfo;
72
73 /* forward declarations */
74 struct _ValueInfo;
75 struct _FunctionInfo;
76 struct _FileInfo;
77 typedef struct _ValueInfo ValueInfo;
78 typedef struct _FunctionInfo FunctionInfo;
79 typedef struct _FileInfo FileInfo;
80
81 /**
82  * TemplateInfo holds template definitions
83  */
84 typedef struct _TemplateInfo
85 {
86   int            NumberOfParameters;
87   ValueInfo    **Parameters;
88 } TemplateInfo;
89
90 /**
91  * ValueInfo is for typedefs, constants, variables,
92  * function parameters, and return values
93  *
94  * Note that Dimensions is an array of char pointers, in
95  * order to support dimensions that are sized according to
96  * template parameter values or according to named constants.
97  */
98 struct _ValueInfo
99 {
100   parse_item_t   ItemType;
101   parse_access_t Access;
102   const char    *Name;
103   const char    *Comment;
104   const char    *Value;      /* for vars or default paramter values */
105   unsigned int   Type;       /* as defined in vtkParseType.h   */
106   const char    *Class;      /* classname for type */
107   int            Count;      /* total number of values, if known */
108   const char    *CountHint;  /* hint about how to get the count */
109   int            NumberOfDimensions; /* dimensionality for arrays */
110   const char   **Dimensions; /* dimensions for arrays */
111   FunctionInfo  *Function;  /* for function pointer values */
112   TemplateInfo  *Template;   /* template parameters, or NULL */
113   int            IsStatic;   /* for class variables only */
114   int            IsEnum;     /* for constants only */
115   int            IsPack;     /* for pack expansions */
116 };
117
118 /**
119  * FunctionInfo is for functions and methods
120  */
121 struct _FunctionInfo
122 {
123   parse_item_t   ItemType;
124   parse_access_t Access;
125   const char    *Name;
126   const char    *Comment;
127   const char    *Class;       /* class name for methods */
128   const char    *Signature;   /* function signature as text */
129   TemplateInfo  *Template;    /* template parameters, or NULL */
130   int            NumberOfParameters;
131   ValueInfo    **Parameters;
132   ValueInfo     *ReturnValue; /* NULL for constructors and destructors */
133   const char    *Macro;       /* the macro that defined this function */
134   const char    *SizeHint;    /* hint the size e.g. for operator[] */
135   int            IsOperator;
136   int            IsVariadic;
137   int            IsLegacy;    /* marked as a legacy method or function */
138   int            IsStatic;    /* methods only */
139   int            IsVirtual;   /* methods only */
140   int            IsPureVirtual; /* methods only */
141   int            IsConst;     /* methods only */
142   int            IsDeleted;   /* methods only */
143   int            IsFinal;     /* methods only */
144   int            IsExplicit;  /* constructors only */
145 #ifndef VTK_PARSE_LEGACY_REMOVE
146   int            NumberOfArguments;   /* legacy */
147   unsigned int   ArgTypes[MAX_ARGS];  /* legacy */
148   const char    *ArgClasses[MAX_ARGS];/* legacy */
149   int            ArgCounts[MAX_ARGS]; /* legacy */
150   unsigned int   ReturnType;  /* legacy */
151   const char    *ReturnClass; /* legacy */
152   int            HaveHint;    /* legacy */
153   int            HintSize;    /* legacy */
154   int            ArrayFailure;/* legacy */
155   int            IsPublic;    /* legacy */
156   int            IsProtected; /* legacy */
157 #endif
158 };
159
160 /**
161  * UsingInfo is for using directives
162  */
163 typedef struct _UsingInfo
164 {
165   parse_item_t   ItemType;
166   parse_access_t Access;
167   const char    *Name;     /* null for using whole namespace */
168   const char    *Comment;
169   const char    *Scope;    /* the namespace or class */
170 } UsingInfo;
171
172 /**
173  * ClassInfo is for classes, structs, unions, and namespaces
174  */
175 typedef struct _ClassInfo
176 {
177   parse_item_t   ItemType;
178   parse_access_t Access;
179   const char    *Name;
180   const char    *Comment;
181   TemplateInfo  *Template;
182   int            NumberOfSuperClasses;
183   const char   **SuperClasses;
184   int            NumberOfItems;
185   ItemInfo      *Items;
186   int            NumberOfClasses;
187   struct _ClassInfo **Classes;
188   int            NumberOfFunctions;
189   FunctionInfo **Functions;
190   int            NumberOfConstants;
191   ValueInfo    **Constants;
192   int            NumberOfVariables;
193   ValueInfo    **Variables;
194   int            NumberOfEnums;
195   struct _ClassInfo **Enums;
196   int            NumberOfTypedefs;
197   ValueInfo    **Typedefs;
198   int            NumberOfUsings;
199   UsingInfo    **Usings;
200   int            NumberOfNamespaces;
201   struct _ClassInfo **Namespaces;
202   int            IsAbstract;
203   int            IsFinal;
204   int            HasDelete;
205 } ClassInfo;
206
207 /**
208  * EnumInfo is for enums
209  * For scoped enums, the constants are in the enum itself, but for
210  * standard enums, the constants are at the same level as the enum.
211  */
212 typedef struct _ClassInfo EnumInfo;
213
214 /**
215  * Namespace is for namespaces
216  */
217 typedef struct _ClassInfo NamespaceInfo;
218
219 /**
220  * FileInfo is for header files
221  */
222 struct _FileInfo
223 {
224   const char *FileName;
225   const char *NameComment;
226   const char *Description;
227   const char *Caveats;
228   const char *SeeAlso;
229
230   int NumberOfIncludes;
231   struct _FileInfo **Includes;
232   ClassInfo *MainClass;
233   NamespaceInfo *Contents;
234   StringCache *Strings;
235 };
236
237
238 #ifdef __cplusplus
239 extern "C" {
240 #endif
241
242 /**
243  * Initializer methods
244  */
245 /*@{*/
246 void vtkParse_InitFile(FileInfo *file_info);
247 void vtkParse_InitNamespace(NamespaceInfo *namespace_info);
248 void vtkParse_InitClass(ClassInfo *cls);
249 void vtkParse_InitFunction(FunctionInfo *func);
250 void vtkParse_InitValue(ValueInfo *val);
251 void vtkParse_InitEnum(EnumInfo *item);
252 void vtkParse_InitUsing(UsingInfo *item);
253 void vtkParse_InitTemplate(TemplateInfo *arg);
254 /*@}*/
255
256 /**
257  * Copy methods
258  *
259  * Strings are not deep-copied, they are assumed to be persistent.
260  */
261 /*@{*/
262 void vtkParse_CopyNamespace(NamespaceInfo *data, const NamespaceInfo *orig);
263 void vtkParse_CopyClass(ClassInfo *data, const ClassInfo *orig);
264 void vtkParse_CopyFunction(FunctionInfo *data, const FunctionInfo *orig);
265 void vtkParse_CopyValue(ValueInfo *data, const ValueInfo *orig);
266 void vtkParse_CopyEnum(EnumInfo *data, const EnumInfo *orig);
267 void vtkParse_CopyUsing(UsingInfo *data, const UsingInfo *orig);
268 void vtkParse_CopyTemplate(TemplateInfo *data, const TemplateInfo *orig);
269 /*@}*/
270
271 /**
272  * Free methods
273  *
274  * Strings are not freed, they are assumed to be persistent.
275  */
276 /*@{*/
277 void vtkParse_FreeFile(FileInfo *file_info);
278 void vtkParse_FreeNamespace(NamespaceInfo *namespace_info);
279 void vtkParse_FreeClass(ClassInfo *cls);
280 void vtkParse_FreeFunction(FunctionInfo *func);
281 void vtkParse_FreeValue(ValueInfo *val);
282 void vtkParse_FreeEnum(EnumInfo *item);
283 void vtkParse_FreeUsing(UsingInfo *item);
284 void vtkParse_FreeTemplate(TemplateInfo *arg);
285 /*@}*/
286
287
288 /**
289  * Add a string to an array of strings, grow array as necessary.
290  */
291 void vtkParse_AddStringToArray(
292   const char ***valueArray, int *count, const char *value);
293
294 /**
295  * Expand the Item array for classes and namespaces.
296  */
297 void vtkParse_AddItemToArray(
298   ItemInfo **valueArray, int *count, parse_item_t type, int idx);
299
300
301 /**
302  * Add various items to the structs.
303  */
304 /*@{*/
305 void vtkParse_AddIncludeToFile(FileInfo *info, FileInfo *item);
306 void vtkParse_AddClassToClass(ClassInfo *info, ClassInfo *item);
307 void vtkParse_AddFunctionToClass(ClassInfo *info, FunctionInfo *item);
308 void vtkParse_AddEnumToClass(ClassInfo *info, EnumInfo *item);
309 void vtkParse_AddConstantToClass(ClassInfo *info, ValueInfo *item);
310 void vtkParse_AddVariableToClass(ClassInfo *info, ValueInfo *item);
311 void vtkParse_AddTypedefToClass(ClassInfo *info, ValueInfo *item);
312 void vtkParse_AddUsingToClass(ClassInfo *info, UsingInfo *item);
313 void vtkParse_AddNamespaceToNamespace(NamespaceInfo *info,NamespaceInfo *item);
314 void vtkParse_AddClassToNamespace(NamespaceInfo *info, ClassInfo *item);
315 void vtkParse_AddFunctionToNamespace(NamespaceInfo *info, FunctionInfo *item);
316 void vtkParse_AddEnumToNamespace(NamespaceInfo *info, EnumInfo *item);
317 void vtkParse_AddConstantToNamespace(NamespaceInfo *info, ValueInfo *item);
318 void vtkParse_AddVariableToNamespace(NamespaceInfo *info, ValueInfo *item);
319 void vtkParse_AddTypedefToNamespace(NamespaceInfo *info, ValueInfo *item);
320 void vtkParse_AddUsingToNamespace(NamespaceInfo *info, UsingInfo *item);
321 void vtkParse_AddParameterToFunction(FunctionInfo *info, ValueInfo *item);
322 void vtkParse_AddParameterToTemplate(TemplateInfo *info, ValueInfo *item);
323 /*@}*/
324
325 /**
326  * Add default constructors to a class if they do not already exist
327  */
328 void vtkParse_AddDefaultConstructors(ClassInfo *data, StringCache *cache);
329
330 #ifdef __cplusplus
331 } /* extern "C" */
332 #endif
333
334 #endif