diff options
-rw-r--r-- | configmgr/source/access.hxx | 9 | ||||
-rw-r--r-- | configmgr/source/components.hxx | 3 | ||||
-rw-r--r-- | configmgr/source/config_map.hxx | 35 | ||||
-rw-r--r-- | configmgr/source/data.hxx | 4 | ||||
-rw-r--r-- | configmgr/source/nodemap.hxx | 4 |
5 files changed, 45 insertions, 10 deletions
diff --git a/configmgr/source/access.hxx b/configmgr/source/access.hxx index de35555522dc..807f2a2a9724 100644 --- a/configmgr/source/access.hxx +++ b/configmgr/source/access.hxx @@ -25,6 +25,7 @@ #include <map> #include <set> #include <vector> +#include "config_map.hxx" #include <boost/noncopyable.hpp> #include <boost/shared_ptr.hpp> @@ -486,7 +487,7 @@ private: bool theDirectlyModified); }; - typedef std::map< OUString, ModifiedChild > ModifiedChildren; + typedef config_map< ModifiedChild > ModifiedChildren; rtl::Reference< ChildAccess > getModifiedChild( ModifiedChildren::iterator const & childIterator); @@ -515,7 +516,7 @@ private: rtl::Reference< Access > getNotificationRoot(); - typedef std::map< OUString, ChildAccess * > WeakChildMap; + typedef config_map< ChildAccess * > WeakChildMap; typedef std::multiset< @@ -535,7 +536,7 @@ private: com::sun::star::beans::XPropertyChangeListener > > PropertyChangeListenersElement; - typedef std::map< OUString, PropertyChangeListenersElement > + typedef config_map< PropertyChangeListenersElement > PropertyChangeListeners; typedef @@ -544,7 +545,7 @@ private: com::sun::star::beans::XVetoableChangeListener > > VetoableChangeListenersElement; - typedef std::map< OUString, VetoableChangeListenersElement > + typedef config_map< VetoableChangeListenersElement > VetoableChangeListeners; typedef diff --git a/configmgr/source/components.hxx b/configmgr/source/components.hxx index 4edaeec1eba6..48c1f7a73199 100644 --- a/configmgr/source/components.hxx +++ b/configmgr/source/components.hxx @@ -148,8 +148,7 @@ private: typedef std::set< RootAccess * > WeakRootSet; typedef - std::map< - OUString, + config_map< com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > > ExternalServices; diff --git a/configmgr/source/config_map.hxx b/configmgr/source/config_map.hxx new file mode 100644 index 000000000000..0e9f614bb5cd --- /dev/null +++ b/configmgr/source/config_map.hxx @@ -0,0 +1,35 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +#ifndef CONFIG_MAP_HXX +#define CONFIG_MAP_HXX + +#include <map> +#include <rtl/ustring.hxx> + +// The realisation here is that while a map is a reasonably compact +// representation, there is often no need to have it completely +// sorted, so we can use a fast in-line length comparison as the +// initial compare, rather than sorting of sub string contents. + +struct LengthContentsCompare +{ + inline bool operator()( const OUString &a, const OUString &b ) const + { + if (a.getLength() == b.getLength()) + return a < b; + else + return a.getLength() < b.getLength(); + } +}; + +template< class T > struct config_map : public std::map< OUString, T, LengthContentsCompare > { }; + +#endif // CONFIG_MAP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/configmgr/source/data.hxx b/configmgr/source/data.hxx index 2e564d953d1e..17a0e1dec879 100644 --- a/configmgr/source/data.hxx +++ b/configmgr/source/data.hxx @@ -23,7 +23,7 @@ #include <sal/config.h> #include <climits> -#include <map> +#include "config_map.hxx" #include <vector> #include <boost/noncopyable.hpp> @@ -86,7 +86,7 @@ struct Data: private boost::noncopyable { OUString const & url); private: - typedef std::map< OUString, rtl::Reference< ExtensionXcu > > + typedef config_map< rtl::Reference< ExtensionXcu > > ExtensionXcuAdditions; rtl::Reference< Node > root_; diff --git a/configmgr/source/nodemap.hxx b/configmgr/source/nodemap.hxx index 97420544568a..068a471c670f 100644 --- a/configmgr/source/nodemap.hxx +++ b/configmgr/source/nodemap.hxx @@ -21,13 +21,13 @@ #define INCLUDED_CONFIGMGR_SOURCE_NODEMAP_HXX #include <sal/config.h> -#include <map> +#include "config_map.hxx" #include <rtl/ref.hxx> #include <node.hxx> namespace configmgr { -typedef std::map< OUString, rtl::Reference< Node > > NodeMapImpl; +typedef config_map< rtl::Reference< Node > > NodeMapImpl; class NodeMap { NodeMapImpl maImpl; |