From 3b6091ca42cd2d9f230e7d81648c34f3d7085107 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 15 Aug 2014 15:30:09 +0200 Subject: document the swap-on-free idiom usage Effective C++, item 17 Change-Id: I5c6f20c9631f1ca86b481a56ef08d578a7addbad --- desktop/source/app/dispatchwatcher.hxx | 2 +- framework/inc/classes/filtercachedata.hxx | 4 ++-- framework/inc/stdtypes.h | 4 ++-- framework/inc/uifactory/configurationaccessfactorymanager.hxx | 2 +- framework/inc/uifactory/factoryconfiguration.hxx | 2 +- framework/inc/xml/imagesdocumenthandler.hxx | 2 +- framework/inc/xml/statusbardocumenthandler.hxx | 2 +- framework/inc/xml/toolboxdocumenthandler.hxx | 2 +- framework/source/uielement/controlmenucontroller.cxx | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/desktop/source/app/dispatchwatcher.hxx b/desktop/source/app/dispatchwatcher.hxx index 125e9d98aedd..228b6a191428 100644 --- a/desktop/source/app/dispatchwatcher.hxx +++ b/desktop/source/app/dispatchwatcher.hxx @@ -44,7 +44,7 @@ class DispatchWatcherHashMap : public ::boost::unordered_map< OUString, sal_Int3 public: inline void free() { - DispatchWatcherHashMap().swap( *this ); + DispatchWatcherHashMap().swap( *this ); // get rid of reserved capacity } }; diff --git a/framework/inc/classes/filtercachedata.hxx b/framework/inc/classes/filtercachedata.hxx index 499e48f85f01..af9053a233f0 100644 --- a/framework/inc/classes/filtercachedata.hxx +++ b/framework/inc/classes/filtercachedata.hxx @@ -337,7 +337,7 @@ class SetNodeHash : public ::boost::unordered_map< OUString , inline void free() { - SetNodeHash().swap( *this ); + SetNodeHash().swap( *this ); // get rid of reserved capacity lAddedItems.free (); lChangedItems.free(); lRemovedItems.free(); @@ -372,7 +372,7 @@ class PerformanceHash : public ::boost::unordered_map< OUString inline void free() { - PerformanceHash().swap( *this ); + PerformanceHash().swap( *this ); // get rid of reserved capacity } // normaly a complete string must match our hash key values ... diff --git a/framework/inc/stdtypes.h b/framework/inc/stdtypes.h index d814a57eb875..3ff9e0d69170 100644 --- a/framework/inc/stdtypes.h +++ b/framework/inc/stdtypes.h @@ -108,7 +108,7 @@ class OUStringList : public ::comphelper::SequenceAsVector< OUString > // the only way to free used memory really! void free() { - OUStringList().swap( *this ); + OUStringList().swap( *this );// get rid of reserved capacity } }; @@ -135,7 +135,7 @@ class BaseHash : public ::boost::unordered_map< OUString , // the only way to free used memory really! void free() { - BaseHash().swap( *this ); + BaseHash().swap( *this );// get rid of reserved capacity } }; diff --git a/framework/inc/uifactory/configurationaccessfactorymanager.hxx b/framework/inc/uifactory/configurationaccessfactorymanager.hxx index 5d6ad0a76072..b4f9afe7c98b 100644 --- a/framework/inc/uifactory/configurationaccessfactorymanager.hxx +++ b/framework/inc/uifactory/configurationaccessfactorymanager.hxx @@ -63,7 +63,7 @@ namespace framework { { inline void free() { - FactoryManagerMap().swap( *this ); + FactoryManagerMap().swap( *this );// get rid of reserved capacity } }; diff --git a/framework/inc/uifactory/factoryconfiguration.hxx b/framework/inc/uifactory/factoryconfiguration.hxx index 8360f8b09a46..2df76a283503 100644 --- a/framework/inc/uifactory/factoryconfiguration.hxx +++ b/framework/inc/uifactory/factoryconfiguration.hxx @@ -80,7 +80,7 @@ private: { inline void free() { - MenuControllerMap().swap( *this ); + MenuControllerMap().swap( *this );// get rid of reserved capacity } }; diff --git a/framework/inc/xml/imagesdocumenthandler.hxx b/framework/inc/xml/imagesdocumenthandler.hxx index 7659d39cc17a..b984ced00801 100644 --- a/framework/inc/xml/imagesdocumenthandler.hxx +++ b/framework/inc/xml/imagesdocumenthandler.hxx @@ -116,7 +116,7 @@ class OReadImagesDocumentHandler : public ::cppu::WeakImplHelper1< ::com::sun::s public: inline void free() { - ImageHashMap().swap( *this ); + ImageHashMap().swap( *this );// get rid of reserved capacity } }; diff --git a/framework/inc/xml/statusbardocumenthandler.hxx b/framework/inc/xml/statusbardocumenthandler.hxx index 88c094ef137b..8242874e1728 100644 --- a/framework/inc/xml/statusbardocumenthandler.hxx +++ b/framework/inc/xml/statusbardocumenthandler.hxx @@ -112,7 +112,7 @@ class FWE_DLLPUBLIC OReadStatusBarDocumentHandler : public: inline void free() { - StatusBarHashMap().swap( *this ); + StatusBarHashMap().swap( *this );// get rid of reserved capacity } }; diff --git a/framework/inc/xml/toolboxdocumenthandler.hxx b/framework/inc/xml/toolboxdocumenthandler.hxx index 9eadc337ae01..f1bb2c32226e 100644 --- a/framework/inc/xml/toolboxdocumenthandler.hxx +++ b/framework/inc/xml/toolboxdocumenthandler.hxx @@ -117,7 +117,7 @@ class FWE_DLLPUBLIC OReadToolBoxDocumentHandler : public: inline void free() { - ToolBoxHashMap().swap( *this ); + ToolBoxHashMap().swap( *this );// get rid of reserved capacity } }; diff --git a/framework/source/uielement/controlmenucontroller.cxx b/framework/source/uielement/controlmenucontroller.cxx index 2604b66f26ac..9c78c1c4efa5 100644 --- a/framework/source/uielement/controlmenucontroller.cxx +++ b/framework/source/uielement/controlmenucontroller.cxx @@ -229,7 +229,7 @@ private: public: inline void free() { - UrlToDispatchMap().swap( *this ); + UrlToDispatchMap().swap( *this );// get rid of reserved capacity } }; -- cgit