Line data Source code
1 : #include "full_match.hpp"
2 : #include <cstring>
3 :
4 : namespace wfc{ namespace jsonrpc{
5 :
6 148 : bool full_match::configure(const char* beg, const char* end, json::json_error& err)
7 : {
8 148 : const char* send = json::parser::parse_string(beg, end, &err);
9 148 : if (err) return false;
10 148 : _sjson = std::string(beg, send);
11 148 : return true;
12 : }
13 :
14 182 : bool full_match::match(const char* beg, const char* end, json::json_error& err)
15 : {
16 182 : const char* send = json::parser::parse_value(beg, end, &err);
17 182 : if (err) return false;
18 182 : if ( static_cast<std::ptrdiff_t>(_sjson.size()) != std::distance(beg, send) )
19 19 : return false;
20 163 : return std::strncmp(beg, _sjson.c_str(), _sjson.size() ) == 0;
21 : }
22 :
23 :
24 : }}
|