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


C++ ArgParser::getInputFile方法代码示例

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


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

示例1: extractInitialCore

//	extracts a vector<expr> that represents a core input extracted with Utils::read_core_file method
//	return 0 if successful (core in resulting clause), or a positive integer if unsuccessful (with empty resultingClause). 
void CoreParser::extractInitialCore(expr& ast, ArgParser parser, vector<expr>& resultingCore) {
	vector<string> initialCore;
	read_core_file(parser.getInputFile(), initialCore);
	vector<expr> core;
	unsigned i;
	for (i = 0; i < initialCore.size(); ++i) {
		int index = -1;
		try {
			index = std::stoi(initialCore[i].substr(initialCore[i].find('c', 0)+1, initialCore[i].size() - 1)); // line should be of the form "C<num>" where C is a char and <num> is an integer between 0 and the number of clauses in the ast
		}
		catch (std::invalid_argument& e) {
			resultingCore.clear();
			throw PropsitionalCoreParserException((string(__func__) + ": ERROR in parsing clause named " + initialCore[i] + "at line " + std::to_string(i) + " in core file,  clause not named in the form 'C<num>' (for a given number num)").c_str(),3);
		}
		if (0 > index || ast.num_args() <= index) {
			resultingCore.clear();
			throw PropsitionalCoreParserException((string(__func__) + ": ERROR index "+ std::to_string(index) + ", at line " + std::to_string(i) + " in core file is out of bounds of formula.").c_str(),4);
		}
		resultingCore.push_back(ast.arg(index));
	}
}
开发者ID:HSmtMuc,项目名称:HSmtMuc,代码行数:23,代码来源:CoreParser.cpp


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