sfx2 : use frozen::unordered_maps to avoid allocations

Change-Id: I1259bc5f33f1c0d91493f24b5993237530cd8adb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190617
Tested-by: Jenkins
Reviewed-by: Arnaud Versini <arnaud.versini@pm.me>
This commit is contained in:
Arnaud VERSINI
2025-09-10 21:17:10 +02:00
committed by Arnaud Versini
parent 58f4241207
commit afdc487513
+9 -5
View File
@@ -13,6 +13,10 @@
#include <algorithm>
#include <iterator>
#include <frozen/bits/defines.h>
#include <frozen/bits/elsa_std.h>
#include <frozen/unordered_map.h>
#include <com/sun/star/beans/XPropertyContainer.hpp>
#include <com/sun/star/beans/Property.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -761,12 +765,12 @@ sal_Int32 SfxClassificationHelper::GetImpactLevel()
}
else if (aScale == "FIPS-199")
{
static std::map<OUString, sal_Int32> const aValues
static auto constexpr aValues = frozen::make_unordered_map<std::u16string_view, sal_Int32>(
{
{ "Low", 0 },
{ "Moderate", 1 },
{ "High", 2 }
};
{ u"Low", 0 },
{ u"Moderate", 1 },
{ u"High", 2 }
});
auto itValues = aValues.find(aLevel);
if (itValues == aValues.end())
return nRet;