コード例 #1
0
bool metashell::system_test::operator==(const type& type_,
                                        const json_string& s_)
{
  rapidjson::Document d;
  d.Parse(s_.get().c_str());
  return members_are({"type", "name"}, d) && matches(type_, d["name"]);
}
コード例 #2
0
ファイル: json_string.cpp プロジェクト: sabel83/metashell
bool metashell::system_test::operator==(const json_string& a_,
                                        const json_string& b_)
{
  // Not testing point_of_event and source_location
  auto flags = boost::match_default | boost::format_all;
  boost::regex filter_poi(R"(,"point_of_event":"[^"]*")");
  boost::regex filter_sl(R"(,"source_location":"[^"]*")");

  auto filtered_a = boost::regex_replace(a_.get(), filter_poi, "", flags);
  auto filtered_b = boost::regex_replace(b_.get(), filter_poi, "", flags);

  filtered_a = boost::regex_replace(filtered_a, filter_sl, "", flags);
  filtered_b = boost::regex_replace(filtered_b, filter_sl, "", flags);

  return filtered_a == filtered_b;
}
コード例 #3
0
ファイル: frame.cpp プロジェクト: sabel83/metashell
bool metashell::system_test::operator==(const frame& frame_,
                                        const json_string& s_)
{
  rapidjson::Document d;
  d.Parse(s_.get().c_str());
  return d.IsObject() && d.HasMember("type") && is_string("frame", d["type"]) &&
         matches(frame_, d);
}
コード例 #4
0
ファイル: frame.cpp プロジェクト: sabel83/metashell
frame::frame(const json_string& s_)
  : _name(boost::none),
    _source_location(boost::none),
    _point_of_event(boost::none),
    _kind(boost::none)
{
  rapidjson::Document d;
  d.Parse(s_.get().c_str());
  init(d, true);
}
コード例 #5
0
ファイル: json_converter.cpp プロジェクト: delta2323/jubatus
static void convert_string(const json_string& value, const string& path, datum& ret_datum) {
  ret_datum.string_values_.push_back(make_pair(path, value.get()));
}