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 
132  void setBlockStartStart(const char *delimiter);
133 
145  void setBlockStartEnd(const char *delimiter);
146 
158  void setBlockEndStart(const char *delimiter);
159 
171  void setBlockEndEnd(const char *delimiter);
172 
182  void setIncludeStart(const char *delimiter);
183 
193  void setIncludeEnd(const char *delimiter);
194 
202  const char *getVariableStart();
203 
211  const char *getVariableEnd();
212 
224  const char *getBlockStartStart();
225 
237  const char *getBlockStartEnd();
238 
250  const char *getBlockEndStart();
251 
263  const char *getBlockEndEnd();
264 
274  const char *getIncludeStart();
275 
285  const char *getIncludeEnd();
286 
287  #include <rudiments/private/templateengine.h>
288 };
289 
290 #endif
Definition: file.h:19
Definition: dictionary.h:63
Definition: templateengine.h:42
Definition: templateengine.h:33
Definition: inttypes.h:88
Definition: templateengine.h:25
Definition: output.h:9