loplugin:simplifybool

Change-Id: Ib0290487a963d665a628bd75f4140a9e2b89faa7
This commit is contained in:
Stephan Bergmann
2015-04-24 12:25:07 +02:00
parent 820fca753b
commit cf7f31c1d6
4 changed files with 11 additions and 13 deletions

View File

@@ -40,7 +40,7 @@ struct TKeyValueFunc : ::std::binary_function<OSortIndex::TIntValuePairVector::v
::std::vector<OKeyType>::const_iterator aIter = aKeyType.begin();
for (::std::vector<sal_Int16>::size_type i=0;aIter != aKeyType.end(); ++aIter,++i)
{
const bool nGreater = (pIndex->getAscending(i) == SQL_ASC) ? false : true;
const bool nGreater = pIndex->getAscending(i) != SQL_ASC;
const bool nLess = !nGreater;
// compare depending for type

View File

@@ -271,9 +271,7 @@ KabOrder *KabCommonStatement::analyseOrderByClause(const OSQLParseNode *pParseNo
OUString sColumnName =
pColumnRef->getChild(0)->getTokenValue();
bool bAscending =
SQL_ISTOKEN(pAscendingDescending, DESC)?
false:
true;
!SQL_ISTOKEN(pAscendingDescending, DESC);
return new KabSimpleOrder(sColumnName, bAscending);
}

View File

@@ -298,22 +298,22 @@ sal_Int32 MQueryHelper::executeQuery(OConnection* xConnection, MQueryExpression
OUString searchedValue = evStr->getValue();
if (evStr->getCond() == MQueryOp::Is) {
SAL_INFO("connectivity.mork", "MQueryOp::Is; done");
resultVector.push_back((currentValue == searchedValue) ? true : false);
resultVector.push_back(currentValue == searchedValue);
} else if (evStr->getCond() == MQueryOp::IsNot) {
SAL_INFO("connectivity.mork", "MQueryOp::IsNot; done");
resultVector.push_back((currentValue == searchedValue) ? false : true);
resultVector.push_back(currentValue != searchedValue);
} else if (evStr->getCond() == MQueryOp::EndsWith) {
SAL_INFO("connectivity.mork", "MQueryOp::EndsWith; done");
resultVector.push_back((currentValue.endsWith(searchedValue)) ? true : false);
resultVector.push_back(currentValue.endsWith(searchedValue));
} else if (evStr->getCond() == MQueryOp::BeginsWith) {
SAL_INFO("connectivity.mork", "MQueryOp::BeginsWith; done");
resultVector.push_back((currentValue.startsWith(searchedValue)) ? true : false);
resultVector.push_back(currentValue.startsWith(searchedValue));
} else if (evStr->getCond() == MQueryOp::Contains) {
SAL_INFO("connectivity.mork", "MQueryOp::Contains; done");
resultVector.push_back((currentValue.indexOf(searchedValue) == -1) ? false : true);
resultVector.push_back(currentValue.indexOf(searchedValue) != -1);
} else if (evStr->getCond() == MQueryOp::DoesNotContain) {
SAL_INFO("connectivity.mork", "MQueryOp::DoesNotContain; done");
resultVector.push_back((currentValue.indexOf(searchedValue) == -1) ? true : false);
resultVector.push_back(currentValue.indexOf(searchedValue) == -1);
} else if (evStr->getCond() == MQueryOp::RegExp) {
SAL_INFO("connectivity.mork", "MQueryOp::RegExp; done");
utl::SearchParam param(
@@ -326,10 +326,10 @@ sal_Int32 MQueryHelper::executeQuery(OConnection* xConnection, MQueryExpression
}
} else if (evStr->getCond() == MQueryOp::Exists) {
SAL_INFO("connectivity.mork", "MQueryOp::Exists; done");
resultVector.push_back((currentValue.isEmpty()) ? false : true);
resultVector.push_back(!currentValue.isEmpty());
} else if (evStr->getCond() == MQueryOp::DoesNotExist) {
SAL_INFO("connectivity.mork", "MQueryOp::DoesNotExist; done");
resultVector.push_back((currentValue.isEmpty()) ? true : false);
resultVector.push_back(currentValue.isEmpty());
}
}
else if ( (*evIter)->isExpr() ) {

View File

@@ -316,7 +316,7 @@ namespace connectivity
// we the possibility to save a any for bookmarks
ORowSetValue& operator=(const ::com::sun::star::uno::Any& _rAny);
operator bool() const { return isNull() ? false : getBool(); }
operator bool() const { return !isNull() && getBool(); }
operator sal_Int8() const { return isNull() ? static_cast<sal_Int8>(0) : getInt8(); }
operator sal_uInt8() const { return isNull() ? static_cast<sal_uInt8>(0) : getUInt8(); }