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 
40 class templateengineprivate;
41 
44 class RUDIMENTS_DLLSPEC templateengine {
45  public:
46 
49 
51  virtual ~templateengine();
52 
61  bool parse(output *out,
62  const char *filename,
63  fileparser *fileparsers,
65 
80  bool parse(output *out,
81  const char *filename,
82  blockparser *blockparsers,
84 
99  bool parse(output *out,
100  const char *block,
101  uint64_t blocklength,
102  blockparser *blockparsers,
104 
112  void setVariableStart(const char *delimiter);
113 
121  void setVariableEnd(const char *delimiter);
122 
134  void setBlockStartStart(const char *delimiter);
135 
147  void setBlockStartEnd(const char *delimiter);
148 
160  void setBlockEndStart(const char *delimiter);
161 
173  void setBlockEndEnd(const char *delimiter);
174 
184  void setIncludeStart(const char *delimiter);
185 
195  void setIncludeEnd(const char *delimiter);
196 
204  const char *getVariableStart();
205 
213  const char *getVariableEnd();
214 
226  const char *getBlockStartStart();
227 
239  const char *getBlockStartEnd();
240 
252  const char *getBlockEndStart();
253 
265  const char *getBlockEndEnd();
266 
276  const char *getIncludeStart();
277 
287  const char *getIncludeEnd();
288 
289  #include <rudiments/private/templateengine.h>
290 };
291 
292 #endif
Definition: file.h:21
Definition: dictionary.h:63
Definition: templateengine.h:44
Definition: templateengine.h:33
Definition: inttypes.h:88
Definition: templateengine.h:25
Definition: output.h:9