本文整理汇总了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);
//.........这里部分代码省略.........