[Libreoffice-commits] .: 2 commits - filter/source

Kohei Yoshida kohei at kemper.freedesktop.org
Mon Jul 30 09:13:27 PDT 2012


 filter/source/config/cache/filtercache.cxx |   45 +++++++++++++++++++----------
 filter/source/config/cache/filtercache.hxx |    5 +--
 2 files changed, 33 insertions(+), 17 deletions(-)

New commits:
commit 4646a4e5e8a82cffa13cf524b22863f4e805944c
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Mon Jul 30 10:45:06 2012 -0400

    Const correct-ness.
    
    Change-Id: I4f5572dcde886db50cb8d189da41a862f6cefe72

diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx
index e7c5f7c..59eb94d 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 afef5f6..d830361 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);
 
         //---------------------------------------
 
commit 7d477f3bd1eda5426f5858ebb64c8c4e43409ba9
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Mon Jul 30 10:40:51 2012 -0400

    Avoid non-ASCII characters in source code.
    
    Change-Id: I4014cf6c88ebdacd1c6c167e44ef61980182bc31

diff --git a/filter/source/config/cache/filtercache.cxx b/filter/source/config/cache/filtercache.cxx
index e6e1e4f..e7c5f7c 100644
--- a/filter/source/config/cache/filtercache.cxx
+++ b/filter/source/config/cache/filtercache.cxx
@@ -295,7 +295,7 @@ OUStringList FilterCache::getMatchingItemsByProps(      EItemType  eType  ,
     ::osl::ResettableMutexGuard aLock(m_aLock);
 
     // search for right list
-    // An exception is thrown �f "eType" is unknown.
+    // An exception is thrown - "eType" is unknown.
     // => rList will be valid everytimes next line is reached.
     CacheItemList& rList = impl_getItemList(eType);
 
@@ -331,7 +331,7 @@ sal_Bool FilterCache::hasItems(EItemType eType) const
     ::osl::ResettableMutexGuard aLock(m_aLock);
 
     // search for right list
-    // An exception is thrown �f "eType" is unknown.
+    // An exception is thrown - "eType" is unknown.
     // => rList will be valid everytimes next line is reached.
     CacheItemList& rList = impl_getItemList(eType);
 
@@ -348,7 +348,7 @@ OUStringList FilterCache::getItemNames(EItemType eType) const
     ::osl::ResettableMutexGuard aLock(m_aLock);
 
     // search for right list
-    // An exception is thrown �f "eType" is unknown.
+    // An exception is thrown - "eType" is unknown.
     // => rList will be valid everytimes next line is reached.
     CacheItemList& rList = impl_getItemList(eType);
 
@@ -373,7 +373,7 @@ sal_Bool FilterCache::hasItem(      EItemType        eType,
     ::osl::ResettableMutexGuard aLock(m_aLock);
 
     // search for right list
-    // An exception is thrown �f "eType" is unknown.
+    // An exception is thrown - "eType" is unknown.
     // => rList will be valid everytimes next line is reached.
     CacheItemList& rList = impl_getItemList(eType);
 
@@ -461,7 +461,7 @@ void FilterCache::removeItem(      EItemType        eType,
     ::osl::ResettableMutexGuard aLock(m_aLock);
 
     // search for right list
-    // An exception is thrown �f "eType" is unknown.
+    // An exception is thrown - "eType" is unknown.
     // => rList will be valid everytimes next line is reached.
     CacheItemList& rList = impl_getItemList(eType);
 
@@ -484,7 +484,7 @@ void FilterCache::setItem(      EItemType        eType ,
     ::osl::ResettableMutexGuard aLock(m_aLock);
 
     // search for right list
-    // An exception is thrown �f "eType" is unknown.
+    // An exception is thrown - "eType" is unknown.
     // => rList will be valid everytimes next line is reached.
     CacheItemList& rList = impl_getItemList(eType);
 


More information about the Libreoffice-commits mailing list