summaryrefslogtreecommitdiff
path: root/sccomp
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-07-19 13:18:49 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-08-05 09:39:11 +0200
commit14cfff500e93f0d6cbf8412065feea85c01ea81d (patch)
tree76e3fb8fbf2b0d8a12c8406d8cf994ea6a37aaff /sccomp
parentd924ce30e0ca260682bd2aed192b8b1b2ca3e7c0 (diff)
Pass context and resource string down to boost::locale separately
because this is often on a hot path, and we can avoid the splitting and joining of strings like this. Change-Id: Ia36047209368ca53431178c2e8723a18cfe8260a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119220 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sccomp')
-rw-r--r--sccomp/inc/strings.hrc2
-rw-r--r--sccomp/source/solver/CoinMPSolver.cxx1
-rw-r--r--sccomp/source/solver/LpsolveSolver.cxx1
-rw-r--r--sccomp/source/solver/SolverComponent.cxx4
-rw-r--r--sccomp/source/solver/SolverComponent.hxx3
-rw-r--r--sccomp/source/solver/SwarmSolver.cxx8
6 files changed, 11 insertions, 8 deletions
diff --git a/sccomp/inc/strings.hrc b/sccomp/inc/strings.hrc
index 1ffff8a0446a..4fe4932debad 100644
--- a/sccomp/inc/strings.hrc
+++ b/sccomp/inc/strings.hrc
@@ -19,7 +19,7 @@
#pragma once
-#define NC_(Context, String) reinterpret_cast<char const *>(Context "\004" u8##String)
+#define NC_(Context, String) TranslateId(Context, reinterpret_cast<char const *>(u8##String))
#define RID_SOLVER_COMPONENT NC_("RID_SOLVER_COMPONENT", "%PRODUCTNAME Linear Solver")
#define RID_COINMP_SOLVER_COMPONENT NC_("RID_COINMP_SOLVER_COMPONENT", "%PRODUCTNAME CoinMP Linear Solver")
diff --git a/sccomp/source/solver/CoinMPSolver.cxx b/sccomp/source/solver/CoinMPSolver.cxx
index 35ebf1fd19b2..2dd896e82bb1 100644
--- a/sccomp/source/solver/CoinMPSolver.cxx
+++ b/sccomp/source/solver/CoinMPSolver.cxx
@@ -25,6 +25,7 @@
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/table/CellAddress.hpp>
+#include <unotools/resmgr.hxx>
#include <rtl/math.hxx>
#include <stdexcept>
diff --git a/sccomp/source/solver/LpsolveSolver.cxx b/sccomp/source/solver/LpsolveSolver.cxx
index e53c685555d8..229c5f0c3dbe 100644
--- a/sccomp/source/solver/LpsolveSolver.cxx
+++ b/sccomp/source/solver/LpsolveSolver.cxx
@@ -56,6 +56,7 @@
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/table/CellAddress.hpp>
+#include <unotools/resmgr.hxx>
#include <rtl/math.hxx>
#include <memory>
#include <vector>
diff --git a/sccomp/source/solver/SolverComponent.cxx b/sccomp/source/solver/SolverComponent.cxx
index 7c92233522d4..e31a84073337 100644
--- a/sccomp/source/solver/SolverComponent.cxx
+++ b/sccomp/source/solver/SolverComponent.cxx
@@ -41,7 +41,7 @@ constexpr OUStringLiteral STR_LIMITBBDEPTH = u"LimitBBDepth";
// Resources from tools are used for translated strings
-OUString SolverComponent::GetResourceString(std::string_view aId)
+OUString SolverComponent::GetResourceString(TranslateId aId)
{
return Translate::get(aId, Translate::Create("scc"));
}
@@ -140,7 +140,7 @@ OUString SAL_CALL SolverComponent::getStatusDescription()
OUString SAL_CALL SolverComponent::getPropertyDescription( const OUString& rPropertyName )
{
- const char* pResId = nullptr;
+ TranslateId pResId;
sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
switch (nHandle)
{
diff --git a/sccomp/source/solver/SolverComponent.hxx b/sccomp/source/solver/SolverComponent.hxx
index 0c3869bdd4b4..4e10c038a474 100644
--- a/sccomp/source/solver/SolverComponent.hxx
+++ b/sccomp/source/solver/SolverComponent.hxx
@@ -27,6 +27,7 @@
#include <comphelper/broadcasthelper.hxx>
#include <comphelper/propertycontainer.hxx>
#include <comphelper/proparrhlp.hxx>
+#include <unotools/resmgr.hxx>
#include <unordered_map>
@@ -82,7 +83,7 @@ protected:
css::uno::Sequence< double > maSolution;
OUString maStatus;
- static OUString GetResourceString(std::string_view aId);
+ static OUString GetResourceString(TranslateId aId);
static css::uno::Reference<css::table::XCell> GetCell(
const css::uno::Reference<css::sheet::XSpreadsheetDocument>& xDoc,
const css::table::CellAddress& rPos );
diff --git a/sccomp/source/solver/SwarmSolver.cxx b/sccomp/source/solver/SwarmSolver.cxx
index 5ebeedfc032c..c0dad8a4471d 100644
--- a/sccomp/source/solver/SwarmSolver.cxx
+++ b/sccomp/source/solver/SwarmSolver.cxx
@@ -130,7 +130,7 @@ private:
std::vector<sheet::SolverConstraint> maNonBoundedConstraints;
private:
- static OUString getResourceString(std::string_view aId);
+ static OUString getResourceString(TranslateId aId);
uno::Reference<table::XCell> getCell(const table::CellAddress& rPosition);
void setValue(const table::CellAddress& rPosition, double fValue);
@@ -233,7 +233,7 @@ public:
virtual OUString SAL_CALL getPropertyDescription(const OUString& rPropertyName) override
{
- const char* pResId = "";
+ TranslateId pResId;
switch (getInfoHelper().getHandleByName(rPropertyName))
{
case PROP_NONNEGATIVE:
@@ -283,9 +283,9 @@ public:
};
}
-OUString SwarmSolver::getResourceString(std::string_view aId)
+OUString SwarmSolver::getResourceString(TranslateId aId)
{
- if (aId.empty())
+ if (!aId)
return OUString();
return Translate::get(aId, Translate::Create("scc"));