Rudiments
templateengine.h
1 // Copyright (c) 1999-2018 David Muse
2 // See the COPYING file for more information
3 
4 #ifndef RUDIMENTS_TEMPLATEENGINE_H
5 #define RUDIMENTS_TEMPLATEENGINE_H
6 
7 #include <rudiments/private/templateengineincludes.h>
8 
9 
11 typedef bool (*fileparser_t)(output *out,
12  const char *filename,
13  void *data);
14 
16 typedef bool (*blockparser_t)(output *out,
17  const char *blockname,
18  const char *block,
19  uint64_t blocklength,
20  void *data);
21 
22 
25 struct fileparser {
26  const char *file;
27  fileparser_t parser;
28  void *data;
29 };
30 
33 struct blockparser {
34  output *out;
35  const char *blockname;
36  blockparser_t parser;
37  void *data;
38 };
39 
42 class RUDIMENTS_DLLSPEC templateengine {
43  public:
44 
47 
49  virtual ~templateengine();
50 
59  bool parse(output *out,
60  const char *filename,
61  fileparser *fileparsers,
63 
78  bool parse(output *out,
79  const char *filename,
80  blockparser *blockparsers,
82 
97  bool parse(output *out,
98  const char *block,
99  uint64_t blocklength,
100  blockparser *blockparsers,
102 
110  void setVariableStart(const char *delimiter);
111 
119  void setVariableEnd(const char *delimiter);
120 
129  void setQuotedVariableStart(const char *delimiter);
130 
139  void setQuotedVariableEnd(const char *delimiter);
140 
149  void setDoubleQuotedVariableStart(const char *delimiter);
150 
159  void setDoubleQuotedVariableEnd(const char *delimiter);
160 
162  void setEscapeCharacter(char esc);
163 
175  void setBlockStartStart(const char *delimiter);
176 
188  void setBlockStartEnd(const char *delimiter);
189 
201  void setBlockEndStart(const char *delimiter);
202 
214  void setBlockEndEnd(const char *delimiter);
215 
225  void setIncludeStart(const char *delimiter);
226 
236  void setIncludeEnd(const char *delimiter);
237 
245  const char *getVariableStart();
246 
254  const char *getVariableEnd();
255 
264  const char *getQuotedVariableStart();
265 
274  const char *getQuotedVariableEnd();
275 
284  const char *getDoubleQuotedVariableStart();
285 
294  const char *getDoubleQuotedVariableEnd();
295 
297  char getEscapeCharacter();
298 
310  const char *getBlockStartStart();
311 
323  const char *getBlockStartEnd();
324 
336  const char *getBlockEndStart();
337 
349  const char *getBlockEndEnd();
350 
360  const char *getIncludeStart();
361 
371  const char *getIncludeEnd();
372 
373  #include <rudiments/private/templateengine.h>
374 };
375 
376 #endif
Definition: file.h:19
Definition: dictionary.h:63
Definition: templateengine.h:42
Definition: templateengine.h:33
Definition: inttypes.h:92
Definition: templateengine.h:25
Definition: output.h:9