Move uppercase to SubStr ctor

Change-Id: Ifeeaead20e3ad37705fea04a6c3b9efa4339ddc5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152543
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
Mike Kaganski
2023-06-04 16:22:38 +02:00
parent cc6db9f418
commit 4900217e74
2 changed files with 7 additions and 10 deletions

View File

@@ -30,15 +30,14 @@
*/
class SC_DLLPUBLIC ScUserListData final
{
public:
private:
struct SAL_DLLPRIVATE SubStr
{
OUString maReal;
OUString maUpper;
SubStr(OUString aReal, OUString aUpper);
SubStr(OUString&& aReal);
};
private:
std::vector<SubStr> maSubStrings;
OUString aStr;

View File

@@ -17,7 +17,8 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <memory>
#include <sal/config.h>
#include <unotools/charclass.hxx>
#include <global.hxx>
@@ -29,8 +30,8 @@
#include <algorithm>
#include <utility>
ScUserListData::SubStr::SubStr(OUString aReal, OUString aUpper) :
maReal(std::move(aReal)), maUpper(std::move(aUpper)) {}
ScUserListData::SubStr::SubStr(OUString&& aReal) :
maReal(std::move(aReal)), maUpper(ScGlobal::getCharClass().uppercase(maReal)) {}
void ScUserListData::InitTokens()
{
@@ -40,10 +41,7 @@ void ScUserListData::InitTokens()
{
OUString aSub = aStr.getToken(0, ScGlobal::cListDelimiter, nIndex);
if (!aSub.isEmpty())
{
OUString aUpStr = ScGlobal::getCharClass().uppercase(aSub);
maSubStrings.emplace_back(aSub, aUpStr);
}
maSubStrings.emplace_back(std::move(aSub));
} while (nIndex >= 0);
}