-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtemplateengine.h
More file actions
40 lines (27 loc) · 871 Bytes
/
templateengine.h
File metadata and controls
40 lines (27 loc) · 871 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
* Copyright (C) Alex Nekipelov (alex@nekipelov.net)
* License: BSD
*/
#ifndef CPPTL_TEMPLATEENGINE_H
#define CPPTL_TEMPLATEENGINE_H
#include <boost/function.hpp>
#include <boost/scoped_ptr.hpp>
#include "template.h"
#include "value.h"
namespace cpptl {
class TemplateEngineImpl;
class TemplateEngine {
public:
typedef boost::function<Value(const Value &, const Value &)> Helper;
TemplateEngine();
~TemplateEngine();
Template templ(const std::string &text);
Template templFile(const std::string &fileName);
bool hasHelper(const std::string &name);
void registerHelper(const std::string &name, const Helper &helper);
Value callHelper(const std::string &name, const Value &context, const Value &args) const;
private:
boost::scoped_ptr<TemplateEngineImpl> pimpl;
};
} // namespace cpptl
#endif // CPPTL_TEMPLATEENGINE_H