]> SALOME platform Git repositories - modules/paravis.git/blob - src/VTKWrapping/ParaView/vtkParseHierarchy.h
Salome HOME
Synchronize adm files
[modules/paravis.git] / src / VTKWrapping / ParaView / vtkParseHierarchy.h
1 /*=========================================================================
2
3   Program:   Visualization Toolkit
4   Module:    vtkParseHierarchy.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 June 2010
19   under the terms of the Visualization Toolkit 2008 copyright.
20 --------------------------------------------------------------------------*/
21
22 /**
23  This file contains utility functions for loading and parsing
24  a VTK hierarchy file.  The file contains entries like the
25  following (one per line in the file):
26
27  classname [ : superclass ] ; header.h ; vtkKit [; flags]
28
29  For each typedef, the output file will have a line like this:
30
31  name = &[2][3]* const type ; header.h ; vtkKit [; flags]
32
33  For each enum, the output file will have:
34
35  enumname : enum ; header.h ; vtkKit [; flags]
36
37 */
38
39 #ifndef VTK_PARSE_HIERARCHY_H
40 #define VTK_PARSE_HIERARCHY_H
41
42 /* Need the ValueInfo struct for typedefs */
43 #include "vtkParseData.h"
44
45 /**
46  * One entry from the hierarchy file.
47  * It contains a class name, the superclasses, and the header file.
48  */
49 typedef struct _HierarchyEntry
50 {
51   const char  *Name;            /* the class or type name */
52   const char  *HeaderFile;      /* header file the class is defined in */
53   const char  *Module;          /* library the class is defined in */
54   int          NumberOfTemplateParameters; /* number of template params */
55   const char **TemplateParameters;
56   const char **TemplateDefaults;
57   int          NumberOfProperties;   /* number of properties */
58   const char **Properties;
59   int          NumberOfSuperClasses; /* number of superclasses */
60   const char **SuperClasses;
61   int         *SuperClassIndex; /* for internal use only */
62   ValueInfo   *Typedef;         /* for typedefs */
63   int         IsEnum;           /* this entry is for an enum type */
64   int         IsTypedef;        /* this entry is for a typedef */
65 } HierarchyEntry;
66
67 /**
68  * All the entries from a hierarchy file.
69  */
70 typedef struct _HierarchyInfo
71 {
72   int             NumberOfEntries;
73   HierarchyEntry *Entries;
74   StringCache    *Strings;
75 } HierarchyInfo;
76
77 #ifdef __cplusplus
78 extern "C" {
79 #endif
80
81 /**
82  * Read a hierarchy file into a HeirarchyInfo struct, or return NULL
83  */
84 HierarchyInfo *vtkParseHierarchy_ReadFile(const char *filename);
85
86 /**
87  * Free a HierarchyInfo struct
88  */
89 void vtkParseHierarchy_Free(HierarchyInfo *info);
90
91 /**
92  * Return the entry for a class or type, or null if not found
93  */
94 HierarchyEntry *vtkParseHierarchy_FindEntry(
95   const HierarchyInfo *info, const char *classname);
96
97 /**
98  * Get properties for the class.  Returns NULL if the property
99  * is not set, and returns either an empty string or a value string
100  * if the property is set. The properties supported are as follows:
101  * "WRAP_EXCLUDE", "WRAP_SPECIAL", and "ABSTRACT"
102  */
103 const char *vtkParseHierarchy_GetProperty(
104   const HierarchyEntry *entry, const char *property);
105
106 /**
107  * Check whether class is derived from baseclass.
108  */
109 int vtkParseHierarchy_IsTypeOf(const HierarchyInfo *info,
110   const HierarchyEntry *entry, const char *baseclass);
111
112 /**
113  * Check whether class is derived from baseclass.  You must supply
114  * the entry for the class (returned by FindEntry) as well as the
115  * classname.  The classname can include template args in angle brackets.
116  * The baseclass_with_args parameter, if not set to NULL, will be used
117  * to return the name of base class with the template args in angle
118  * brackets that classname was derived from.  If not set to NULL,
119  * this should be freed with free() to avoid a memory leak.
120  */
121 int vtkParseHierarchy_IsTypeOfTemplated(const HierarchyInfo *info,
122   const HierarchyEntry *entry, const char *classname,
123   const char *baseclass, const char **baseclass_with_args);
124
125 /**
126  * Free the template args returned by IsTypeOfTemplated
127  */
128 void vtkParseHierarchy_FreeTemplateArgs(int n, const char *args[]);
129
130 /**
131  * Given a classname with template parameters, get the superclass name
132  * with corresponding template parameters.  Returns null if 'i' is out
133  * of range, i.e. greater than or equal to the number of superclasses.
134  * The returned classname must be freed with "free()".
135  */
136 const char *vtkParseHierarchy_TemplatedSuperClass(
137   const HierarchyEntry *entry, const char *classname, int i);
138
139 /**
140  * Expand all unrecognized types in a ValueInfo struct by
141  * using the typedefs in the HierarchyInfo struct.
142  */
143 int vtkParseHierarchy_ExpandTypedefsInValue(
144   const HierarchyInfo *info, ValueInfo *data, StringCache *cache,
145   const char *scope);
146
147 /**
148  * Expand typedefs found in a name stored as a string.  The value
149  * of "text" will be returned if no expansion occurred, else a new
150  * string is returned that must be freed with "free()".
151  */
152 const char *vtkParseHierarchy_ExpandTypedefsInName(
153   const HierarchyInfo *info, const char *text, const char *scope);
154
155 #ifdef __cplusplus
156 } /* extern "C" */
157 #endif
158
159 #endif