From f6f971ab7cec3c3dc0fd6734cfe47c4805789520 Mon Sep 17 00:00:00 2001 From: Arnaud VERSINI Date: Sun, 20 Jul 2025 17:54:25 +0200 Subject: [PATCH] vcl : use more frozen::unordered_map Change-Id: I1012be7df58cacde41e2a56e84e264edd4059a8f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188086 Tested-by: Jenkins Reviewed-by: Arnaud Versini --- vcl/source/gdi/WidgetDefinitionReader.cxx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/vcl/source/gdi/WidgetDefinitionReader.cxx b/vcl/source/gdi/WidgetDefinitionReader.cxx index 24585bea784b..42326393b0a6 100644 --- a/vcl/source/gdi/WidgetDefinitionReader.cxx +++ b/vcl/source/gdi/WidgetDefinitionReader.cxx @@ -8,6 +8,10 @@ * */ +#include +#include +#include + #include #include @@ -16,7 +20,6 @@ #include #include #include -#include namespace vcl { @@ -120,7 +123,7 @@ ControlPart xmlStringToControlPart(std::string_view sPart) bool getControlTypeForXmlString(std::string_view rString, ControlType& reType) { - static std::unordered_map aPartMap = { + static constexpr auto aPartMap = frozen::make_unordered_map({ { "pushbutton", ControlType::Pushbutton }, { "radiobutton", ControlType::Radiobutton }, { "checkbox", ControlType::Checkbox }, @@ -146,7 +149,7 @@ bool getControlTypeForXmlString(std::string_view rString, ControlType& reType) { "menubar", ControlType::Menubar }, { "menupopup", ControlType::MenuPopup }, { "tooltip", ControlType::Tooltip }, - }; + }); auto const aIterator = aPartMap.find(rString); if (aIterator != aPartMap.end()) @@ -338,7 +341,7 @@ bool WidgetDefinitionReader::read(WidgetDefinition& rWidgetDefinition) rWidgetDefinition.mpStyle = std::make_shared(); - std::unordered_map aStyleColorMap = { + auto aStyleColorMap = frozen::make_unordered_map({ { "faceColor", &rWidgetDefinition.mpStyle->maFaceColor }, { "checkedColor", &rWidgetDefinition.mpStyle->maCheckedColor }, { "lightColor", &rWidgetDefinition.mpStyle->maLightColor }, @@ -393,11 +396,11 @@ bool WidgetDefinitionReader::read(WidgetDefinition& rWidgetDefinition) { "linkColor", &rWidgetDefinition.mpStyle->maLinkColor }, { "visitedLinkColor", &rWidgetDefinition.mpStyle->maVisitedLinkColor }, { "toolTextColor", &rWidgetDefinition.mpStyle->maToolTextColor }, - }; + }); rWidgetDefinition.mpSettings = std::make_shared(); - std::unordered_map aSettingMap = { + auto aSettingMap = frozen::make_unordered_map({ { "noActiveTabTextRaise", &rWidgetDefinition.mpSettings->msNoActiveTabTextRaise }, { "centeredTabs", &rWidgetDefinition.mpSettings->msCenteredTabs }, { "listBoxEntryMargin", &rWidgetDefinition.mpSettings->msListBoxEntryMargin }, @@ -408,7 +411,7 @@ bool WidgetDefinitionReader::read(WidgetDefinition& rWidgetDefinition) &rWidgetDefinition.mpSettings->msListBoxPreviewDefaultLogicWidth }, { "listBoxPreviewDefaultLogicHeight", &rWidgetDefinition.mpSettings->msListBoxPreviewDefaultLogicHeight }, - }; + }); SvFileStream aFileStream(m_rDefinitionFile, StreamMode::READ);