[Libreoffice-commits] core.git: 3 commits - xmloff/inc xmloff/source

Kohei Yoshida kohei.yoshida at gmail.com
Wed Feb 6 21:34:10 PST 2013


 xmloff/inc/xmloff/txtimp.hxx     |    4 ++--
 xmloff/source/style/xmlstyle.cxx |   30 ++++++++++++------------------
 xmloff/source/text/txtimp.cxx    |   35 ++++++++++++++++-------------------
 3 files changed, 30 insertions(+), 39 deletions(-)

New commits:
commit fbdaa717e3dc8a59d474b1bb5503cfa6dac609e8
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Wed Feb 6 20:06:34 2013 -0500

    Mark these members mutable to avoid casting them in const method.
    
    Change-Id: Ib5d8ea83e37ab1e3c5a1ad4dc9870d3d5a2d8779

diff --git a/xmloff/source/style/xmlstyle.cxx b/xmloff/source/style/xmlstyle.cxx
index 9cf0645..51d391d 100644
--- a/xmloff/source/style/xmlstyle.cxx
+++ b/xmloff/source/style/xmlstyle.cxx
@@ -259,11 +259,11 @@ class SvXMLStylesContext_Impl
     typedef std::set<SvXMLStyleIndex_Impl, SvXMLStyleIndexCmp_Impl> IndicesType;
 
     StylesType aStyles;
-    IndicesType* pIndices;
+    mutable IndicesType* pIndices;
     bool bAutomaticStyle;
 
 #ifdef DBG_UTIL
-    sal_uInt32 nIndexCreated;
+    mutable sal_uInt32 nIndexCreated;
 #endif
 
     void FlushIndex() { delete pIndices; pIndices = 0; }
@@ -345,11 +345,10 @@ const SvXMLStyleContext *SvXMLStylesContext_Impl::FindStyleChildContext( sal_uIn
         DBG_ASSERT( 0==nIndexCreated,
                     "Performance warning: sdbcx::Index created multiple times" );
 #endif
-        ((SvXMLStylesContext_Impl *)this)->pIndices =
-            new IndicesType( aStyles.begin(), aStyles.end() );
+        pIndices = new IndicesType(aStyles.begin(), aStyles.end());
         SAL_WARN_IF(pIndices->size() != aStyles.size(), "xmloff", "Here is a duplicate Style");
 #ifdef DBG_UTIL
-        ((SvXMLStylesContext_Impl *)this)->nIndexCreated++;
+        ++nIndexCreated;
 #endif
     }
 
commit ab0543469433395153874c47ce46ef73fc137203
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Wed Feb 6 19:59:34 2013 -0500

    Move these typedef's inside the class scope & bool cleanups.
    
    Change-Id: I806453efbc5f7bb18f34593c350b05d74a0bc23b

diff --git a/xmloff/source/style/xmlstyle.cxx b/xmloff/source/style/xmlstyle.cxx
index b69f3f6..9cf0645 100644
--- a/xmloff/source/style/xmlstyle.cxx
+++ b/xmloff/source/style/xmlstyle.cxx
@@ -56,8 +56,6 @@
 #include <set>
 #include <vector>
 
-using ::std::vector;
-
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::container;
@@ -254,18 +252,15 @@ struct SvXMLStyleIndexCmp_Impl
     }
 };
 
-// ---------------------------------------------------------------------
-
-typedef SvXMLStyleContext *SvXMLStyleContextPtr;
-typedef vector< SvXMLStyleContextPtr > SvXMLStyleContexts_Impl;
-
-typedef std::set<SvXMLStyleIndex_Impl, SvXMLStyleIndexCmp_Impl> SvXMLStyleIndices_Impl;
 
 class SvXMLStylesContext_Impl
 {
-    SvXMLStyleContexts_Impl aStyles;
-    SvXMLStyleIndices_Impl  *pIndices;
-    sal_Bool bAutomaticStyle;
+    typedef std::vector<SvXMLStyleContext*> StylesType;
+    typedef std::set<SvXMLStyleIndex_Impl, SvXMLStyleIndexCmp_Impl> IndicesType;
+
+    StylesType aStyles;
+    IndicesType* pIndices;
+    bool bAutomaticStyle;
 
 #ifdef DBG_UTIL
     sal_uInt32 nIndexCreated;
@@ -274,7 +269,7 @@ class SvXMLStylesContext_Impl
     void FlushIndex() { delete pIndices; pIndices = 0; }
 
 public:
-    SvXMLStylesContext_Impl( sal_Bool bAuto );
+    SvXMLStylesContext_Impl( bool bAuto );
     ~SvXMLStylesContext_Impl();
 
     size_t GetStyleCount() const { return aStyles.size(); }
@@ -298,7 +293,7 @@ public:
     sal_Bool IsAutomaticStyle() const { return bAutomaticStyle; }
 };
 
-SvXMLStylesContext_Impl::SvXMLStylesContext_Impl( sal_Bool bAuto ) :
+SvXMLStylesContext_Impl::SvXMLStylesContext_Impl( bool bAuto ) :
     pIndices( 0 ),
     bAutomaticStyle( bAuto )
 #ifdef DBG_UTIL
@@ -351,7 +346,7 @@ const SvXMLStyleContext *SvXMLStylesContext_Impl::FindStyleChildContext( sal_uIn
                     "Performance warning: sdbcx::Index created multiple times" );
 #endif
         ((SvXMLStylesContext_Impl *)this)->pIndices =
-            new SvXMLStyleIndices_Impl( aStyles.begin(), aStyles.end() );
+            new IndicesType( aStyles.begin(), aStyles.end() );
         SAL_WARN_IF(pIndices->size() != aStyles.size(), "xmloff", "Here is a duplicate Style");
 #ifdef DBG_UTIL
         ((SvXMLStylesContext_Impl *)this)->nIndexCreated++;
@@ -361,7 +356,7 @@ const SvXMLStyleContext *SvXMLStylesContext_Impl::FindStyleChildContext( sal_uIn
     if( pIndices )
     {
         SvXMLStyleIndex_Impl aIndex( nFamily, rName );
-        SvXMLStyleIndices_Impl::iterator aFind = pIndices->find(aIndex);
+        IndicesType::iterator aFind = pIndices->find(aIndex);
         if( aFind != pIndices->end() )
             pStyle = aFind->GetStyle();
     }
commit 14b9d7c75f65757e0fd281e34012ae2feabd85c1
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Wed Feb 6 19:27:39 2013 -0500

    Those auto_ptr can be replaced with boost::scoped_ptr.
    
    Change-Id: I2aa68c7bf265943e3d015a069fab461882c81554

diff --git a/xmloff/inc/xmloff/txtimp.hxx b/xmloff/inc/xmloff/txtimp.hxx
index a5909ef..0003991 100644
--- a/xmloff/inc/xmloff/txtimp.hxx
+++ b/xmloff/inc/xmloff/txtimp.hxx
@@ -25,9 +25,9 @@
 #include <com/sun/star/uno/Reference.h>
 
 #include <map>
-#include <memory>
 #include <boost/utility.hpp>
 #include <boost/shared_ptr.hpp>
+#include <boost/scoped_ptr.hpp>
 
 #include <xmloff/xmltkmap.hxx>
 #include <comphelper/stl_types.hxx>
@@ -371,7 +371,7 @@ class XMLOFF_DLLPUBLIC XMLTextImportHelper : public UniRefBase,
 {
 private:
     struct Impl;
-    ::std::auto_ptr<Impl> m_pImpl;
+    boost::scoped_ptr<Impl> m_pImpl;
     /// ugly, but implementation of this is in XMLPropertyBackpatcher.cxx
     struct BackpatcherImpl;
     ::boost::shared_ptr<BackpatcherImpl> m_pBackpatcherImpl;
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index b00b8a2..00ece9d 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -489,22 +489,20 @@ static SvXMLTokenMapEntry aTextFieldAttrTokenMap[] =
 struct SAL_DLLPRIVATE XMLTextImportHelper::Impl
     : private ::boost::noncopyable
 {
-    SAL_WNODEPRECATED_DECLARATIONS_PUSH
-    ::std::auto_ptr<SvXMLTokenMap> m_pTextElemTokenMap;
-    ::std::auto_ptr<SvXMLTokenMap> m_pTextPElemTokenMap;
-    ::std::auto_ptr<SvXMLTokenMap> m_pTextPAttrTokenMap;
-    ::std::auto_ptr<SvXMLTokenMap> m_pTextFieldAttrTokenMap;
-    ::std::auto_ptr<SvXMLTokenMap> m_pTextNumberedParagraphAttrTokenMap;
-    ::std::auto_ptr<SvXMLTokenMap> m_pTextListBlockAttrTokenMap;
-    ::std::auto_ptr<SvXMLTokenMap> m_pTextListBlockElemTokenMap;
-    ::std::auto_ptr<SvXMLTokenMap> m_pTextFrameAttrTokenMap;
-    ::std::auto_ptr<SvXMLTokenMap> m_pTextContourAttrTokenMap;
-    ::std::auto_ptr<SvXMLTokenMap> m_pTextHyperlinkAttrTokenMap;
-    ::std::auto_ptr<SvXMLTokenMap> m_pTextMasterPageElemTokenMap;
-    ::std::auto_ptr< std::vector<OUString> > m_pPrevFrmNames;
-    ::std::auto_ptr< std::vector<OUString> > m_pNextFrmNames;
-    ::std::auto_ptr<XMLTextListsHelper> m_pTextListsHelper;
-    SAL_WNODEPRECATED_DECLARATIONS_POP
+    boost::scoped_ptr<SvXMLTokenMap> m_pTextElemTokenMap;
+    boost::scoped_ptr<SvXMLTokenMap> m_pTextPElemTokenMap;
+    boost::scoped_ptr<SvXMLTokenMap> m_pTextPAttrTokenMap;
+    boost::scoped_ptr<SvXMLTokenMap> m_pTextFieldAttrTokenMap;
+    boost::scoped_ptr<SvXMLTokenMap> m_pTextNumberedParagraphAttrTokenMap;
+    boost::scoped_ptr<SvXMLTokenMap> m_pTextListBlockAttrTokenMap;
+    boost::scoped_ptr<SvXMLTokenMap> m_pTextListBlockElemTokenMap;
+    boost::scoped_ptr<SvXMLTokenMap> m_pTextFrameAttrTokenMap;
+    boost::scoped_ptr<SvXMLTokenMap> m_pTextContourAttrTokenMap;
+    boost::scoped_ptr<SvXMLTokenMap> m_pTextHyperlinkAttrTokenMap;
+    boost::scoped_ptr<SvXMLTokenMap> m_pTextMasterPageElemTokenMap;
+    boost::scoped_ptr< std::vector<OUString> > m_pPrevFrmNames;
+    boost::scoped_ptr< std::vector<OUString> > m_pNextFrmNames;
+    boost::scoped_ptr<XMLTextListsHelper> m_pTextListsHelper;
 
     SvXMLImportContextRef m_xAutoStyles;
     SvXMLImportContextRef m_xFontDecls;
@@ -515,9 +513,8 @@ struct SAL_DLLPRIVATE XMLTextImportHelper::Impl
     UniReference< SvXMLImportPropertyMapper > m_xSectionImpPrMap;
     UniReference< SvXMLImportPropertyMapper > m_xRubyImpPrMap;
 
-    SAL_WNODEPRECATED_DECLARATIONS_PUSH
-    ::std::auto_ptr<SvI18NMap> m_pRenameMap;
-    SAL_WNODEPRECATED_DECLARATIONS_POP
+    boost::scoped_ptr<SvI18NMap> m_pRenameMap;
+
     /* Change and extend data structure:
        - data structure contains candidates of paragraph styles, which
          will be assigned to the outline style


More information about the Libreoffice-commits mailing list