HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CPP_TokenStream.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: CPP_TokenStream.h ( FS Library, C++)
7  *
8  * COMMENTS: Reads a stream of tokens using CPP
9  */
10 
11 #ifndef __CPP_TokenStream__
12 #define __CPP_TokenStream__
13 
14 #include "FS_API.h"
15 #include <UT/UT_String.h>
16 #include <UT/UT_WorkBuffer.h>
17 #include <UT/UT_WorkArgs.h>
18 
19 class CPP_Manager;
20 class UT_IStream;
21 
23 {
24 public:
25  CPP_TokenStream(const char *filename, int pathvar=-1,
26  const char **cpp_options=0);
27  CPP_TokenStream(UT_IStream &is, const char *filename="<internal>",
28  const char **cpp_options=0);
29  virtual ~CPP_TokenStream();
30 
31  void addIncludePath(const char *path);
32  void addIncludePathRaw(const char *path);
33 
34  /// Set additional CPP options
35  void setCPPOptions(const char **cpp_options);
36 
37  int getLineNumber();
38  const char *getFileName();
39 
40  // Set to true to preserve backslashes in the stream. Otherwise escaped
41  // backslashes and quotes ('\\' and '\"') get expanded automatically.
42  // The default is to expand automatically (false).
43  void setPreserveBackslashes(bool flag);
44 
45  int getToken(UT_String &token);
46  void ungetToken(const UT_String &token);
47 
48  virtual void cppError(const char *message) const;
49  virtual void cppWarning(const char *message) const;
50 
51 protected:
52  void init(int pathvar, const char **cpp_options);
53 
57  CPP_Manager *myCPP;
58  int myOptind;
60 };
61 
62 #endif
63 
GT_API const UT_StringHolder filename
UT_WorkBuffer myArgBuf
UT_WorkArgs myArgs
GLsizei GLenum GLuint GLuint GLsizei GLchar * message
Definition: glew.h:2581
CPP_Manager * myCPP
GLsizei const GLchar *const * path
Definition: glew.h:6461
#define FS_API
Definition: FS_API.h:10