diff options
author | Andreas Schlüns <as@openoffice.org> | 2000-11-30 08:54:52 +0000 |
---|---|---|
committer | Andreas Schlüns <as@openoffice.org> | 2000-11-30 08:54:52 +0000 |
commit | 6f657f868ff95236a3a274c444377659be77f5ef (patch) | |
tree | 96faace9820d786ea65221ea425b43f19527e843 /framework | |
parent | 02cbf6ed3634cbf15fde56ec428a5b5974352edc (diff) |
#79040# new xml format; new handling for check-iterator
Diffstat (limited to 'framework')
-rw-r--r-- | framework/inc/classes/checkediterator.hxx | 57 | ||||
-rw-r--r-- | framework/inc/classes/filtercache.hxx | 8 |
2 files changed, 40 insertions, 25 deletions
diff --git a/framework/inc/classes/checkediterator.hxx b/framework/inc/classes/checkediterator.hxx index cfa5d4f72cf1..b289fc8a5639 100644 --- a/framework/inc/classes/checkediterator.hxx +++ b/framework/inc/classes/checkediterator.hxx @@ -2,9 +2,9 @@ * * $RCSfile: checkediterator.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: as $ $Date: 2000-11-28 14:45:23 $ + * last change: $Author: as $ $Date: 2000-11-30 09:54:52 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -113,7 +113,7 @@ namespace framework{ @devstatus ready to use *//*-*************************************************************************************************************/ -template< class TContainer, class TIterator = typename TContainer::iterator > +template< class TContainer > class CheckedIterator { //------------------------------------------------------------------------------------------------------------- @@ -162,19 +162,17 @@ class CheckedIterator @onerror An assertion is thrown. *//*-*****************************************************************************************************/ - inline void initialize( const TContainer* pContainer ) + inline void initialize( const TContainer* pContainer, sal_Bool bReverse = sal_False ) { // Check incoming parameter. We don't accept all! LOG_ASSERT( !(pContainer==NULL), "CheckedIterator::initialize()\nInvalid parameter detected!\n" ) // Set new container and actualize other member. - m_pContainer = pContainer ; - m_pPosition = m_pContainer->begin() ; - m_eEndState = E_BEFOREEND ; - if( m_pPosition == m_pContainer->end() ) - { - m_eEndState = E_END; - } + m_pContainer = pContainer ; + m_bReverse = bReverse ; + m_eEndState = E_BEFOREEND ; + m_nForward = 0 ; + m_nBackward = pContainer->size() ; } /*-****************************************************************************************************//** @@ -192,8 +190,11 @@ class CheckedIterator inline void setAfterEnd() { - m_pContainer = NULL ; - m_eEndState = E_AFTEREND ; + m_pContainer = NULL ; + m_eEndState = E_AFTEREND ; + m_bReverse = sal_False ; + m_nForward = 0 ; + m_nBackward = 0 ; } /*-****************************************************************************************************//** @@ -220,8 +221,10 @@ class CheckedIterator switch( m_eEndState ) { case E_BEFOREEND: { - ++m_pPosition; - if( m_pPosition == m_pContainer->end() ) + ++m_nForward ; + --m_nBackward ; + // If one iterator reaching end ... other iterator must do the same automaticly! + if( m_nForward >= (sal_Int32)m_pContainer->size() ) { m_eEndState = E_END; } @@ -286,13 +289,24 @@ class CheckedIterator @onerror - *//*-*****************************************************************************************************/ - inline TIterator& getEntry() + inline TContainer::const_iterator getEntry() { // Warn programmer if he forget to initialize these object ... LOG_ASSERT( !(m_pContainer==NULL) , "CheckedIterator::getEntry()\nObject not initialized!\n" ) // or try to read a non existing element! LOG_ASSERT( !(m_eEndState!=E_BEFOREEND) , "CheckedIterator::getEntry()\nWrong using of class detected!\n" ) - return m_pPosition; + + TContainer::const_iterator pEntry; + if( m_bReverse == sal_True ) + { + pEntry = m_pContainer->end()-m_nBackward; + } + else + { + pEntry = m_pContainer->begin()+m_nForward; + } + + return pEntry; } //------------------------------------------------------------------------------------------------------------- @@ -303,10 +317,11 @@ class CheckedIterator enum EEndState{ E_BEFOREEND, E_END, E_AFTEREND }; // These enum defines our three states for an iterator position in curent container. - const TContainer* m_pContainer ; // pointer to current container - TIterator m_pPosition ; // current position in container - EEndState m_eEndState ; // position state of iterator! - + const TContainer* m_pContainer ; // pointer to current container + sal_Int32 m_nForward ; // current position in container for forward orientation + sal_Int32 m_nBackward ; // current position in container for backward orientation + EEndState m_eEndState ; // position state of iterator! + sal_Bool m_bReverse ; // orientation of stepping! }; } // namespace framework diff --git a/framework/inc/classes/filtercache.hxx b/framework/inc/classes/filtercache.hxx index 0e400afb9acb..0950f67a1ec3 100644 --- a/framework/inc/classes/filtercache.hxx +++ b/framework/inc/classes/filtercache.hxx @@ -2,9 +2,9 @@ * * $RCSfile: filtercache.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: as $ $Date: 2000-11-28 14:45:23 $ + * last change: $Author: as $ $Date: 2000-11-30 09:54:52 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -243,8 +243,8 @@ typedef TFilterHash::const_iterator TConstFilter typedef TDetectorHash::const_iterator TConstDetectorIterator ; typedef TLoaderHash::const_iterator TConstLoaderIterator ; typedef TPerformanceHash::const_iterator TConstPerformanceIterator ; -typedef CheckedIterator< TStringList, TConstStringIterator > TCheckedStringListIterator ; -typedef CheckedIterator< TTypeHash, TConstTypeIterator > TCheckedTypeIterator ; +typedef CheckedIterator< TStringList > TCheckedStringListIterator ; +typedef CheckedIterator< TTypeHash > TCheckedTypeIterator ; /*-************************************************************************************************************//** @short cache for all filter and type information |