当前位置: 首页>>代码示例>>C++>>正文


C++ ptree::put_child方法代码示例

本文整理汇总了C++中ptree::put_child方法的典型用法代码示例。如果您正苦于以下问题:C++ ptree::put_child方法的具体用法?C++ ptree::put_child怎么用?C++ ptree::put_child使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ptree的用法示例。


在下文中一共展示了ptree::put_child方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: save

// save
void configuration::save(ptree& out_conf) const {
  out_conf.put_child(settings_path_, settings_);
  LOG_INFO(settings_path_, "Settings saved.");
  if (!out_conf.get_child_optional(defaults_path_)) {
    out_conf.put_child(defaults_path_, defaults_);
    LOG_INFO(defaults_path_, "Settings saved.");
  }
}
开发者ID:sly2j,项目名称:CtrlRoom,代码行数:9,代码来源:configuration.cpp

示例2: write

void ProperyTreeUtils::write(ptree & properties, const std::vector<uint8_t> & data) {
	ptree propertiesData {};

	for(const uint8_t & value: data){
		ptree propertyValue {boost::lexical_cast<std::string>((int)value)};
		propertiesData.push_back({DATA_VALUE_NAME, propertyValue});
	}

	properties.put_child(DATA_NAME, propertiesData);

}
开发者ID:paoloach,项目名称:zdomus,代码行数:11,代码来源:ProperyTreeUtils.cpp

示例3: addToArray

void MsgPrinter::addToArray(ptree& root, string name, string value) {

	optional<ptree&> child = root.get_child_optional(name);
	if (child.is_initialized()) {
		ptree item;
		item.put("", value);
		child.get().push_front(make_pair("", item));
	} else {
		ptree child, item;
		item.put("", value);
		child.push_front(make_pair("", item));
		root.put_child(name, child);
	}
}
开发者ID:ic-hep,项目名称:emi3,代码行数:14,代码来源:MsgPrinter.cpp

示例4: writeSelf

void MultiMatcher::writeSelf(ptree& writeTo) const {

    writeTo.put(OPERATE_MODE_KEY,OPERATE_MODE_MAP_NAME[m_operateMode]);

    int index=0;

    ptree values;

    for(auto &child : m_values){
        ptree childTree;

        write(child,childTree);

        values.add_child(MATCHER_KEY,childTree);
    }

    writeTo.put_child(VALUES_KEY,values);

}
开发者ID:comicfans,项目名称:UnifiedKeyboardCombo,代码行数:19,代码来源:MultiMatcher.cpp

示例5: reduce_and_output

void reduce_and_output(IterT beg, IterT end, TransformT trans, ptree& parent, std::string const& path)
{
	ValueT minv;
	ValueT maxv;
	ValueT total = 0;
	ValueT avg = 0;

	if(beg == end)
	{
		minv = maxv = total = avg = 0;
	}
	else
	{
		auto it = beg;
		minv = maxv = total = trans(*it);
		++it;

		size_t count = 1;
		for(; it != end; ++it)
		{
			auto v = trans(*it);
			min_max(minv, maxv, v);
			total += v;
			++count;
		}

		avg = total / count;
	}

	ptree vnode;
	vnode.put("min", minv);
	vnode.put("max", maxv);
	vnode.put("total", total);
	vnode.put("avg", avg);
	parent.put_child(path, vnode);
}
开发者ID:whztt07,项目名称:SALVIA,代码行数:36,代码来源:sample_app.cpp


注:本文中的ptree::put_child方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。