9 #include <boost/variant.hpp> 14 static std::function<std::string(const std::string&)>
escape;
22 const N&
at(
const std::string&
name)
const {
35 this->methods.insert({item.first, std::bind(item.second,
s)});
39 std::map<std::string, std::function<N()>>
methods;
40 mutable std::map<std::string, N>
cache;
43 template<
class T,
class N>
79 return renderer(f(text));
85 const std::string& text =
"")
const 87 return fun(renderer, text);
91 std::function<std::string(node_renderer<N> renderer,
const std::string&)>
fun;
94 template <
class Key,
class Value>
99 map(
const std::initializer_list<
typename std::map<Key, Value>::value_type>& args) :
std::
map<Key, Value>(args) {}
104 std::map<Key, Value>::insert(i);
111 using node = boost::make_recursive_variant<
112 std::nullptr_t, std::string, int, double,
bool, uint64_t, int64_t, uint32_t,
113 internal::lambda_t<boost::recursive_variant_>,
114 std::shared_ptr<internal::object_t<boost::recursive_variant_>>,
115 internal::map<const std::string, boost::recursive_variant_>,
116 std::vector<boost::recursive_variant_>>
::type;
123 const std::string& tmplt,
125 const std::map<std::string,std::string>& partials =
126 std::map<std::string,std::string>());
bool has(const std::string name) const
Definition: mstch.hpp:27
static bool const has_args
Definition: mstch.hpp:59
lambda_t(F f, typename std::enable_if< is_fun< F, N >::no_args >::type *=0)
Definition: mstch.hpp:69
#define F(w, k)
Definition: sha512-blocks.c:61
boost::make_recursive_variant< std::nullptr_t, std::string, int, double, bool, uint64_t, int64_t, uint32_t, internal::lambda_t< boost::recursive_variant_ >, std::shared_ptr< internal::object_t< boost::recursive_variant_ > >, internal::map< const std::string, boost::recursive_variant_ >, std::vector< boost::recursive_variant_ > >::type node
Definition: mstch.hpp:116
std::string operator()(node_renderer< N > renderer, const std::string &text="") const
Definition: mstch.hpp:84
static bool const no_args
Definition: mstch.hpp:58
Definition: block_queue.cpp:41
char not_fun
Definition: mstch.hpp:46
Definition: cryptonote_config.h:156
std::map< std::string, std::function< N()> > methods
Definition: mstch.hpp:39
std::map< std::string, N > cache
Definition: mstch.hpp:40
std::function< std::string(node_renderer< N > renderer, const std::string &)> fun
Definition: mstch.hpp:91
std::vector< node > array
Definition: mstch.hpp:120
internal::map< const std::string, node > map
Definition: mstch.hpp:119
static std::function< std::string(const std::string &)> escape
Definition: mstch.hpp:14
static fun_without_args & test(really_has< N(C::*)() const, &C::operator()> *)
map(const std::initializer_list< typename std::map< Key, Value >::value_type > &args)
Definition: mstch.hpp:99
char[3] fun_with_args
Definition: mstch.hpp:48
lambda_t(F f, typename std::enable_if< is_fun< F, N >::has_args >::type *=0)
Definition: mstch.hpp:77
map & operator=(const map &rhs)
Definition: mstch.hpp:100
type
Definition: json.h:74
char[2] fun_without_args
Definition: mstch.hpp:47
int bool
Definition: stdbool.h:36
map()
Definition: mstch.hpp:97
void register_methods(S *s, std::map< std::string, N(S::*)()> methods)
Definition: mstch.hpp:33
const N & at(const std::string &name) const
Definition: mstch.hpp:22
const char * name
Definition: simplewallet.cpp:180
std::function< std::string(const N &n)> node_renderer
Definition: mstch.hpp:63
void clear(std::string &pass) noexcept
Definition: password.cpp:169
std::string render(const std::string &tmplt, const node &root, const std::map< std::string, std::string > &partials=std::map< std::string, std::string >())
Definition: mstch.cpp:10
map(const map< Key, Value > &rhs)
Definition: mstch.hpp:98
#define s(x, c)
Definition: aesb.c:46