diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-03-14 18:37:17 +0100 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2015-03-16 20:37:23 +0100 |
commit | d7ab0bc37ee62d6006abe8c2a281ba9975c08770 (patch) | |
tree | f14e11639096ba6798393f8d7de0d4b0e8aee765 | |
parent | 1fb1016eca1d8e9f43baad18bf7228913aa29715 (diff) |
make typed iteration private in SwClientIter now
Change-Id: If3887cd7a126834a8c3bfd156dc25335229d929b
-rw-r--r-- | sw/inc/calbck.hxx | 80 |
1 files changed, 42 insertions, 38 deletions
diff --git a/sw/inc/calbck.hxx b/sw/inc/calbck.hxx index 6e1a1cc16f4a..f2ea65651d59 100644 --- a/sw/inc/calbck.hxx +++ b/sw/inc/calbck.hxx @@ -64,6 +64,8 @@ class SfxHint; class SwModify; class SwClient; class SwClientIter; +template<typename E, typename S> class SwIterator; + namespace sw { struct LegacyModifyHint SAL_FINAL: SfxHint @@ -241,8 +243,10 @@ protected: class SwClientIter SAL_FINAL : public sw::Ring<SwClientIter> { - friend SwClient* SwModify::Remove(SwClient *); ///< for pointer adjustments - friend void SwModify::Add(SwClient *pDepend); ///< for pointer adjustments + friend SwClient* SwModify::Remove(SwClient*); ///< for pointer adjustments + friend void SwModify::Add(SwClient*); ///< for pointer adjustments + template<typename E, typename S> friend class SwIterator; ///< for typed interation + friend void SwModify::ModifyBroadcast( const SfxPoolItem*, const SfxPoolItem*, TypeId); ///< for typed iteration const SwModify& m_rRoot; @@ -259,6 +263,42 @@ class SwClientIter SAL_FINAL : public sw::Ring<SwClientIter> static SW_DLLPUBLIC SwClientIter* our_pClientIters; + SwClient* First( TypeId nType ) + { + m_aSearchType = nType; + GoStart(); + if(!m_pPosition) + return nullptr; + m_pCurrent = nullptr; + return Next(); + } + SwClient* Last( TypeId nType ) + { + m_aSearchType = nType; + GoEnd(); + if(!m_pPosition) + return nullptr; + if( m_pPosition->IsA( m_aSearchType ) ) + return m_pPosition; + return Previous(); + } + SwClient* Next() + { + if( m_pPosition == m_pCurrent ) + m_pPosition = static_cast<SwClient*>(m_pPosition->m_pRight); + while(m_pPosition && !m_pPosition->IsA( m_aSearchType ) ) + m_pPosition = static_cast<SwClient*>(m_pPosition->m_pRight); + return m_pCurrent = m_pPosition; + } + + SwClient* Previous() + { + m_pPosition = static_cast<SwClient*>(m_pPosition->m_pLeft); + while(m_pPosition && !m_pPosition->IsA( m_aSearchType ) ) + m_pPosition = static_cast<SwClient*>(m_pPosition->m_pLeft); + return m_pCurrent = m_pPosition; + } + public: SwClientIter( const SwModify& rModify ) : m_rRoot(rModify) @@ -314,42 +354,6 @@ public: // adding objects to a client chain in iteration is forbidden // SwModify::Add() asserts this bool IsChanged() const { return m_pPosition != m_pCurrent; } - - SwClient* First( TypeId nType ) - { - m_aSearchType = nType; - GoStart(); - if(!m_pPosition) - return nullptr; - m_pCurrent = nullptr; - return Next(); - } - SwClient* Last( TypeId nType ) - { - m_aSearchType = nType; - GoEnd(); - if(!m_pPosition) - return nullptr; - if( m_pPosition->IsA( m_aSearchType ) ) - return m_pPosition; - return Previous(); - } - SwClient* Next() - { - if( m_pPosition == m_pCurrent ) - m_pPosition = static_cast<SwClient*>(m_pPosition->m_pRight); - while(m_pPosition && !m_pPosition->IsA( m_aSearchType ) ) - m_pPosition = static_cast<SwClient*>(m_pPosition->m_pRight); - return m_pCurrent = m_pPosition; - } - - SwClient* Previous() - { - m_pPosition = static_cast<SwClient*>(m_pPosition->m_pLeft); - while(m_pPosition && !m_pPosition->IsA( m_aSearchType ) ) - m_pPosition = static_cast<SwClient*>(m_pPosition->m_pLeft); - return m_pCurrent = m_pPosition; - } }; SwClient::SwClient( SwModify* pToRegisterIn ) |