[Libreoffice-commits] .: tools/inc

Joseph Powers jpowers at kemper.freedesktop.org
Mon Sep 5 20:17:34 PDT 2011


 tools/inc/tools/ref.hxx |   97 ++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 77 insertions(+), 20 deletions(-)

New commits:
commit 69bf43444e0cdf00ff909feb8138188b28394139
Author: Joseph Powers <jpowers27 at cox.net>
Date:   Mon Sep 5 19:29:12 2011 -0700

    Make macro PRV_SV_DECL_REF_LIST() no longer reference the DECLARE_LIST macro
    
    Yes, I just expanded the DECLARE_LIST macro inside the other macro; however,
    this is one of two macros that include DECLARE_LIST. Thus, I'll be able to
    remove DECLARE_LIST shortly.
    
    I still need to roll the code a little better. We shouldn't have a CN##List
    class. It should be posiable to make the CN##MemberList class be based on
    List diectly. Once that's done, it shouldn't be too hard to replace List
    with either std::vector<> or std::list<>.

diff --git a/tools/inc/tools/ref.hxx b/tools/inc/tools/ref.hxx
index 6629a4f..c3e2d19 100644
--- a/tools/inc/tools/ref.hxx
+++ b/tools/inc/tools/ref.hxx
@@ -112,31 +112,88 @@ PRV_SV_IMPL_REF_COUNTERS( ClassName, Lock, OwnerLock( sal_True ),       \
 
 /************************** S v R e f L i s t ****************************/
 #define PRV_SV_DECL_REF_LIST(CN,EN,vis) \
-DECLARE_LIST(CN##List,EN)\
+class CN##List : private List                                           \
+{                                                                       \
+public:                                                                 \
+            using List::Clear;                                          \
+            using List::Count;                                          \
+            using List::GetCurPos;                                      \
+                                                                        \
+            CN##List( sal_uInt16 _nInitSize = 16, sal_uInt16 _nReSize = 16 )  \
+                : List( _nInitSize, _nReSize ) {}                       \
+            CN##List( sal_uInt16 _nBlockSize, sal_uInt16 _nInitSize,    \
+                           sal_uInt16 _nReSize )                        \
+                : List( _nBlockSize, _nInitSize, _nReSize ) {}          \
+            CN##List( const CN##List& rClassName )                      \
+                : List( rClassName ) {}                                 \
+                                                                        \
+    void    Insert( EN p, sal_uIntPtr nIndex )                          \
+                { List::Insert( (void*)p, nIndex ); }                   \
+    void    Insert( EN p )                                              \
+                { List::Insert( (void*)p ); }                           \
+    EN      Remove()                                                    \
+                { return (EN)List::Remove(); }                          \
+    EN      Remove( sal_uIntPtr nIndex )                                \
+                { return (EN)List::Remove( nIndex ); }                  \
+    EN      Remove( EN p )                                              \
+                { return (EN)List::Remove( (void*)p ); }                \
+    EN      Replace( EN p, sal_uIntPtr nIndex )                         \
+                { return (EN)List::Replace( (void*)p, nIndex ); }       \
+    EN      Replace( EN pNew, EN pOld )                                 \
+                { return (EN)List::Replace( (void*)pNew, (void*)pOld ); }   \
+                                                                        \
+    EN      GetCurObject() const                                        \
+                { return (EN)List::GetCurObject(); }                    \
+    EN      GetObject( sal_uIntPtr nIndex ) const                       \
+                { return (EN)List::GetObject( nIndex ); }               \
+    sal_uIntPtr GetPos( const EN p ) const                              \
+                { return List::GetPos( (const void*)p ); }              \
+                                                                        \
+    EN      Seek( sal_uIntPtr nIndex )                                  \
+                { return (EN)List::Seek( nIndex ); }                    \
+    EN      Seek( void* p ) { return (EN)List::Seek( p ); }             \
+    EN      First()         { return (EN)List::First(); }               \
+    EN      Last()          { return (EN)List::Last(); }                \
+    EN      Next()          { return (EN)List::Next(); }                \
+    EN      Prev()          { return (EN)List::Prev(); }                \
+                                                                        \
+    CN##List&  operator =( const CN##List& rClassName )                 \
+                    { List::operator =( rClassName ); return *this; }   \
+                                                                        \
+    sal_Bool        operator ==( const CN##List& rList ) const          \
+                    { return List::operator ==( rList ); }              \
+    sal_Bool        operator !=( const CN##List& rList ) const          \
+                    { return List::operator !=( rList ); }              \
+};                                                                      \
 class vis CN##MemberList : public CN##List\
 {\
 public:\
-inline CN##MemberList();\
-inline CN##MemberList(sal_uInt16 nInitSz, sal_uInt16 nResize );\
-inline CN##MemberList( const CN##MemberList & rRef );\
-inline ~CN##MemberList();\
-inline CN##MemberList & operator =\
-       ( const CN##MemberList & rRef );\
-inline void Clear();\
-inline void Insert( EN p )\
-{ CN##List::Insert( p ); p->AddRef();}\
-inline void Insert( EN p, sal_uIntPtr nIndex )\
-{ CN##List::Insert( p, nIndex ); p->AddRef();}\
-inline void Append( EN p )\
-{ Insert( p, LIST_APPEND );}\
-inline EN   Remove();\
-inline EN   Remove( sal_uIntPtr nIndex );\
-inline EN   Remove( EN p );\
-inline EN   Replace( EN p, sal_uIntPtr nIndex );\
-inline EN   Replace( EN pNew, EN pOld );\
-inline void Append( const CN##MemberList & );\
+    inline CN##MemberList();\
+    inline CN##MemberList(sal_uInt16 nInitSz, sal_uInt16 nResize );\
+    inline CN##MemberList( const CN##MemberList & rRef );\
+    inline ~CN##MemberList();\
+    inline CN##MemberList & operator =( const CN##MemberList & rRef );\
+    inline void Clear();\
+    inline void Insert( EN p )\
+        {\
+            CN##List::Insert( p );\
+            p->AddRef();\
+        }\
+    inline void Insert( EN p, sal_uIntPtr nIndex )\
+        {\
+            CN##List::Insert( p, nIndex );\
+            p->AddRef();\
+        }\
+    inline void Append( EN p ) { Insert( p, LIST_APPEND ); }\
+    inline EN   Remove();\
+    inline EN   Remove( sal_uIntPtr nIndex );\
+    inline EN   Remove( EN p );\
+    inline EN   Replace( EN p, sal_uIntPtr nIndex );\
+    inline EN   Replace( EN pNew, EN pOld );\
+    inline void Append( const CN##MemberList & );\
 };
 
+
 #define SV_DECL_REF_LIST(CN,EN) \
 PRV_SV_DECL_REF_LIST(CN,EN,/* empty */)
 


More information about the Libreoffice-commits mailing list