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


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

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


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

示例1: upgrade_json

	bool upgrade_json (unsigned version_a, boost::property_tree::ptree & tree_a)
	{
		auto result (false);
		switch (version_a)
		{
			case 1:
			{
				rai::account account;
				account.decode_account (tree_a.get<std::string> ("account"));
				tree_a.erase ("account");
				tree_a.put ("account", account.to_account ());
				tree_a.erase ("version");
				tree_a.put ("version", "2");
				result = true;
			}
			case 2:
			{
				boost::property_tree::ptree rpc_l;
				rpc.serialize_json (rpc_l);
				tree_a.put ("rpc_enable", "false");
				tree_a.put_child ("rpc", rpc_l);
				tree_a.erase ("version");
				tree_a.put ("version", "3");
				result = true;
			}
			case 3:
			{
				auto opencl_enable_l (tree_a.get_optional<bool> ("opencl_enable"));
				if (!opencl_enable_l)
				{
					tree_a.put ("opencl_enable", "false");
				}
				auto opencl_l (tree_a.get_child_optional ("opencl"));
				if (!opencl_l)
				{
					boost::property_tree::ptree opencl_l;
					opencl.serialize_json (opencl_l);
					tree_a.put_child ("opencl", opencl_l);
				}
				tree_a.put ("version", "4");
				result = true;
			}
			case 4:
				break;
			default:
				throw std::runtime_error ("Unknown qt_wallet_config version");
		}
		return result;
	}
开发者ID:romansokolovski,项目名称:raiblocks,代码行数:49,代码来源:entry.cpp

示例2: upgrade_option

void Set::upgrade_option( bp::ptree& ptree , const std::string& prev , const std::string& curr )
{
	auto opt = ptree.get_optional<std::string>( prev );
	if( opt ) {
		ptree.put( curr ,*opt);
		ptree.erase( prev );
	}
}
开发者ID:cyclefusion,项目名称:szarp,代码行数:8,代码来源:set.cpp

示例3: if

void
mergePropertyTrees (boost::property_tree::ptree &ptMerged,
                    const boost::property_tree::ptree &ptSecond, int level )
{
  // Value or object or array
  if (level > 0 && ptSecond.empty() ) {
    // Copy value
    ptMerged = ptSecond;
  } else if (level > 0 && ptSecond.count (std::string() ) == ptSecond.size() ) {
    // Copy array
    ptMerged = ptSecond;
  } else {
    auto it = ptSecond.begin();

    for (; it != ptSecond.end(); ++it) {
      boost::property_tree::ptree child = ptMerged.get_child (it->first.data(),
                                          boost::property_tree::ptree() );
      mergePropertyTrees (child, it->second, level + 1);

      ptMerged.erase (it->first.data() );
      ptMerged.add_child (it->first.data(), child);
    }
  }
}
开发者ID:startgeek,项目名称:kurento-media-server,代码行数:24,代码来源:loadConfig.cpp


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