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


C++ DataItem::empty方法代码示例

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


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

示例1: evaluate_this

bool Comparison::evaluate_this() {
	bool firstval = true;
	bool finished = false;
	bool unary_op = false;
	std::string saccumulator;
	double daccumulator = 0;
	pair<long long,bool> naccumulator;
	cmp_evaluated = true;
	if (cmp_evaluated && operation_result=='X') {	//all the comparators are evaluated but the operation is not
		DataItem* acc = nullptr;
		bool compare_bool = (logic == obyx::all ? true : false);	//if invert, then bool must be false.
		for ( unsigned int i = 0; (!finished  && i < inputs.size()); i++ ) {
			if (operation != found || inputs[i]->wotzit != comparate) {
				inputs[i]->evaluate();
			}
			if ( inputs[i]->wotzit == comparate ) {
				if (firstval) {
					switch(operation) {
						case obyx::found: {
							unary_op = true;
							std::set<std::string,less<std::string> > spacekeys;
							inputs[i]->evalfind(spacekeys);
							compare_bool = !spacekeys.empty();
						} break;
						case obyx::equivalent_to: {
							inputs[i]->results.takeresult(acc);
						} break;
						case obyx::exists: {
							inputs[i]->results.takeresult(acc);
							unary_op = true;
							compare_bool = inputs[i]->getexists();
						} break;	// compare_bool is true if it does exist.
						case obyx::is_empty: {
							inputs[i]->results.takeresult(acc);
							unary_op = true;
							compare_bool = (acc == nullptr || acc->empty());  
						} break; 
						case obyx::less_than: {
							inputs[i]->results.takeresult(acc);
							string sacc; if (acc != nullptr) { sacc = *acc; }
							daccumulator = String::real(sacc);
						} break; 
						case obyx::greater_than: {
							inputs[i]->results.takeresult(acc);
							string sacc; if (acc != nullptr) { sacc = *acc; }
							daccumulator = String::real(sacc);
						} break;
						case obyx::significant: {
							inputs[i]->results.takeresult(acc);
							unary_op = true;
							compare_bool = inputs[i]->getexists();  
							if (compare_bool) {
								compare_bool = (acc != nullptr && ! acc->empty());
							}
						} break;
						case obyx::cmp_true: { 
							inputs[i]->results.takeresult(acc);
							unary_op = true;
							string sacc; if (acc != nullptr) { sacc = *acc; }
							if (sacc.compare("true") == 0) { 
								compare_bool = true;
							} else {
								compare_bool = false;
								if (sacc.compare("false") != 0) { 
									*Logger::log << Log::error << Log::LI << "Error. Boolean mismatch. [" << sacc << "] found instead of true or false." << Log::LO;
									trace();
									*Logger::log << Log::blockend;									
								}
							}
						} break;
					}
				} else {
					DataItem* inpval= nullptr;
					if ( compare_bool || logic==obyx::any ) {
						bool compare_test = false;
						switch(operation) {
							case obyx::found: {
								std::set<std::string,less<std::string> > spacekeys;
								inputs[i]->evalfind(spacekeys);
								compare_test = !spacekeys.empty();
							} break;
							case obyx::exists: {
								inputs[i]->results.takeresult(inpval);
								compare_test = inputs[i]->getexists(); 
							} break;
							case obyx::is_empty: {
								inputs[i]->results.takeresult(inpval);
								compare_test = ( inpval == nullptr || inpval->empty() ); 
							} break;
							case obyx::significant: {
								inputs[i]->results.takeresult(inpval);
								compare_test = inputs[i]->getexists(); 
								if (compare_test) {
									compare_test = (inpval != nullptr && ! inpval->empty());
								}
							} break;
							case obyx::equivalent_to: {
								inputs[i]->results.takeresult(inpval);
								if (acc == nullptr) {
									compare_test = (inpval == nullptr);
//.........这里部分代码省略.........
开发者ID:RedSnapper,项目名称:Obyx,代码行数:101,代码来源:comparison.cpp


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