Line data Source code
1 :
2 : #include "matchmaker.hpp"
3 : #include <boost/regex.hpp>
4 : #include <vector>
5 : #include <iostream>
6 : #include "matcher/builder.hpp"
7 : #include "matcher/imatcher.hpp"
8 :
9 : namespace wfc{ namespace jsonrpc{
10 :
11 56 : bool matchmaker::reconfigure(int mode, const std::string& jsonconfig, json::json_error& err)
12 : {
13 56 : auto bldr = std::make_shared<builder>(mode);
14 56 : const char* beg = jsonconfig.c_str();
15 56 : const char* end = beg + jsonconfig.size();
16 56 : _matcher = bldr->build_value(beg, end, err);
17 56 : if (err || _matcher == nullptr)
18 0 : return false;
19 56 : return _matcher->configure(beg, end, err);
20 : }
21 :
22 56 : bool matchmaker::match(const std::string& json, json::json_error& err)
23 : {
24 56 : const char* beg = json.c_str();
25 56 : return this->match( beg, beg + json.size(), err);
26 : }
27 :
28 56 : bool matchmaker::match(const char* beg, const char* end, json::json_error& err)
29 : {
30 56 : return _matcher->match(beg, end, err);
31 : }
32 :
33 3 : }}
|