static long _NEAR cExpr6( void ) { long value; value = cExpr7(); for( ;; ) { if( currToken == T_EQ ) { value = doCompare( value, cExpr7 ) == 0; } else if( currToken == T_NE ) { value = doCompare( value, cExpr7 ) != 0; } else { break; } } return( value ); }
int XalanDOMString::compare(const XalanDOMChar* theString) const { invariants(); return doCompare(c_str(), length(), theString, length(theString)); }
static long _NEAR cExpr7( void ) { long value; value = cExpr8(); for( ;; ) { if( currToken == T_LT ) { value = doCompare( value, cExpr8 ) < 0; } else if( currToken == T_LE ) { value = doCompare( value, cExpr8 ) <= 0; } else if( currToken == T_GT ) { value = doCompare( value, cExpr8 ) > 0; } else if( currToken == T_GE ) { value = doCompare( value, cExpr8 ) >= 0; } else { break; } } return( value ); }
int XalanDOMString::compare( size_type thePosition1, size_type theCount1, const XalanDOMChar* theString, size_type theCount2) const { invariants(); return doCompare(c_str() + thePosition1, theCount1, theString, theCount2); }
bool LLAvatarItemComparator::compare(const LLPanel* item1, const LLPanel* item2) const { const LLAvatarListItem* avatar_item1 = dynamic_cast<const LLAvatarListItem*>(item1); const LLAvatarListItem* avatar_item2 = dynamic_cast<const LLAvatarListItem*>(item2); if (!avatar_item1 || !avatar_item2) { llerror("item1 and item2 cannot be null", 0); return true; } return doCompare(avatar_item1, avatar_item2); }
void tst_rcc::rcc() { QFETCH(QString, directory); QFETCH(QString, qrcfile); QFETCH(QString, expected); if (!QDir::setCurrent(directory)) { QString message = QString::fromLatin1("Unable to cd from '%1' to '%2'").arg(QDir::currentPath(), directory); QFAIL(qPrintable(message)); } // If the file expectedoutput.txt exists, compare the // console output with the content of that file const QString expected2 = findExpectedFile(expected); QFile expectedFile(expected2); if (!expectedFile.exists()) { qDebug() << "NO EXPECTATIONS? " << expected2; return; } // Launch const QString command = QLatin1String("rcc"); QProcess process; process.start(command, QStringList(qrcfile)); if (!process.waitForFinished()) { const QString path = QString::fromLocal8Bit(qgetenv("PATH")); QString message = QString::fromLatin1("'%1' could not be found when run from '%2'. Path: '%3' "). arg(command, QDir::currentPath(), path); QFAIL(qPrintable(message)); } const QChar cr = QLatin1Char('\r'); const QString err = QString::fromLocal8Bit(process.readAllStandardError()).remove(cr); const QString out = QString::fromLatin1(process.readAllStandardOutput()).remove(cr); if (!err.isEmpty()) { qDebug() << "UNEXPECTED STDERR CONTENTS: " << err; QFAIL("UNEXPECTED STDERR CONTENTS"); } const QChar nl = QLatin1Char('\n'); const QStringList actualLines = out.split(nl); QVERIFY(expectedFile.open(QIODevice::ReadOnly|QIODevice::Text)); const QStringList expectedLines = QString::fromLatin1(expectedFile.readAll()).split(nl); const QString diff = doCompare(actualLines, expectedLines); if (diff.size()) QFAIL(qPrintable(diff)); }
bool RowFilter::isAllowed(std::size_t row) const { Poco::Dynamic::Var retVal; const RecordSet& rs = recordSet(); std::size_t columns = rs.columnCount(); ComparisonMap::const_iterator it = _comparisonMap.begin(); ComparisonMap::const_iterator end = _comparisonMap.end(); for (; it != end; ++it) { for (std::size_t col = 0; col < columns; ++col) { const std::string name = toUpper(rs.metaColumn(static_cast<UInt32>(col)).name()); if (_comparisonMap.find(name) == _comparisonMap.end()) continue; Poco::Dynamic::Var ret; CompT compOp = 0; Poco::Dynamic::Var val = rs.value(col, row, false); switch (it->second.get<1>()) { case VALUE_LESS_THAN: compOp = less; break; case VALUE_LESS_THAN_OR_EQUAL: compOp = lessOrEqual; break; case VALUE_EQUAL: compOp = equal; break; case VALUE_GREATER_THAN: compOp = greater; break; case VALUE_GREATER_THAN_OR_EQUAL: compOp = greaterOrEqual; break; case VALUE_NOT_EQUAL: compOp = notEqual; break; case VALUE_IS_NULL: compOp = isNull; break; default: throw IllegalStateException("Unsupported comparison criteria."); } doCompare(ret, val, compOp, it->second); if (retVal.isEmpty()) retVal = ret; else retVal = retVal || ret; } } // iterate through children FilterMap::const_iterator fIt = _filterMap.begin(); FilterMap::const_iterator fEnd = _filterMap.end(); for (; fIt != fEnd; ++fIt) { if (OP_OR == fIt->second) { if (retVal.isEmpty()) retVal = fIt->first->isAllowed(row); else retVal = retVal || fIt->first->isAllowed(row); } else if (OP_AND == fIt->second) { if (retVal.isEmpty()) retVal = fIt->first->isAllowed(row); else retVal = retVal && fIt->first->isAllowed(row); } else throw IllegalStateException("Unknown logical operation."); } if (retVal.isEmpty()) retVal = true; // no filtering found return (!_not) && retVal.extract<bool>(); }