Пример #1
0
void add_to_data(ptree& pt, const ptree& record)
{
    if(!pt.get_child_optional("data")) {
        ptree arrayPt;
        arrayPt.push_back(make_pair("", record));
        pt.push_back(make_pair("data", arrayPt));
    } else {
        auto& dataPt = pt.get_child("data");
        dataPt.push_back(make_pair("", record));
    }
}
Пример #2
0
Файл: Info.cpp Проект: cyosp/MPA
string Info::executeGetRequest(ptree & root)
{
	string ret = MPAO::DEFAULT_JSON_ID;

	if( urlPairs.size() == 1 )
	{
		ptree versionPtree;
		versionPtree.put("version", MPA::version);
		root.push_back(std::make_pair("infos", versionPtree));
	}

	return ret;
}
Пример #3
0
void format_node::to_xml(ptree &xml) const
{
    ptree &new_node = xml.push_back(ptree::value_type("Format", ptree()))->second;
    if (face_name) set_attr(new_node, "face-name", *face_name);
    if (text_size) set_attr(new_node, "size", *text_size);
    if (character_spacing) set_attr(new_node, "character-spacing", *character_spacing);
    if (line_spacing) set_attr(new_node, "line-spacing", *line_spacing);
    if (text_opacity) set_attr(new_node, "opacity", *text_opacity);
    if (wrap_before) set_attr(new_node, "wrap-before", *wrap_before);
    if (wrap_char) set_attr(new_node, "wrap-character", *wrap_char);
    if (text_transform) set_attr(new_node, "text-transform", *text_transform);
    if (fill) set_attr(new_node, "fill", *fill);
    if (halo_fill) set_attr(new_node, "halo-fill", *halo_fill);
    if (halo_radius) set_attr(new_node, "halo-radius", *halo_radius);
    if (child_) child_->to_xml(new_node);
}
Пример #4
0
void layout_node::to_xml(ptree &xml) const
{
    ptree & new_node = xml.push_back(ptree::value_type("Layout", ptree()))->second;

    if (dx) serialize_property("dx", *dx, new_node);
    if (dy) serialize_property("dy", *dy, new_node);
    if (text_ratio) serialize_property("text-ratio", *text_ratio, new_node);
    if (wrap_width) serialize_property("wrap-width", *wrap_width, new_node);
    if (wrap_char) serialize_property("wrap-character", *wrap_char, new_node);
    if (wrap_before) serialize_property("wrap-before", *wrap_before, new_node);
    if (repeat_wrap_char) serialize_property("repeat-wrap-character", *repeat_wrap_char, new_node);
    if (rotate_displacement) serialize_property("rotate-displacement", *rotate_displacement, new_node);
    if (orientation) serialize_property("orientation", *orientation, new_node);
    if (halign) serialize_property("horizontal-alignment", *halign, new_node);
    if (valign) serialize_property("vertical-alignment", *valign, new_node);
    if (jalign) serialize_property("justify-alignment", *jalign, new_node);

    if (child_) child_->to_xml(new_node);
}
Пример #5
0
string Account::executePostAddRequest(ptree & root)
{
	string ret = MPAO::DEFAULT_JSON_ID;

	MPA_LOG_TRIVIAL(trace,"Account name to add: " + argvals.find("name")->second );

	mpapo::Account account( MPA::getInstance()->getMPAPO() );
	account = addAccount( argvals.find("name")->second );

	// Get account ID
	ret = string( account.id );

	MPA_LOG_TRIVIAL(trace,"Account ID added: " + ret);

	// Generate Json output
	root.push_back(make_pair("version", account.version ));
	root.push_back(make_pair("balance", account.balance ));

	return ret;
}
Пример #6
0
string Account::executePostUpdateRequest(ptree & root)
{
	//MPA_LOG_TRIVIAL( trace , "Start" );

	string ret = MPAO::DEFAULT_JSON_ID;

	int accountId = urlPairs[0].second;
	int accountVersion = atoi( argvals.find("version")->second );
	string accountNewName = argvals.find("name")->second;

	mpapo::Account account = renameAccount( accountId , accountVersion , accountNewName );
	ret = StrUtil::int2string( accountId );

	// Generate Json output
	root.push_back(make_pair("version", StrUtil::int2string( account.version ) ));

	//MPA_LOG_TRIVIAL( trace , "End" );

	return ret;
}
Пример #7
0
void format_node::to_xml(ptree & xml) const
{
    ptree & new_node = xml.push_back(ptree::value_type("Format", ptree()))->second;

    if (text_size) serialize_property("size", *text_size, new_node);
    if (character_spacing) serialize_property("character-spacing", *character_spacing, new_node);
    if (line_spacing) serialize_property("line-spacing", *line_spacing, new_node);
    if (text_opacity) serialize_property("opacity", *text_opacity, new_node);
    if (wrap_before) serialize_property("wrap-before", *wrap_before, new_node);
    if (repeat_wrap_char) serialize_property("repeat-wrap-character", *repeat_wrap_char, new_node);
    if (fill) serialize_property("fill", *fill, new_node);
    if (halo_fill) serialize_property("halo-fill", *halo_fill, new_node);
    if (halo_radius) serialize_property("halo-radius", *halo_radius, new_node);
    if (text_transform) serialize_property("text-transform", *text_transform, new_node);
    if (ff_settings) serialize_property("font-feature-settings", *ff_settings, new_node);

    if (face_name) set_attr(new_node, "face-name", *face_name);
    if (fontset) set_attr(new_node, "fontset-name", fontset->get_name());

    if (child_) child_->to_xml(new_node);
}
Пример #8
0
void text_node::to_xml(ptree & xml) const
{
    ptree & new_node = xml.push_back(ptree::value_type("<xmltext>", ptree()))->second;
    new_node.put_value(to_expression_string(*text_));
}