summaryrefslogtreecommitdiff
path: root/svtools/source
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-09-27 00:33:21 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-09-27 13:45:19 -0400
commitccc779769153ce61f658776f6c2847eb4242e3bd (patch)
treee01e536811e4cfbc5bf61e41ef01c4619e4c7b33 /svtools/source
parent7d92ac2f05679933d9a2df131786efa6ece00705 (diff)
Hide method definitions of SvTreeEntryList.
Change-Id: Id110a12bc462d4da0b000d7c441da34f861c8892
Diffstat (limited to 'svtools/source')
-rw-r--r--svtools/source/contnr/treelist.cxx137
1 files changed, 114 insertions, 23 deletions
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::