diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-23 13:30:58 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-24 14:02:09 +0200 |
commit | 912b8fa62f897fb6fdfd760108d87c4dd468b8ee (patch) | |
tree | 963e227f85d29c6cbddff0a1920ad767a8cdeb8c /starmath | |
parent | ec062c472ad58eafbb4392241119d5b53760120c (diff) |
modernize and improve PropertySetInfo
(*) use o3tl::span for the array param, which means we don't need a null
entry to terminate the array
(*) use std::unordered_map to speed things up
(*) mark the array as static at a few more call sites
Change-Id: I05b6cae7552f44459e183ec05cb94e60edb3bfe0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134832
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/source/mathml/export.cxx | 40 | ||||
-rw-r--r-- | starmath/source/mathml/import.cxx | 10 | ||||
-rw-r--r-- | starmath/source/mathml/mathmlexport.cxx | 18 | ||||
-rw-r--r-- | starmath/source/mathml/mathmlimport.cxx | 5 | ||||
-rw-r--r-- | starmath/source/unomodel.cxx | 3 |
5 files changed, 35 insertions, 41 deletions
diff --git a/starmath/source/mathml/export.cxx b/starmath/source/mathml/export.cxx index ab737c125491..1c88d3f5664d 100644 --- a/starmath/source/mathml/export.cxx +++ b/starmath/source/mathml/export.cxx @@ -127,16 +127,16 @@ bool SmMLExportWrapper::Export(SfxMedium& rMedium) } // create XPropertySet with three properties for status indicator - comphelper::PropertyMapEntry aInfoMap[] - = { { OUString("UsePrettyPrinting"), 0, cppu::UnoType<bool>::get(), - beans::PropertyAttribute::MAYBEVOID, 0 }, - { OUString("BaseURI"), 0, ::cppu::UnoType<OUString>::get(), - beans::PropertyAttribute::MAYBEVOID, 0 }, - { OUString("StreamRelPath"), 0, ::cppu::UnoType<OUString>::get(), - beans::PropertyAttribute::MAYBEVOID, 0 }, - { OUString("StreamName"), 0, ::cppu::UnoType<OUString>::get(), - beans::PropertyAttribute::MAYBEVOID, 0 }, - { OUString(), 0, css::uno::Type(), 0, 0 } }; + static const comphelper::PropertyMapEntry aInfoMap[]{ + { OUString("UsePrettyPrinting"), 0, cppu::UnoType<bool>::get(), + beans::PropertyAttribute::MAYBEVOID, 0 }, + { OUString("BaseURI"), 0, ::cppu::UnoType<OUString>::get(), + beans::PropertyAttribute::MAYBEVOID, 0 }, + { OUString("StreamRelPath"), 0, ::cppu::UnoType<OUString>::get(), + beans::PropertyAttribute::MAYBEVOID, 0 }, + { OUString("StreamName"), 0, ::cppu::UnoType<OUString>::get(), + beans::PropertyAttribute::MAYBEVOID, 0 } + }; uno::Reference<beans::XPropertySet> xInfoSet( comphelper::GenericPropertySet_CreateInstance(new comphelper::PropertySetInfo(aInfoMap))); @@ -262,16 +262,16 @@ OUString SmMLExportWrapper::Export(SmMlElement* pElementTree) } // create XPropertySet with three properties for status indicator - comphelper::PropertyMapEntry aInfoMap[] - = { { OUString("UsePrettyPrinting"), 0, cppu::UnoType<bool>::get(), - beans::PropertyAttribute::MAYBEVOID, 0 }, - { OUString("BaseURI"), 0, ::cppu::UnoType<OUString>::get(), - beans::PropertyAttribute::MAYBEVOID, 0 }, - { OUString("StreamRelPath"), 0, ::cppu::UnoType<OUString>::get(), - beans::PropertyAttribute::MAYBEVOID, 0 }, - { OUString("StreamName"), 0, ::cppu::UnoType<OUString>::get(), - beans::PropertyAttribute::MAYBEVOID, 0 }, - { OUString(), 0, css::uno::Type(), 0, 0 } }; + static const comphelper::PropertyMapEntry aInfoMap[]{ + { OUString("UsePrettyPrinting"), 0, cppu::UnoType<bool>::get(), + beans::PropertyAttribute::MAYBEVOID, 0 }, + { OUString("BaseURI"), 0, ::cppu::UnoType<OUString>::get(), + beans::PropertyAttribute::MAYBEVOID, 0 }, + { OUString("StreamRelPath"), 0, ::cppu::UnoType<OUString>::get(), + beans::PropertyAttribute::MAYBEVOID, 0 }, + { OUString("StreamName"), 0, ::cppu::UnoType<OUString>::get(), + beans::PropertyAttribute::MAYBEVOID, 0 } + }; uno::Reference<beans::XPropertySet> xInfoSet( comphelper::GenericPropertySet_CreateInstance(new comphelper::PropertySetInfo(aInfoMap))); diff --git a/starmath/source/mathml/import.cxx b/starmath/source/mathml/import.cxx index 950bbff4dfe3..52d47028e657 100644 --- a/starmath/source/mathml/import.cxx +++ b/starmath/source/mathml/import.cxx @@ -140,7 +140,7 @@ ErrCode SmMLImportWrapper::Import(SfxMedium& rMedium) } // Create property list - comphelper::PropertyMapEntry aInfoMap[] + static const comphelper::PropertyMapEntry aInfoMap[] = { { u"PrivateData", 0, cppu::UnoType<XInterface>::get(), beans::PropertyAttribute::MAYBEVOID, 0 }, { u"BaseURI", 0, ::cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID, @@ -148,8 +148,7 @@ ErrCode SmMLImportWrapper::Import(SfxMedium& rMedium) { u"StreamRelPath", 0, ::cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID, 0 }, { u"StreamName", 0, ::cppu::UnoType<OUString>::get(), - beans::PropertyAttribute::MAYBEVOID, 0 }, - { u"", 0, css::uno::Type(), 0, 0 } }; + beans::PropertyAttribute::MAYBEVOID, 0 } }; uno::Reference<beans::XPropertySet> xInfoSet( comphelper::GenericPropertySet_CreateInstance(new comphelper::PropertySetInfo(aInfoMap))); @@ -342,7 +341,7 @@ ErrCode SmMLImportWrapper::Import(std::u16string_view aSource) } // Create property list - comphelper::PropertyMapEntry aInfoMap[] + static const comphelper::PropertyMapEntry aInfoMap[] = { { u"PrivateData", 0, cppu::UnoType<XInterface>::get(), beans::PropertyAttribute::MAYBEVOID, 0 }, { u"BaseURI", 0, ::cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID, @@ -350,8 +349,7 @@ ErrCode SmMLImportWrapper::Import(std::u16string_view aSource) { u"StreamRelPath", 0, ::cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID, 0 }, { u"StreamName", 0, ::cppu::UnoType<OUString>::get(), - beans::PropertyAttribute::MAYBEVOID, 0 }, - { u"", 0, css::uno::Type(), 0, 0 } }; + beans::PropertyAttribute::MAYBEVOID, 0 } }; uno::Reference<beans::XPropertySet> xInfoSet( comphelper::GenericPropertySet_CreateInstance(new comphelper::PropertySetInfo(aInfoMap))); diff --git a/starmath/source/mathml/mathmlexport.cxx b/starmath/source/mathml/mathmlexport.cxx index 619082bd3758..187dd195382d 100644 --- a/starmath/source/mathml/mathmlexport.cxx +++ b/starmath/source/mathml/mathmlexport.cxx @@ -134,16 +134,14 @@ bool SmXMLExportWrapper::Export(SfxMedium& rMedium) static constexpr OUStringLiteral sStreamName(u"StreamName"); // create XPropertySet with three properties for status indicator - comphelper::PropertyMapEntry aInfoMap[] - = { { sUsePrettyPrinting, 0, cppu::UnoType<bool>::get(), - beans::PropertyAttribute::MAYBEVOID, 0 }, - { sBaseURI, 0, ::cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID, - 0 }, - { sStreamRelPath, 0, ::cppu::UnoType<OUString>::get(), - beans::PropertyAttribute::MAYBEVOID, 0 }, - { sStreamName, 0, ::cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID, - 0 }, - { OUString(), 0, css::uno::Type(), 0, 0 } }; + static const comphelper::PropertyMapEntry aInfoMap[] = { + { sUsePrettyPrinting, 0, cppu::UnoType<bool>::get(), beans::PropertyAttribute::MAYBEVOID, + 0 }, + { sBaseURI, 0, ::cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID, 0 }, + { sStreamRelPath, 0, ::cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID, + 0 }, + { sStreamName, 0, ::cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID, 0 } + }; uno::Reference<beans::XPropertySet> xInfoSet( comphelper::GenericPropertySet_CreateInstance(new comphelper::PropertySetInfo(aInfoMap))); diff --git a/starmath/source/mathml/mathmlimport.cxx b/starmath/source/mathml/mathmlimport.cxx index 6020b5ffb044..44d8cc1e3058 100644 --- a/starmath/source/mathml/mathmlimport.cxx +++ b/starmath/source/mathml/mathmlimport.cxx @@ -126,7 +126,7 @@ ErrCode SmXMLImportWrapper::Import(SfxMedium& rMedium) bEmbedded = true; } - comphelper::PropertyMapEntry aInfoMap[] + static const comphelper::PropertyMapEntry aInfoMap[] = { { OUString("PrivateData"), 0, cppu::UnoType<XInterface>::get(), beans::PropertyAttribute::MAYBEVOID, 0 }, { OUString("BaseURI"), 0, ::cppu::UnoType<OUString>::get(), @@ -134,8 +134,7 @@ ErrCode SmXMLImportWrapper::Import(SfxMedium& rMedium) { OUString("StreamRelPath"), 0, ::cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID, 0 }, { OUString("StreamName"), 0, ::cppu::UnoType<OUString>::get(), - beans::PropertyAttribute::MAYBEVOID, 0 }, - { OUString(), 0, css::uno::Type(), 0, 0 } }; + beans::PropertyAttribute::MAYBEVOID, 0 } }; uno::Reference<beans::XPropertySet> xInfoSet( comphelper::GenericPropertySet_CreateInstance(new comphelper::PropertySetInfo(aInfoMap))); diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index b61fae230441..42f377f27ce9 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -230,7 +230,7 @@ enum SmModelPropertyHandles static const rtl::Reference<PropertySetInfo> & lcl_createModelPropertyInfo () { - static PropertyMapEntry aModelPropertyInfoMap[] = + static const PropertyMapEntry aModelPropertyInfoMap[] = { { OUString("Alignment") , HANDLE_ALIGNMENT , ::cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, 0 }, { OUString("BaseFontHeight") , HANDLE_BASE_FONT_HEIGHT , ::cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, 0 }, @@ -302,7 +302,6 @@ static const rtl::Reference<PropertySetInfo> & lcl_createModelPropertyInfo () { OUString("BaseLine") , HANDLE_BASELINE , ::cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, 0 }, { OUString("InteropGrabBag") , HANDLE_INTEROP_GRAB_BAG , cppu::UnoType<uno::Sequence< beans::PropertyValue >>::get(), PROPERTY_NONE, 0 }, { OUString("SyntaxVersion") , HANDLE_STARMATH_VERSION , ::cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, 0 }, - { OUString(), 0, css::uno::Type(), 0, 0 } }; static const rtl::Reference<PropertySetInfo> PROPS_INFO = new PropertySetInfo ( aModelPropertyInfoMap ); return PROPS_INFO; |