Convert OKeyType to scoped enum

Change-Id: Ic604991cdc0bf3e6dc5604a4a2b33f62b92f0915
Reviewed-on: https://gerrit.libreoffice.org/25355
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
This commit is contained in:
Noel Grandin
2016-05-23 10:20:13 +02:00
committed by Noel Grandin
parent 93e61f9663
commit 5785d6022b
4 changed files with 15 additions and 15 deletions

View File

@@ -45,7 +45,7 @@ struct TKeyValueFunc : ::std::binary_function<OSortIndex::TIntValuePairVector::v
// compare depending for type
switch (*aIter)
{
case SQL_ORDERBYKEY_STRING:
case OKeyType::String:
{
sal_Int32 nRes = lhs.second->getKeyString(i).compareTo(rhs.second->getKeyString(i));
if (nRes < 0)
@@ -54,7 +54,7 @@ struct TKeyValueFunc : ::std::binary_function<OSortIndex::TIntValuePairVector::v
return bGreater;
}
break;
case SQL_ORDERBYKEY_DOUBLE:
case OKeyType::Double:
{
double d1 = lhs.second->getKeyDouble(i);
double d2 = rhs.second->getKeyDouble(i);
@@ -65,7 +65,7 @@ struct TKeyValueFunc : ::std::binary_function<OSortIndex::TIntValuePairVector::v
return bGreater;
}
break;
case SQL_ORDERBYKEY_NONE:
case OKeyType::NONE:
break;
}
}
@@ -118,7 +118,7 @@ void OSortIndex::Freeze()
{
OSL_ENSURE(! m_bFrozen,"OSortIndex::Freeze: already frozen!");
// Sortierung:
if (m_aKeyType[0] != SQL_ORDERBYKEY_NONE)
if (m_aKeyType[0] != OKeyType::NONE)
// we will sort ourself when the first keyType say so
::std::sort(m_aKeyValues.begin(),m_aKeyValues.end(),TKeyValueFunc(this));

View File

@@ -1131,7 +1131,7 @@ void OResultSet::sortRows()
case DataType::CHAR:
case DataType::VARCHAR:
case DataType::LONGVARCHAR:
eKeyType[i] = SQL_ORDERBYKEY_STRING;
eKeyType[i] = OKeyType::String;
break;
case DataType::OTHER:
@@ -1146,12 +1146,12 @@ void OResultSet::sortRows()
case DataType::TIME:
case DataType::TIMESTAMP:
case DataType::BIT:
eKeyType[i] = SQL_ORDERBYKEY_DOUBLE;
eKeyType[i] = OKeyType::Double;
break;
// Other types aren't implemented (so they are always FALSE)
default:
eKeyType[i] = SQL_ORDERBYKEY_NONE;
eKeyType[i] = OKeyType::NONE;
SAL_WARN( "connectivity.drivers","OFILECursor::Execute: Datentyp nicht implementiert");
break;
}

View File

@@ -1162,7 +1162,7 @@ void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLExcep
{
case DataType::CHAR:
case DataType::VARCHAR:
eKeyType[i] = SQL_ORDERBYKEY_STRING;
eKeyType[i] = OKeyType::String;
break;
case DataType::OTHER:
@@ -1177,12 +1177,12 @@ void SAL_CALL OResultSet::executeQuery() throw( ::com::sun::star::sdbc::SQLExcep
case DataType::TIME:
case DataType::TIMESTAMP:
case DataType::BIT:
eKeyType[i] = SQL_ORDERBYKEY_DOUBLE;
eKeyType[i] = OKeyType::Double;
break;
// Other types aren't implemented (so they are always FALSE)
default:
eKeyType[i] = SQL_ORDERBYKEY_NONE;
eKeyType[i] = OKeyType::NONE;
OSL_FAIL("MResultSet::executeQuery: Order By Data Type not implemented");
break;
}

View File

@@ -24,12 +24,12 @@
namespace connectivity
{
typedef enum
enum class OKeyType
{
SQL_ORDERBYKEY_NONE, // do not sort
SQL_ORDERBYKEY_DOUBLE, // numeric key
SQL_ORDERBYKEY_STRING // String Key
} OKeyType;
NONE, // do not sort
Double, // numeric key
String // String Key
};
enum class TAscendingOrder
{