diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-07-30 10:45:06 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-07-30 12:18:07 -0400 |
commit | 4646a4e5e8a82cffa13cf524b22863f4e805944c (patch) | |
tree | 028a3daca0d005680481b1650bb15b8c51035e8a | |
parent | 7d477f3bd1eda5426f5858ebb64c8c4e43409ba9 (diff) |
Const correct-ness.
Change-Id: I4f5572dcde886db50cb8d189da41a862f6cefe72
-rw-r--r-- | filter/source/config/cache/filtercache.cxx | 33 | ||||
-rw-r--r-- | filter/source/config/cache/filtercache.hxx | 5 |
2 files changed, 27 insertions, 11 deletions
diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx index e7c5f7c45f76..59eb94d57beb 100644 --- a/filter/source/config/cache/filtercache.cxx +++ b/filter/source/config/cache/filtercache.cxx @@ -297,7 +297,7 @@ OUStringList FilterCache::getMatchingItemsByProps( EItemType eType , // search for right list // An exception is thrown - "eType" is unknown. // => rList will be valid everytimes next line is reached. - CacheItemList& rList = impl_getItemList(eType); + const CacheItemList& rList = impl_getItemList(eType); OUStringList lKeys; @@ -333,9 +333,9 @@ sal_Bool FilterCache::hasItems(EItemType eType) const // search for right list // An exception is thrown - "eType" is unknown. // => rList will be valid everytimes next line is reached. - CacheItemList& rList = impl_getItemList(eType); + const CacheItemList& rList = impl_getItemList(eType); - return (rList.size()>0); + return !rList.empty(); // <- SAFE } @@ -350,7 +350,7 @@ OUStringList FilterCache::getItemNames(EItemType eType) const // search for right list // An exception is thrown - "eType" is unknown. // => rList will be valid everytimes next line is reached. - CacheItemList& rList = impl_getItemList(eType); + const CacheItemList& rList = impl_getItemList(eType); OUStringList lKeys; for (CacheItemList::const_iterator pIt = rList.begin(); @@ -375,7 +375,7 @@ sal_Bool FilterCache::hasItem( EItemType eType, // search for right list // An exception is thrown - "eType" is unknown. // => rList will be valid everytimes next line is reached. - CacheItemList& rList = impl_getItemList(eType); + const CacheItemList& rList = impl_getItemList(eType); // if item could not be found - check if it can be loaded // from the underlying configuration layer. Might it was not already @@ -791,10 +791,7 @@ void FilterCache::detectFlatForURL(const css::util::URL& aURL , // <- SAFE ---------------------------------- } - - -CacheItemList& FilterCache::impl_getItemList(EItemType eType) const - throw(css::uno::Exception) +const CacheItemList& FilterCache::impl_getItemList(EItemType eType) const { // SAFE -> ---------------------------------- ::osl::ResettableMutexGuard aLock(m_aLock); @@ -814,7 +811,25 @@ CacheItemList& FilterCache::impl_getItemList(EItemType eType) const // <- SAFE ---------------------------------- } +CacheItemList& FilterCache::impl_getItemList(EItemType eType) +{ + // SAFE -> ---------------------------------- + ::osl::ResettableMutexGuard aLock(m_aLock); + + switch(eType) + { + case E_TYPE : return m_lTypes ; + case E_FILTER : return m_lFilters ; + case E_FRAMELOADER : return m_lFrameLoaders ; + case E_CONTENTHANDLER : return m_lContentHandlers; + case E_DETECTSERVICE : return m_lDetectServices ; + + } + throw css::uno::Exception(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "unknown sub container requested." )), + css::uno::Reference< css::uno::XInterface >() ); + // <- SAFE ---------------------------------- +} css::uno::Reference< css::uno::XInterface > FilterCache::impl_openConfig(EConfigProvider eProvider) throw(css::uno::Exception) diff --git a/filter/source/config/cache/filtercache.hxx b/filter/source/config/cache/filtercache.hxx index afef5f6d4ad0..d83036135f58 100644 --- a/filter/source/config/cache/filtercache.hxx +++ b/filter/source/config/cache/filtercache.hxx @@ -679,8 +679,9 @@ class FilterCache : public BaseLock @throw [css::uno::Exception] if the required list does not exist. */ - CacheItemList& impl_getItemList(EItemType eType) const - throw(css::uno::Exception); + const CacheItemList& impl_getItemList(EItemType eType) const; + + CacheItemList& impl_getItemList(EItemType eType); //--------------------------------------- |