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


C++ section::clear方法代码示例

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


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

示例1: clear_book

void clear_book()
{
	game_cfg = NULL;
	map = NULL;
	hidden_sections.clear();
}
开发者ID:hyrio,项目名称:War-Of-Kingdom,代码行数:6,代码来源:help.cpp

示例2: generate_contents

void generate_contents(const std::string& tag, section& toplevel)
{
	toplevel.clear();
	hidden_sections.clear();

	const config *help_config = &game_cfg->find_child("book", "id", tag);
	if (!*help_config) {
		help_config = &dummy_cfg;
	}
	try {
		toplevel = parse_config(help_config);
		// Create a config object that contains everything that is
		// not referenced from the toplevel element. Read this
		// config and save these sections and topics so that they
		// can be referenced later on when showing help about
		// specified things, but that should not be shown when
		// opening the help browser in the default manner.
		config hidden_toplevel;
		std::stringstream ss;
		BOOST_FOREACH (const config &section, help_config->child_range("section"))
		{
			const std::string id = section["id"];
			if (find_section(toplevel, id) == NULL) {
				// This section does not exist referenced from the
				// toplevel. Hence, add it to the hidden ones if it
				// is not referenced from another section.
				if (!section_is_referenced(id, *help_config)) {
					if (ss.str() != "") {
						ss << ",";
					}
					ss << id;
				}
			}
		}
		hidden_toplevel["sections"] = ss.str();
		ss.str("");
		BOOST_FOREACH (const config &topic, help_config->child_range("topic"))
		{
			const std::string id = topic["id"];
			if (find_topic(toplevel, id) == NULL) {
				if (!topic_is_referenced(id, *help_config)) {
					if (ss.str() != "") {
						ss << ",";
					}
					ss << id;
				}
			}
		}
		hidden_toplevel["topics"] = ss.str();
		config hidden_cfg = *help_config;
		// Change the toplevel to our new, custom built one.
		hidden_cfg.clear_children("toplevel");
		hidden_cfg.add_child("toplevel", hidden_toplevel);
		hidden_sections = parse_config(&hidden_cfg);
	}
	catch (help::parse_error e) {
		std::stringstream msg;
		msg << "Parse error when parsing help text: '" << e.message << "'";
		VALIDATE(false, msg.str());
	}
}
开发者ID:hyrio,项目名称:War-Of-Kingdom,代码行数:61,代码来源:help.cpp


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