diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-05-02 14:51:24 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-05-04 08:25:51 +0200 |
commit | 7d070fa5e4b055501cc59d3ea1b4e049db4bd4ae (patch) | |
tree | ed8c9017e382f1edada2a609557e149eee7da04a /sw/source | |
parent | e5398610203cfb4491de680273cb900eda1a5437 (diff) |
replace createFromAscii with OUString literals in SwCalc
Change-Id: I9da38ff8897eeeebdb7d5ff2766414d3d406d53f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167091
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/bastyp/calc.cxx | 60 | ||||
-rw-r--r-- | sw/source/core/frmedt/fetab.cxx | 2 |
2 files changed, 12 insertions, 50 deletions
diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx index 4b793a6ece99..72b8661e5207 100644 --- a/sw/source/core/bastyp/calc.cxx +++ b/sw/source/core/bastyp/calc.cxx @@ -55,53 +55,15 @@ using namespace ::com::sun::star; -const char sCalc_Add[] = "add"; -const char sCalc_Sub[] = "sub"; -const char sCalc_Mul[] = "mul"; -const char sCalc_Div[] = "div"; -const char sCalc_Phd[] = "phd"; -const char sCalc_Sqrt[] = "sqrt"; -const char sCalc_Pow[] = "pow"; -const char sCalc_Or[] = "or"; -const char sCalc_Xor[] = "xor"; -const char sCalc_And[] = "and"; -const char sCalc_Not[] = "not"; -const char sCalc_Eq[] = "eq"; -const char sCalc_Neq[] = "neq"; -const char sCalc_Leq[] = "leq"; -const char sCalc_Geq[] = "geq"; -const char sCalc_L[] = "l"; -const char sCalc_G[] = "g"; -const char sCalc_Sum[] = "sum"; -const char sCalc_Mean[] = "mean"; -const char sCalc_Min[] = "min"; -const char sCalc_Max[] = "max"; -const char sCalc_Sin[] = "sin"; -const char sCalc_Cos[] = "cos"; -const char sCalc_Tan[] = "tan"; -const char sCalc_Asin[] = "asin"; -const char sCalc_Acos[] = "acos"; -const char sCalc_Atan[] = "atan"; -const char sCalc_Round[]= "round"; -const char sCalc_Date[] = "date"; -const char sCalc_Product[] = "product"; -const char sCalc_Average[] = "average"; -const char sCalc_Count[]= "count"; -const char sCalc_Sign[] = "sign"; -const char sCalc_Abs[] = "abs"; -const char sCalc_Int[] = "int"; // ATTENTION: sorted list of all operators struct CalcOp { - union{ - const char* pName; - const OUString* pUName; - }; + OUString aName; SwCalcOper eOp; }; -CalcOp const aOpTable[] = { +CalcOp constexpr aOpTable[] = { /* ABS */ {{sCalc_Abs}, CALC_ABS}, // Abs (since LibreOffice 7.1) /* ACOS */ {{sCalc_Acos}, CALC_ACOS}, // Arc cosine /* ADD */ {{sCalc_Add}, CALC_PLUS}, // Addition @@ -163,20 +125,20 @@ static int OperatorCompare( const void *pFirst, const void *pSecond) if( CALC_NAME == static_cast<const CalcOp*>(pFirst)->eOp ) { if( CALC_NAME == static_cast<const CalcOp*>(pSecond)->eOp ) - nRet = static_cast<const CalcOp*>(pFirst)->pUName->compareTo( - *static_cast<const CalcOp*>(pSecond)->pUName ); + nRet = static_cast<const CalcOp*>(pFirst)->aName.compareTo( + static_cast<const CalcOp*>(pSecond)->aName ); else - nRet = static_cast<const CalcOp*>(pFirst)->pUName->compareToAscii( - static_cast<const CalcOp*>(pSecond)->pName ); + nRet = static_cast<const CalcOp*>(pFirst)->aName.compareTo( + static_cast<const CalcOp*>(pSecond)->aName ); } else { if( CALC_NAME == static_cast<const CalcOp*>(pSecond)->eOp ) - nRet = -1 * static_cast<const CalcOp*>(pSecond)->pUName->compareToAscii( - static_cast<const CalcOp*>(pFirst)->pName ); + nRet = -1 * static_cast<const CalcOp*>(pSecond)->aName.compareTo( + static_cast<const CalcOp*>(pFirst)->aName ); else - nRet = strcmp( static_cast<const CalcOp*>(pFirst)->pName, - static_cast<const CalcOp*>(pSecond)->pName ); + nRet = static_cast<const CalcOp*>(pFirst)->aName.compareTo( + static_cast<const CalcOp*>(pSecond)->aName ); } return nRet; } @@ -185,7 +147,7 @@ static int OperatorCompare( const void *pFirst, const void *pSecond) CalcOp* FindOperator( const OUString& rSrch ) { CalcOp aSrch; - aSrch.pUName = &rSrch; + aSrch.aName = rSrch; aSrch.eOp = CALC_NAME; return static_cast<CalcOp*>(bsearch( static_cast<void*>(&aSrch), diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx index 7bf0ccc7fa72..7997d12f22f4 100644 --- a/sw/source/core/frmedt/fetab.cxx +++ b/sw/source/core/frmedt/fetab.cxx @@ -2494,7 +2494,7 @@ void SwFEShell::GetAutoSum( OUString& rFormula ) const } } - rFormula = OUString::createFromAscii( sCalc_Sum ); + rFormula = sCalc_Sum; if (!sFields.isEmpty()) { rFormula += "(" + sFields + ")"; |