summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-05-23 13:30:58 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-05-24 14:02:09 +0200
commit912b8fa62f897fb6fdfd760108d87c4dd468b8ee (patch)
tree963e227f85d29c6cbddff0a1920ad767a8cdeb8c /include
parentec062c472ad58eafbb4392241119d5b53760120c (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 'include')
-rw-r--r--include/comphelper/propertysetinfo.hxx11
1 files changed, 5 insertions, 6 deletions
diff --git a/include/comphelper/propertysetinfo.hxx b/include/comphelper/propertysetinfo.hxx
index a1df9c657476..82bbb81cd6c4 100644
--- a/include/comphelper/propertysetinfo.hxx
+++ b/include/comphelper/propertysetinfo.hxx
@@ -25,8 +25,9 @@
#include <com/sun/star/beans/XPropertySetInfo.hpp>
#include <cppuhelper/implbase.hxx>
#include <comphelper/comphelperdllapi.h>
+#include <o3tl/span.hxx>
#include <o3tl/typed_flags_set.hxx>
-#include <map>
+#include <unordered_map>
#include <vector>
enum class PropertyMoreFlags : sal_uInt8 {
@@ -74,7 +75,7 @@ struct PropertyMapEntry
PropertyMapEntry() = default;
};
-typedef std::map<OUString, PropertyMapEntry const *> PropertyMap;
+typedef std::unordered_map<OUString, PropertyMapEntry const *> PropertyMap;
// don't export to avoid duplicate WeakImplHelper definitions with MSVC
class SAL_DLLPUBLIC_TEMPLATE PropertySetInfo_BASE
@@ -89,7 +90,7 @@ class COMPHELPER_DLLPUBLIC PropertySetInfo final
{
public:
PropertySetInfo() noexcept;
- PropertySetInfo( PropertyMapEntry const * pMap ) noexcept;
+ PropertySetInfo( o3tl::span<const PropertyMapEntry> pMap ) noexcept;
PropertySetInfo(css::uno::Sequence<css::beans::Property> const &) noexcept;
virtual ~PropertySetInfo() noexcept override;
@@ -101,7 +102,7 @@ public:
/** adds an array of PropertyMapEntry to this instance.<p>
The end is marked with a PropertyMapEntry where mpName equals NULL</p>
*/
- void add( PropertyMapEntry const * pMap ) noexcept;
+ void add( o3tl::span<PropertyMapEntry const> pMap ) noexcept;
/** removes an already added PropertyMapEntry which string in mpName equals to aName */
void remove( const OUString& aName ) noexcept;
@@ -111,8 +112,6 @@ public:
virtual sal_Bool SAL_CALL hasPropertyByName( const OUString& Name ) override;
private:
- void addImpl(PropertyMapEntry const * pMap) noexcept;
-
PropertyMap maPropertyMap;
/// Cache the value we return in getProperties because it is expensive to construct
css::uno::Sequence< css::beans::Property > maProperties;