dbaccess/source/core/api/RowSet.cxx     |   10 +++++-----
 dbaccess/source/core/api/RowSetBase.cxx |   30 +++++++++++++++---------------
 dbaccess/source/core/api/RowSetBase.hxx |   10 +++++-----
 3 files changed, 25 insertions(+), 25 deletions(-)

New commits:
commit 270df129a428a7346f87ebd760cfd51780750592
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Wed Sep 7 08:46:02 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Sep 9 22:15:51 2022 +0200

    convert CursorMoveDirection to scoped enum
    
    Change-Id: I9ad59207fab6d3988b8c8106aec6c4fac21dc9d6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139734
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/dbaccess/source/core/api/RowSet.cxx 
b/dbaccess/source/core/api/RowSet.cxx
index bd826fcf5797..69f61044f0a9 100644
--- a/dbaccess/source/core/api/RowSet.cxx
+++ b/dbaccess/source/core/api/RowSet.cxx
@@ -974,7 +974,7 @@ void SAL_CALL ORowSet::deleteRow(  )
 
     // this call position the cache indirect
     Any aBookmarkToDelete( m_aBookmark );
-    positionCache( MOVE_NONE );
+    positionCache( CursorMoveDirection::Current );
     sal_Int32 nDeletePosition = m_pCache->getRow();
 
     notifyRowSetAndClonesRowDelete( aBookmarkToDelete );
@@ -1021,7 +1021,7 @@ void ORowSet::implCancelRowUpdates( bool _bNotifyModified 
)
     if ( m_bNew || m_nResultSetConcurrency == ResultSetConcurrency::READ_ONLY )
         throwFunctionSequenceException(*this);
 
-    positionCache( MOVE_NONE );
+    positionCache( CursorMoveDirection::Current );
 
     ORowSetRow aOldValues;
     if ( !m_bModified && _bNotifyModified && !m_aCurrentRow.isNull() )
@@ -1171,12 +1171,12 @@ void SAL_CALL ORowSet::moveToInsertRow(  )
     ORowSetRow aOldValues;
     if ( rowDeleted() )
     {
-        positionCache( MOVE_FORWARD );
+        positionCache( CursorMoveDirection::Forward );
         m_pCache->next();
         setCurrentRow( true, false, aOldValues, aGuard);
     }
     else
-        positionCache( MOVE_NONE );
+        positionCache( CursorMoveDirection::Current );
 
     // check before because the resultset could be empty
     if  (   !m_bBeforeFirst
@@ -1265,7 +1265,7 @@ void SAL_CALL ORowSet::moveToCurrentRow(  )
     if ( !notifyAllListenersCursorBeforeMove( aGuard ) )
         return;
 
-    positionCache( MOVE_NONE_REFRESH );
+    positionCache( CursorMoveDirection::CurrentRefresh );
 
     ORowSetNotifier aNotifier( this );
 
diff --git a/dbaccess/source/core/api/RowSetBase.cxx 
b/dbaccess/source/core/api/RowSetBase.cxx
index e6eddc57eef5..753c857eecc0 100644
--- a/dbaccess/source/core/api/RowSetBase.cxx
+++ b/dbaccess/source/core/api/RowSetBase.cxx
@@ -207,7 +207,7 @@ const ORowSetValue& ORowSetBase::impl_getValue(sal_Int32 
columnIndex)
     if ( !bValidCurrentRow )
     {
         // currentrow is null when the clone moves the window
-        positionCache( MOVE_NONE );
+        positionCache( CursorMoveDirection::Current );
         m_aCurrentRow   = m_pCache->m_aMatrixIter;
         m_bIsInsertRow  = false;
         OSL_ENSURE(!m_aCurrentRow.isNull(),"ORowSetBase::getValue: we don't 
stand on a valid row! Row is null.");
@@ -338,7 +338,7 @@ Reference< css::io::XInputStream > SAL_CALL 
ORowSetBase::getBinaryStream( sal_In
     bool bValidCurrentRow = ( !m_aCurrentRow.isNull() && m_aCurrentRow != 
m_pCache->getEnd() && m_aCurrentRow->is() );
     if ( !bValidCurrentRow )
     {
-        positionCache( MOVE_NONE );
+        positionCache( CursorMoveDirection::Current );
         m_aCurrentRow   = m_pCache->m_aMatrixIter;
         m_bIsInsertRow  = false;
         OSL_ENSURE(!m_aCurrentRow.isNull(),"ORowSetBase::getBinaryStream: we 
don't stand on a valid row! Row is null.");
@@ -579,7 +579,7 @@ sal_Bool SAL_CALL ORowSetBase::next(  )
 
         ORowSetRow aOldValues = getOldRow(bWasNew);
 
-        positionCache( MOVE_FORWARD );
+        positionCache( CursorMoveDirection::Forward );
         bool bAfterLast = m_pCache->isAfterLast();
         bRet = m_pCache->next();
         doCancelModification( );
@@ -662,7 +662,7 @@ sal_Bool SAL_CALL ORowSetBase::isFirst(  )
     if ( impl_rowDeleted() )
         return ( m_nDeletedPosition == 1 );
 
-    positionCache( MOVE_NONE );
+    positionCache( CursorMoveDirection::Current );
     bool bIsFirst = m_pCache->isFirst();
 
     SAL_INFO("dbaccess", "ORowSetBase::isFirst() = " << bIsFirst << " Clone = 
" << m_bClone);
@@ -692,7 +692,7 @@ sal_Bool SAL_CALL ORowSetBase::isLast(  )
             return ( m_nDeletedPosition == impl_getRowCount() );
     }
 
-    positionCache( MOVE_NONE );
+    positionCache( CursorMoveDirection::Current );
     bool bIsLast = m_pCache->isLast();
 
     SAL_INFO("dbaccess", "ORowSetBase::isLast() = " << bIsLast << " Clone = " 
<< m_bClone);
@@ -864,7 +864,7 @@ sal_Int32 ORowSetBase::impl_getRow()
         nPos = 0;
     else
     {
-        positionCache( MOVE_NONE );
+        positionCache( CursorMoveDirection::Current );
         nPos = m_pCache->getRow();
     }
     SAL_INFO("dbaccess", "ORowSetBase::impl_getRow() = " << nPos << " Clone = 
" << m_bClone);
@@ -944,7 +944,7 @@ sal_Bool SAL_CALL ORowSetBase::relative( sal_Int32 rows )
 
         ORowSetRow aOldValues = getOldRow(bWasNew);
 
-        positionCache( rows > 0 ? MOVE_FORWARD : MOVE_BACKWARD );
+        positionCache( rows > 0 ? CursorMoveDirection::Forward : 
CursorMoveDirection::Backward );
         bRet = m_pCache->relative(rows);
         doCancelModification( );
 
@@ -992,7 +992,7 @@ sal_Bool SAL_CALL ORowSetBase::previous(  )
 
         ORowSetRow aOldValues = getOldRow(bWasNew);
 
-        positionCache( MOVE_BACKWARD );
+        positionCache( CursorMoveDirection::Backward );
         bRet = m_pCache->previous();
         doCancelModification( );
 
@@ -1095,7 +1095,7 @@ void SAL_CALL ORowSetBase::refreshRow(  )
     {
         bool bWasNew = m_pCache->m_bNew || impl_rowDeleted();
         ORowSetRow aOldValues = getOldRow(bWasNew);
-        positionCache( MOVE_NONE );
+        positionCache( CursorMoveDirection::Current );
         m_pCache->refreshRow();
         firePropertyChange(aOldValues);
     }
@@ -1225,7 +1225,7 @@ void ORowSetBase::positionCache( CursorMoveDirection 
_ePrepareForDirection )
     bool bSuccess = false;
     if ( m_aBookmark.hasValue() )
     {
-        if (_ePrepareForDirection == MOVE_NONE_REFRESH ||
+        if (_ePrepareForDirection == CursorMoveDirection::CurrentRefresh ||
             (m_pCache->isAfterLast() != bool(isAfterLast())) || ( 
m_pCache->isBeforeFirst() != bool(isBeforeFirst()) ) ||
              m_pCache->compareBookmarks( m_aBookmark, m_pCache->getBookmark() 
) != CompareBookmark::EQUAL )
             bSuccess = m_pCache->moveToBookmark( m_aBookmark );
@@ -1249,7 +1249,7 @@ void ORowSetBase::positionCache( CursorMoveDirection 
_ePrepareForDirection )
             OSL_ENSURE( m_nDeletedPosition >= 1, "ORowSetBase::positionCache: 
no bookmark, and no valid 'deleted position'!" );
             switch ( _ePrepareForDirection )
             {
-            case MOVE_FORWARD:
+            case CursorMoveDirection::Forward:
                 if ( m_nDeletedPosition > 1 )
                     bSuccess = m_pCache->absolute( m_nDeletedPosition - 1 );
                 else
@@ -1259,7 +1259,7 @@ void ORowSetBase::positionCache( CursorMoveDirection 
_ePrepareForDirection )
                 }
                 break;
 
-            case MOVE_BACKWARD:
+            case CursorMoveDirection::Backward:
                 if ( m_pCache->m_bRowCountFinal && ( m_nDeletedPosition == 
impl_getRowCount() ) )
                 {
                     m_pCache->afterLast();
@@ -1269,8 +1269,8 @@ void ORowSetBase::positionCache( CursorMoveDirection 
_ePrepareForDirection )
                     bSuccess = m_pCache->absolute( m_nDeletedPosition );
                 break;
 
-            case MOVE_NONE:
-            case MOVE_NONE_REFRESH:
+            case CursorMoveDirection::Current:
+            case CursorMoveDirection::CurrentRefresh:
                 bSuccess = false;   // will be asserted below
                 break;
             }
@@ -1324,7 +1324,7 @@ void ORowSetBase::onDeleteRow( const Any& _rBookmark )
     //OSL_ENSURE( m_aBookmark.hasValue(), "ORowSetBase::onDeleteRow: Bookmark 
isn't valid!" );
     if ( compareBookmarks( _rBookmark, m_aBookmark ) == CompareBookmark::EQUAL 
)
     {
-        positionCache( MOVE_NONE );
+        positionCache( CursorMoveDirection::Current );
         m_nDeletedPosition = m_pCache->getRow();
     }
 }
diff --git a/dbaccess/source/core/api/RowSetBase.hxx 
b/dbaccess/source/core/api/RowSetBase.hxx
index 8cce9d46f3f3..a721a1a4229d 100644
--- a/dbaccess/source/core/api/RowSetBase.hxx
+++ b/dbaccess/source/core/api/RowSetBase.hxx
@@ -143,16 +143,16 @@ namespace dbaccess
         virtual void getPropertyDefaultByHandle( sal_Int32 _nHandle, 
css::uno::Any& _rDefault ) const override;
         virtual void SAL_CALL getFastPropertyValue(css::uno::Any& 
rValue,sal_Int32 nHandle) const override;
 
-        enum CursorMoveDirection
+        enum class CursorMoveDirection
         {
             /// denotes a cursor move forward
-            MOVE_FORWARD,
+            Forward,
             /// denotes a cursor  move backwards
-            MOVE_BACKWARD,
+            Backward,
             /// denotes no cursor move at all, but move cache to current row 
(if it is not there already)
-            MOVE_NONE,
+            Current,
             /// denotes no cursor move at all, but force the cache to move to 
current row (and refresh the row)
-            MOVE_NONE_REFRESH
+            CurrentRefresh
         };
         /** positions the cache in preparation of a cursor move
 

Reply via email to