basic/source/runtime/methods1.cxx |   94 +++++++++++++++++++-------------------
 1 file changed, 47 insertions(+), 47 deletions(-)

New commits:
commit 74d678191ac3fff6a3a1e9560763ea5870fabcf1
Author:     Simon Chenery <[email protected]>
AuthorDate: Sat Dec 13 19:43:41 2025 +0100
Commit:     David Gilbert <[email protected]>
CommitDate: Sat Dec 20 17:30:10 2025 +0100

    tdf#168771 Convert enum to enum class in methods1.cxx
    
    Change-Id: I7f9894db5ce74ca507ad05967a08dd7fab6ad33d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195608
    Tested-by: Jenkins
    Reviewed-by: David Gilbert <[email protected]>

diff --git a/basic/source/runtime/methods1.cxx 
b/basic/source/runtime/methods1.cxx
index 37e3c18953fd..f2a628b6c658 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -1655,18 +1655,18 @@ void SbRtl_Weekday(StarBASIC *, SbxArray & rPar, bool)
 
 namespace {
 
-enum Interval
-{
-    INTERVAL_YYYY,
-    INTERVAL_Q,
-    INTERVAL_M,
-    INTERVAL_Y,
-    INTERVAL_D,
-    INTERVAL_W,
-    INTERVAL_WW,
-    INTERVAL_H,
-    INTERVAL_N,
-    INTERVAL_S
+enum class Interval
+{
+    YYYY,
+    Q,
+    M,
+    Y,
+    D,
+    W,
+    WW,
+    H,
+    N,
+    S
 };
 
 struct IntervalInfo
@@ -1683,16 +1683,16 @@ static IntervalInfo const * getIntervalInfo( const 
OUString& rStringCode )
 {
     static IntervalInfo const aIntervalTable[] =
     {
-        { INTERVAL_YYYY, "yyyy", 0.0,           false }, // Year
-        { INTERVAL_Q,    "q",    0.0,           false }, // Quarter
-        { INTERVAL_M,    "m",    0.0,           false }, // Month
-        { INTERVAL_Y,    "y",    1.0,           true  }, // Day of year
-        { INTERVAL_D,    "d",    1.0,           true  }, // Day
-        { INTERVAL_W,    "w",    1.0,           true  }, // Weekday
-        { INTERVAL_WW,   "ww",   7.0,           true  }, // Week
-        { INTERVAL_H,    "h",    1.0 /    24.0, true  }, // Hour
-        { INTERVAL_N,    "n",    1.0 /  1440.0, true  }, // Minute
-        { INTERVAL_S,    "s",    1.0 / 86400.0, true  }  // Second
+        { Interval::YYYY, "yyyy", 0.0,           false }, // Year
+        { Interval::Q,    "q",    0.0,           false }, // Quarter
+        { Interval::M,    "m",    0.0,           false }, // Month
+        { Interval::Y,    "y",    1.0,           true  }, // Day of year
+        { Interval::D,    "d",    1.0,           true  }, // Day
+        { Interval::W,    "w",    1.0,           true  }, // Weekday
+        { Interval::WW,   "ww",   7.0,           true  }, // Week
+        { Interval::H,    "h",    1.0 /    24.0, true  }, // Hour
+        { Interval::N,    "n",    1.0 /  1440.0, true  }, // Minute
+        { Interval::S,    "s",    1.0 / 86400.0, true  }  // Second
     };
     auto const pred = [&rStringCode](const IntervalInfo &aInterval) {
             return 
rStringCode.equalsIgnoreAsciiCaseAscii(aInterval.mStringCode);
@@ -1770,7 +1770,7 @@ void SbRtl_DateAdd(StarBASIC *, SbxArray & rPar, bool)
         implGetDayMonthYear( nYear, nMonth, nDay, dDate );
         switch( pInfo->meInterval )
         {
-            case INTERVAL_YYYY:
+            case Interval::YYYY:
             {
                 sal_Int32 nTargetYear = lNumber + nYear;
                 nTargetYear16 = limitDate( nTargetYear, nMonth, nDay );
@@ -1779,15 +1779,15 @@ void SbRtl_DateAdd(StarBASIC *, SbxArray & rPar, bool)
                 bOk = implDateSerial( nTargetYear16, nTargetMonth, nDay, 
false, SbDateCorrection::TruncateToMonth, dNewDate );
                 break;
             }
-            case INTERVAL_Q:
-            case INTERVAL_M:
+            case Interval::Q:
+            case Interval::M:
             {
                 bool bNeg = (lNumber < 0);
                 if( bNeg )
                     lNumber = -lNumber;
                 sal_Int32 nYearsAdd;
                 sal_Int16 nMonthAdd;
-                if( pInfo->meInterval == INTERVAL_Q )
+                if( pInfo->meInterval == Interval::Q )
                 {
                     nYearsAdd = lNumber / 4;
                     nMonthAdd = static_cast<sal_Int16>( 3 * (lNumber % 4) );
@@ -1864,14 +1864,14 @@ void SbRtl_DateDiff(StarBASIC *, SbxArray & rPar, bool)
     double dRet = 0.0;
     switch( pInfo->meInterval )
     {
-        case INTERVAL_YYYY:
+        case Interval::YYYY:
         {
             sal_Int16 nYear1 = implGetDateYear( dDate1 );
             sal_Int16 nYear2 = implGetDateYear( dDate2 );
             dRet = nYear2 - nYear1;
             break;
         }
-        case INTERVAL_Q:
+        case Interval::Q:
         {
             sal_Int16 nYear1 = implGetDateYear( dDate1 );
             sal_Int16 nYear2 = implGetDateYear( dDate2 );
@@ -1882,7 +1882,7 @@ void SbRtl_DateDiff(StarBASIC *, SbxArray & rPar, bool)
             dRet = nQGes2 - nQGes1;
             break;
         }
-        case INTERVAL_M:
+        case Interval::M:
         {
             sal_Int16 nYear1 = implGetDateYear( dDate1 );
             sal_Int16 nYear2 = implGetDateYear( dDate2 );
@@ -1893,20 +1893,20 @@ void SbRtl_DateDiff(StarBASIC *, SbxArray & rPar, bool)
             dRet = nMonthGes2 - nMonthGes1;
             break;
         }
-        case INTERVAL_Y:
-        case INTERVAL_D:
+        case Interval::Y:
+        case Interval::D:
         {
             double dDays1 = floor( dDate1 );
             double dDays2 = floor( dDate2 );
             dRet = dDays2 - dDays1;
             break;
         }
-        case INTERVAL_W:
-        case INTERVAL_WW:
+        case Interval::W:
+        case Interval::WW:
         {
             double dDays1 = floor( dDate1 );
             double dDays2 = floor( dDate2 );
-            if( pInfo->meInterval == INTERVAL_WW )
+            if( pInfo->meInterval == Interval::WW )
             {
                 sal_Int16 nFirstDay = 1;    // Default
                 if( nParCount >= 5 )
@@ -1945,17 +1945,17 @@ void SbRtl_DateDiff(StarBASIC *, SbxArray & rPar, bool)
             dRet = ( dDiff >= 0 ) ? floor( dDiff / 7.0 ) : -floor( -dDiff / 
7.0 );
             break;
         }
-        case INTERVAL_H:
+        case Interval::H:
         {
             dRet = RoundImpl( 24.0 * (dDate2 - dDate1) );
             break;
         }
-        case INTERVAL_N:
+        case Interval::N:
         {
             dRet = RoundImpl( 1440.0 * (dDate2 - dDate1) );
             break;
         }
-        case INTERVAL_S:
+        case Interval::S:
         {
             dRet = RoundImpl( 86400.0 * (dDate2 - dDate1) );
             break;
@@ -2054,22 +2054,22 @@ void SbRtl_DatePart(StarBASIC *, SbxArray & rPar, bool)
     sal_Int32 nRet = 0;
     switch( pInfo->meInterval )
     {
-        case INTERVAL_YYYY:
+        case Interval::YYYY:
         {
             nRet = implGetDateYear( dDate );
             break;
         }
-        case INTERVAL_Q:
+        case Interval::Q:
         {
             nRet = 1 + (implGetDateMonth( dDate ) - 1) / 3;
             break;
         }
-        case INTERVAL_M:
+        case Interval::M:
         {
             nRet = implGetDateMonth( dDate );
             break;
         }
-        case INTERVAL_Y:
+        case Interval::Y:
         {
             sal_Int16 nYear = implGetDateYear( dDate );
             double dBaseDate;
@@ -2077,12 +2077,12 @@ void SbRtl_DatePart(StarBASIC *, SbxArray & rPar, bool)
             nRet = 1 + sal_Int32( dDate - dBaseDate );
             break;
         }
-        case INTERVAL_D:
+        case Interval::D:
         {
             nRet = implGetDateDay( dDate );
             break;
         }
-        case INTERVAL_W:
+        case Interval::W:
         {
             bool bFirstDay = false;
             sal_Int16 nFirstDay = 1;    // Default
@@ -2094,7 +2094,7 @@ void SbRtl_DatePart(StarBASIC *, SbxArray & rPar, bool)
             nRet = implGetWeekDay( dDate, bFirstDay, nFirstDay );
             break;
         }
-        case INTERVAL_WW:
+        case Interval::WW:
         {
             sal_Int16 nFirstDay = 1;    // Default
             if( nParCount >= 4 )
@@ -2128,17 +2128,17 @@ void SbRtl_DatePart(StarBASIC *, SbxArray & rPar, bool)
             }
             break;
         }
-        case INTERVAL_H:
+        case Interval::H:
         {
             nRet = implGetHour( dDate );
             break;
         }
-        case INTERVAL_N:
+        case Interval::N:
         {
             nRet = implGetMinute( dDate );
             break;
         }
-        case INTERVAL_S:
+        case Interval::S:
         {
             nRet = implGetSecond( dDate );
             break;

Reply via email to