Exemplo n.º 1
0
void set_css(boost::property_tree::ptree & pt, const std::string & name, const T & v)
{
    boost::property_tree::ptree & css_node = pt.push_back(
                boost::property_tree::ptree::value_type("CssParameter",
                        boost::property_tree::ptree()))->second;
    css_node.put("<xmlattr>.name", name );
    css_node.put_value( v );
}
Exemplo n.º 2
0
Arquivo: xml.cpp Projeto: spolitov/lib
void convert(const boost::property_tree::wptree & in, boost::property_tree::ptree & out)
{
    out.data() = utf8(in.data());
    for(boost::property_tree::wptree::const_iterator i = in.begin(), end = in.end(); i != end; ++i)
    {
        out.push_back(boost::property_tree::ptree::value_type(utf8(i->first), boost::property_tree::ptree()));
        convert(i->second, out.back().second);
    }
}
Exemplo n.º 3
0
Status serializeQueryData(const QueryData& q, pt::ptree& tree) {
  for (const auto& r : q) {
    pt::ptree serialized;
    auto s = serializeRow(r, serialized);
    if (!s.ok()) {
      return s;
    }
    tree.push_back(std::make_pair("", serialized));
  }
  return Status(0, "OK");
}
Exemplo n.º 4
0
    void operator()( boost::property_tree::ptree & s, object_type & obj ) {

        size_t all_count = obj.allele_count();
        size_t i = 0;
        while( i < all_count ) {
            boost::property_tree::ptree all;
            all.put( "position", obj.getPositionAt(i) );
            s.push_back( std::make_pair("", all ) );
            ++i;
        }

    }
Exemplo n.º 5
0
void expression_format::to_xml(boost::property_tree::ptree &xml) const
{
    ptree &new_node = xml.push_back(ptree::value_type("ExpressionFormat", ptree()))->second;
    if (face_name) set_attr(new_node, "face-name", to_expression_string(*face_name));
    if (text_size) set_attr(new_node, "size", to_expression_string(*text_size));
    if (character_spacing) set_attr(new_node, "character-spacing", to_expression_string(*character_spacing));
    if (line_spacing) set_attr(new_node, "line-spacing", to_expression_string(*line_spacing));
    if (text_opacity) set_attr(new_node, "opacity", to_expression_string(*text_opacity));
    if (wrap_before) set_attr(new_node, "wrap-before", to_expression_string(*wrap_before));
    if (wrap_char) set_attr(new_node, "wrap-character", to_expression_string(*wrap_char));
    if (fill) set_attr(new_node, "fill", to_expression_string(*fill));
    if (halo_fill) set_attr(new_node, "halo-fill", to_expression_string(*halo_fill));
    if (halo_radius) set_attr(new_node, "halo-radius", to_expression_string(*halo_radius));
    if (child_) child_->to_xml(new_node);
}
Exemplo n.º 6
0
Status serializeQueryLogItemAsEvents(const QueryLogItem& i, pt::ptree& tree) {
  pt::ptree diff_results;
  auto status = serializeDiffResults(i.results, diff_results);
  if (!status.ok()) {
    return status;
  }

  for (auto& action : diff_results) {
    for (auto& row : action.second) {
      pt::ptree event;
      serializeEvent(i, row.second, event);
      event.put<std::string>("action", action.first);
      tree.push_back(std::make_pair("", event));
    }
  }
  return Status(0, "OK");
}
Exemplo n.º 7
0
Status serializeQueryLogItemAsEvents(const QueryLogItem& i, pt::ptree& tree) {
  pt::ptree diff_results;
  // Note, snapshot query results will bypass the "AsEvents" call, even when
  // log_result_events is set. This is because the schedule will call an
  // explicit ::logSnapshotQuery, which does not check for the result_events
  // configuration.
  auto status = serializeDiffResults(i.results, diff_results);
  if (!status.ok()) {
    return status;
  }

  for (auto& action : diff_results) {
    for (auto& row : action.second) {
      pt::ptree event;
      serializeEvent(i, row.second, event);
      event.put<std::string>("action", action.first);
      tree.push_back(std::make_pair("", event));
    }
  }
  return Status(0, "OK");
}
Exemplo n.º 8
0
Status serializeScheduledQueryLogItemAsEvents(
    const ScheduledQueryLogItem& item, boost::property_tree::ptree& tree) {
  try {
    pt::ptree diff_results;
    auto status = serializeDiffResults(item.diffResults, diff_results);
    if (!status.ok()) {
      return status;
    }

    for (auto& i : diff_results) {
      for (auto& j : i.second) {
        pt::ptree event;
        serializeEvent(item, j.second, event);
        event.put<std::string>("action", i.first);
        tree.push_back(std::make_pair("", event));
      }
    }
  } catch (const std::exception& e) {
    return Status(1, e.what());
  }

  return Status(0, "OK");
}