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
46 templateengine();
47
49 virtual ~templateengine();
50
59 bool parse(output *out,
60 const char *filename,
61 fileparser *fileparsers,
62 dictionary< const char *, const char * > *vars);
63
78 bool parse(output *out,
79 const char *filename,
80 blockparser *blockparsers,
81 dictionary< const char *, const char * > *vars);
82
97 bool parse(output *out,
98 const char *block,
99 uint64_t blocklength,
100 blockparser *blockparsers,
101 dictionary< const char *, const char * > *vars);
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
375 const char *getError();
376
377 #include <rudiments/private/templateengine.h>
378 };
379
380 #endif
bool
Definition: inttypes.h:92
dictionary
Definition: dictionary.h:63
file
Definition: file.h:19
output
Definition: output.h:9
templateengine
Definition: templateengine.h:42
templateengine::getBlockEndEnd
const char * getBlockEndEnd()
templateengine::templateengine
templateengine()
templateengine::getIncludeEnd
const char * getIncludeEnd()
templateengine::getBlockStartEnd
const char * getBlockStartEnd()
templateengine::getBlockStartStart
const char * getBlockStartStart()
templateengine::~templateengine
virtual ~templateengine()
templateengine::setVariableStart
void setVariableStart(const char *delimiter)
templateengine::parse
bool parse(output *out, const char *filename, blockparser *blockparsers, dictionary< const char *, const char * > *vars)
templateengine::setBlockStartStart
void setBlockStartStart(const char *delimiter)
templateengine::setQuotedVariableStart
void setQuotedVariableStart(const char *delimiter)
templateengine::getQuotedVariableEnd
const char * getQuotedVariableEnd()
templateengine::setEscapeCharacter
void setEscapeCharacter(char esc)
templateengine::setBlockStartEnd
void setBlockStartEnd(const char *delimiter)
templateengine::getIncludeStart
const char * getIncludeStart()
templateengine::getQuotedVariableStart
const char * getQuotedVariableStart()
templateengine::setDoubleQuotedVariableEnd
void setDoubleQuotedVariableEnd(const char *delimiter)
templateengine::parse
bool parse(output *out, const char *block, uint64_t blocklength, blockparser *blockparsers, dictionary< const char *, const char * > *vars)
templateengine::getBlockEndStart
const char * getBlockEndStart()
templateengine::setIncludeEnd
void setIncludeEnd(const char *delimiter)
templateengine::setBlockEndStart
void setBlockEndStart(const char *delimiter)
templateengine::setBlockEndEnd
void setBlockEndEnd(const char *delimiter)
templateengine::setQuotedVariableEnd
void setQuotedVariableEnd(const char *delimiter)
templateengine::parse
bool parse(output *out, const char *filename, fileparser *fileparsers, dictionary< const char *, const char * > *vars)
templateengine::getEscapeCharacter
char getEscapeCharacter()
templateengine::getVariableEnd
const char * getVariableEnd()
templateengine::setDoubleQuotedVariableStart
void setDoubleQuotedVariableStart(const char *delimiter)
templateengine::getError
const char * getError()
templateengine::getVariableStart
const char * getVariableStart()
templateengine::getDoubleQuotedVariableStart
const char * getDoubleQuotedVariableStart()
templateengine::getDoubleQuotedVariableEnd
const char * getDoubleQuotedVariableEnd()
templateengine::setVariableEnd
void setVariableEnd(const char *delimiter)
templateengine::setIncludeStart
void setIncludeStart(const char *delimiter)
blockparser
Definition: templateengine.h:33
fileparser
Definition: templateengine.h:25