summaryrefslogtreecommitdiff
path: root/include/svl
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2024-07-27 15:39:06 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-07-29 15:10:19 +0200
commitc39978f41dccbeb2e973c919a67d9b1d974f8f3c (patch)
tree1a688fd28ac0f97d3afd742de382bf79937790b4 /include/svl
parent8f008bf4b968f219d2fe97ef8175ef6be0555943 (diff)
tdf#161846 use unordered_map in SfxItemPropertyMap
with large property maps, even a binary search starts showing up, but we can do a O(1) search here by using a map Change-Id: Ie7916076073e6dd393f0a1fb5a0db1b973999408 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171173 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins
Diffstat (limited to 'include/svl')
-rw-r--r--include/svl/itemprop.hxx18
1 files changed, 6 insertions, 12 deletions
diff --git a/include/svl/itemprop.hxx b/include/svl/itemprop.hxx
index f3db2f2eb6d9..ddd636272ea4 100644
--- a/include/svl/itemprop.hxx
+++ b/include/svl/itemprop.hxx
@@ -69,29 +69,23 @@ struct SfxItemPropertyMapEntry
}
};
-struct SfxItemPropertyMapCompare
-{
- bool operator() ( const SfxItemPropertyMapEntry * lhs, const SfxItemPropertyMapEntry * rhs ) const
- {
- return lhs->aName < rhs->aName;
- }
-};
class SVL_DLLPUBLIC SfxItemPropertyMap
{
- o3tl::sorted_vector< const SfxItemPropertyMapEntry*, SfxItemPropertyMapCompare > m_aMap;
- mutable css::uno::Sequence< css::beans::Property > m_aPropSeq;
public:
SfxItemPropertyMap( std::span<const SfxItemPropertyMapEntry> pEntries );
SfxItemPropertyMap( const SfxItemPropertyMap& rSource );
~SfxItemPropertyMap();
- const SfxItemPropertyMapEntry* getByName( std::u16string_view rName ) const;
+ const SfxItemPropertyMapEntry* getByName( const OUString & rName ) const;
css::uno::Sequence< css::beans::Property > const & getProperties() const;
/// @throws css::beans::UnknownPropertyException
css::beans::Property getPropertyByName( const OUString & rName ) const;
- bool hasPropertyByName( std::u16string_view rName ) const;
+ bool hasPropertyByName( const OUString & rName ) const;
- const o3tl::sorted_vector< const SfxItemPropertyMapEntry*, SfxItemPropertyMapCompare >& getPropertyEntries() const { return m_aMap; }
+ const std::unordered_map< OUString, const SfxItemPropertyMapEntry* >& getPropertyEntries() const { return m_aMap; }
+private:
+ std::unordered_map< OUString, const SfxItemPropertyMapEntry* > m_aMap;
+ mutable css::uno::Sequence< css::beans::Property > m_aPropSeq;
};
class SVL_DLLPUBLIC SfxItemPropertySet final
re/commit/sd/source/ui/uitest?id=6c87b028406070332ab1c37dde323b1678cdf8e6'>loplugin:countusersofdefaultparams in sdNoel Grandin 2016-06-18uitest: loplugin:stringconstantMarkus Mohrhard 2016-06-18uitest: support more impress operationsMarkus Mohrhard 2016-06-18uitest: add initial code for impress main edit windowMarkus Mohrhard