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


C++ context::pop方法代码示例

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


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

示例1: execute

void tag_usr::execute(context &ctx, std::ostream &out, const tag *caller) const {
	// create new context layer
	ctx.enter();
	try {
		for (parameters::const_iterator i = params.begin();
		  i != params.end(); ++i) {
			// create and initialize the variable from parameter
			ostringstream s;
			(i->second)->execute(ctx, s, this);
			ctx.add_value(i->first, s.str());
		}

		tag* t = user_tag;
		if (!t) {
			tag *p = parent;
			while (p && !(t = p->get_child("@" + name))) {
				p = p->get_parent();
			}
			if (!t)
				throw tag_exception(
				  (format(_("custom tag '{0}' is not defined at this scope")) % name).str());
		}

		// execute custom tag
		ctx.push(this);
		try {
			static_cast<tag_tag*>(t)->execute(ctx, out, this);
		} catch (...) {
			ctx.pop();
			throw;
		}
		ctx.pop();
	}
	catch (...) {
		// free context layer created
		ctx.leave();
		throw;
	}
	// free context layer created
	ctx.leave();
}
开发者ID:wolfsoft,项目名称:dbpager,代码行数:41,代码来源:tag_usr.cpp

示例2: execute

void tag_execute::execute(context &ctx, std::ostream &out, const tag *caller) const {
	const tag *c = ctx.pop();
	if (c) {
		const string &name = get_parameter(ctx, "name");
		if (!name.empty()) {
			tag_tag *t = static_cast<tag_tag*>(c->get_child(string("@") + name));
			if (!t)
				throw tag_exception(
				  (format(_("custom tag '{0}' is not defined at this scope")) % name).str());

			t->execute(ctx, out, c);
			ctx.push(c);

		} else {
			static_cast<const tag_usr*>(c)->execute_direct(ctx, out, this);
		}
	}
}
开发者ID:wolfsoft,项目名称:dbpager,代码行数:18,代码来源:tag_execute.cpp


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