diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-09-27 00:33:21 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2012-09-27 13:45:19 -0400 |
commit | ccc779769153ce61f658776f6c2847eb4242e3bd (patch) | |
tree | e01e536811e4cfbc5bf61e41ef01c4619e4c7b33 | |
parent | 7d92ac2f05679933d9a2df131786efa6ece00705 (diff) |
Hide method definitions of SvTreeEntryList.
Change-Id: Id110a12bc462d4da0b000d7c441da34f861c8892
-rw-r--r-- | svtools/inc/svtools/treelist.hxx | 88 | ||||
-rw-r--r-- | svtools/source/contnr/treelist.cxx | 137 |
2 files changed, 134 insertions, 91 deletions
diff --git a/svtools/inc/svtools/treelist.hxx b/svtools/inc/svtools/treelist.hxx index 0875052eb272..6c1fc0a610a7 100644 --- a/svtools/inc/svtools/treelist.hxx +++ b/svtools/inc/svtools/treelist.hxx @@ -74,74 +74,26 @@ private: size_t maCurrent; public: - SvTreeEntryList() { maCurrent = 0; }; - SvTreeEntryList( SvTreeEntryList& rList ); - - void DestroyAll(); - void push_back( SvListEntry* pItem ) - { maEntryList.push_back( pItem ); } - void insert( SvListEntry* pItem, size_t i ) - { - if ( i < maEntryList.size() ) { - maEntryList.insert( maEntryList.begin() + i, pItem ); - } else { - maEntryList.push_back( pItem ); - } - } - void remove( SvListEntry* pItem ) - { - for ( SvTreeEntryList_impl::iterator it = maEntryList.begin(); - it != maEntryList.end(); - ++it - ) { - if ( *it == pItem ) { - maEntryList.erase( it ); - break; - } - } - } - void remove( size_t i ) - { - if ( i < maEntryList.size() ) { - maEntryList.erase( maEntryList.begin() + i ); - } - } - void replace( SvListEntry* pNew, SvListEntry* pOld ) - { - for ( size_t i = 0, n = maEntryList.size(); i < n; ++i ) { - if ( maEntryList[ i ] == pOld ) { - maEntryList[ i ] = pNew; - break; - } - } - } - void clear() { maEntryList.clear(); } - - bool empty() { return maEntryList.empty(); } - - size_t size() { return maEntryList.size(); } - size_t GetPos( SvListEntry* pItem ) - { - for ( size_t i = 0, n = maEntryList.size(); i < n; ++i ) { - if ( maEntryList[ i ] == pItem ) { - return i; - } - } - return (size_t)~0; - } - - SvListEntry* operator[]( size_t i ) - { return i < maEntryList.size() ? maEntryList[ i ] : NULL; } - SvListEntry* First() - { - maCurrent = 0; - return ( maCurrent < maEntryList.size() ) ? maEntryList[ 0 ] : NULL; - } - SvListEntry* Next() - { - return ( maCurrent+1 < maEntryList.size() ) ? maEntryList[ ++maCurrent ] : NULL; - } - SvListEntry* last() { return maEntryList.empty() ? NULL : maEntryList.back(); } + SvTreeEntryList(); + SvTreeEntryList(SvTreeEntryList& rList); + + void DestroyAll(); + void push_back(SvListEntry* pItem); + void insert(SvListEntry* pItem, size_t i); + void remove(SvListEntry* pItem); + void remove(size_t i); + void replace(SvListEntry* pNew, SvListEntry* pOld); + void clear(); + + bool empty(); + + size_t size(); + size_t GetPos(SvListEntry* pItem); + + SvListEntry* operator[](size_t i); + SvListEntry* First(); + SvListEntry* Next(); + SvListEntry* last(); }; //============================================================================= diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx index 42bb3e40b75c..78fb0b6824c5 100644 --- a/svtools/source/contnr/treelist.cxx +++ b/svtools/source/contnr/treelist.cxx @@ -30,6 +30,120 @@ DBG_NAME(SvListEntry); + +SvTreeEntryList::SvTreeEntryList() { maCurrent = 0; }; + +void SvTreeEntryList::push_back( SvListEntry* pItem ) +{ + maEntryList.push_back( pItem ); +} + +void SvTreeEntryList::insert( SvListEntry* pItem, size_t i ) +{ + if ( i < maEntryList.size() ) + { + maEntryList.insert( maEntryList.begin() + i, pItem ); + } + else + { + maEntryList.push_back( pItem ); + } +} + +void SvTreeEntryList::remove( SvListEntry* pItem ) +{ + for (SvTreeEntryList_impl::iterator it = maEntryList.begin(); it != maEntryList.end(); ++it) + { + if ( *it == pItem ) + { + maEntryList.erase( it ); + break; + } + } +} + +void SvTreeEntryList::remove( size_t i ) +{ + if ( i < maEntryList.size() ) { + maEntryList.erase( maEntryList.begin() + i ); + } +} + +void SvTreeEntryList::replace( SvListEntry* pNew, SvListEntry* pOld ) +{ + for ( size_t i = 0, n = maEntryList.size(); i < n; ++i ) { + if ( maEntryList[ i ] == pOld ) { + maEntryList[ i ] = pNew; + break; + } + } +} + +void SvTreeEntryList::clear() +{ + maEntryList.clear(); +} + +bool SvTreeEntryList::empty() +{ + return maEntryList.empty(); +} + +size_t SvTreeEntryList::size() +{ + return maEntryList.size(); +} + +size_t SvTreeEntryList::GetPos( SvListEntry* pItem ) +{ + for ( size_t i = 0, n = maEntryList.size(); i < n; ++i ) { + if ( maEntryList[ i ] == pItem ) { + return i; + } + } + return (size_t)~0; +} + +SvListEntry* SvTreeEntryList::operator[]( size_t i ) +{ + return i < maEntryList.size() ? maEntryList[ i ] : NULL; +} + +SvListEntry* SvTreeEntryList::First() +{ + maCurrent = 0; + return ( maCurrent < maEntryList.size() ) ? maEntryList[ 0 ] : NULL; +} + +SvListEntry* SvTreeEntryList::Next() +{ + return ( maCurrent+1 < maEntryList.size() ) ? maEntryList[ ++maCurrent ] : NULL; +} + +SvListEntry* SvTreeEntryList::last() +{ + return maEntryList.empty() ? NULL : maEntryList.back(); +} + +void SvTreeEntryList::DestroyAll() +{ + SvListEntry* pPtr = (SvListEntry*)First(); + while( pPtr ) + { + delete pPtr; + pPtr = (SvListEntry*)Next(); + } +} + +SvTreeEntryList::SvTreeEntryList(SvTreeEntryList& rList) +{ + maEntryList.clear(); + maCurrent = 0; + for ( size_t i = 0, n = rList.size(); i < n; ++i ) { + maEntryList.push_back( rList[ i ] ); + } +} + SvListEntry::SvListEntry() { DBG_CTOR(SvListEntry,0); @@ -115,29 +229,6 @@ SvViewData::~SvViewData() #endif } -//============================================================================= -// SvTreeEntryList -//============================================================================= - -void SvTreeEntryList::DestroyAll() -{ - SvListEntry* pPtr = (SvListEntry*)First(); - while( pPtr ) - { - delete pPtr; - pPtr = (SvListEntry*)Next(); - } -} - -SvTreeEntryList::SvTreeEntryList(SvTreeEntryList& rList) -{ - maEntryList.clear(); - maCurrent = 0; - for ( size_t i = 0, n = rList.size(); i < n; ++i ) { - maEntryList.push_back( rList[ i ] ); - } -} - /************************************************************************* |* |* SvTreeList:: |