VTK
vtkParseExtras.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkParseExtras.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) 2011 David Gobbi.
17 
18  Contributed to the VisualizationToolkit by the author in May 2011
19  under the terms of the Visualization Toolkit 2008 copyright.
20 -------------------------------------------------------------------------*/
21 
26 #ifndef vtkParseExtras_h
27 #define vtkParseExtras_h
28 
29 #include "vtkParseData.h"
30 #include <stddef.h>
31 
32 /* Flags for selecting what info to print for declarations */
33 #define VTK_PARSE_NAMES 0x00000010
34 #define VTK_PARSE_VALUES 0x00000020
35 #define VTK_PARSE_RETURN_VALUE 0x00000040
36 #define VTK_PARSE_PARAMETER_LIST 0x00000080
37 #define VTK_PARSE_SPECIFIERS 0x00FF0000
38 #define VTK_PARSE_TRAILERS 0x0F000000
39 #define VTK_PARSE_TEMPLATES 0xF0000000
40 #define VTK_PARSE_EVERYTHING 0xFFFFFFFF
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
51 size_t vtkParse_IdentifierLength(const char *text);
52 
59 size_t vtkParse_NameLength(const char *text);
60 
66 size_t vtkParse_UnscopedNameLength(const char *text);
67 
73 size_t vtkParse_LiteralLength(const char *text);
74 
84  const char *text, unsigned int *type,
85  const char **classname, size_t *classname_len);
86 
93  ValueInfo *val, StringCache *cache, const char *text);
94 
113  ValueInfo *data, char *text, unsigned int flags);
114 
123  FunctionInfo *func, char *text, unsigned int flags);
124 
131  TemplateInfo *func, char *text, unsigned int flags);
132 
144  const FunctionInfo *func1, const FunctionInfo *func2);
145 
150 void vtkParse_ExpandTypedef(ValueInfo *valinfo, ValueInfo *typedefinfo);
151 
157  ValueInfo *valinfo, StringCache *cache,
158  int n, const char *name[], const char *val[],
159  ValueInfo *typedefinfo[]);
160 
167  ValueInfo *valinfo, StringCache *cache,
168  int n, const char *name[], const char *val[]);
169 
173 const char *vtkParse_StringReplace(
174  const char *str1, int n, const char *name[], const char *val[]);
175 
182  const char *text, const char **classname,
183  int n, const char ***args, const char *defaults[]);
184 
189  const char *classname, int n, const char **args);
190 
199  ClassInfo *data, StringCache *cache, int n, const char *args[]);
200 
209  FunctionInfo *data, int n, const char *args[]);
210 
214 const char **vtkParse_GetTemplateMacroTypes();
215 
219 const char **vtkParse_GetArrayTypes();
220 
221 
222 #ifdef __cplusplus
223 } /* extern "C" */
224 #endif
225 
226 #endif
void vtkParse_ExpandTypedefs(ValueInfo *valinfo, StringCache *cache, int n, const char *name[], const char *val[], ValueInfo *typedefinfo[])
Expand any unrecognized types within a variable, parameter, or typedef that match any of the supplied...
void vtkParse_InstantiateClassTemplate(ClassInfo *data, StringCache *cache, int n, const char *args[])
Instantiate a class template by substituting the provided arguments for the template parameters...
void vtkParse_ExpandValues(ValueInfo *valinfo, StringCache *cache, int n, const char *name[], const char *val[])
Wherever one of the specified names exists inside a Value or inside a Dimension size, replace it with the corresponding val string.
size_t vtkParse_ValueInfoToString(ValueInfo *data, char *text, unsigned int flags)
Generate a C++ declaration string from a ValueInfo struct.
size_t vtkParse_NameLength(const char *text)
Skip over a name, including any namespace prefixes and any template arguments.
int vtkParse_CompareFunctionSignature(const FunctionInfo *func1, const FunctionInfo *func2)
Compare two C++ functions to see if they have the same signature.
void vtkParse_IntantiateFunctionTemplate(FunctionInfo *data, int n, const char *args[])
Instantiate a function or class method template by substituting the provided arguments for the templa...
size_t vtkParse_BasicTypeFromString(const char *text, unsigned int *type, const char **classname, size_t *classname_len)
Get a type from a type name, and return the number of characters used.
const char * vtkParse_StringReplace(const char *str1, int n, const char *name[], const char *val[])
Search and replace, return the initial string if no replacements occurred, else return a new string a...
void vtkParse_ExpandTypedef(ValueInfo *valinfo, ValueInfo *typedefinfo)
Expand a typedef within a variable, parameter, or typedef declaration.
size_t vtkParse_TemplateInfoToString(TemplateInfo *func, char *text, unsigned int flags)
Generate a C++ template declaration from a TemplateInfo struct.
const char ** vtkParse_GetArrayTypes()
Get a zero-terminated array of the types in vtkArray.
size_t vtkParse_ValueInfoFromString(ValueInfo *val, StringCache *cache, const char *text)
Generate a ValueInfo by parsing the type from the provided text.
ValueInfo is for typedefs, constants, variables, function parameters, and return values.
Definition: vtkParseData.h:98
FunctionInfo is for functions and methods.
Definition: vtkParseData.h:121
size_t vtkParse_IdentifierLength(const char *text)
Skip over a sequence of characters that begin with an alphabetic character or an underscore, and include only alphanumeric characters or underscores.
void vtkParse_FreeTemplateDecomposition(const char *classname, int n, const char **args)
Free the list of strings returned by ExtractTemplateArgs.
ClassInfo is for classes, structs, unions, and namespaces.
Definition: vtkParseData.h:175
StringCache provides a simple way of allocating strings centrally.
size_t vtkParse_LiteralLength(const char *text)
Skip over a literal, which may be a number, a char in single quotes, a string in double quotes...
size_t vtkParse_UnscopedNameLength(const char *text)
Skip over a name, including any template arguments, but stopping if a '::' is encoutered.
size_t vtkParse_DecomposeTemplatedType(const char *text, const char **classname, int n, const char ***args, const char *defaults[])
Extract the class name and template args from a templated class type ID.
TemplateInfo holds template definitions.
Definition: vtkParseData.h:84
const char ** vtkParse_GetTemplateMacroTypes()
Get a zero-terminated array of the types in vtkTemplateMacro.
size_t vtkParse_FunctionInfoToString(FunctionInfo *func, char *text, unsigned int flags)
Generate a C++ function signature from a FunctionInfo struct.