diff options
author | Mike Buland <eichlan@xagasoft.com> | 2012-01-17 05:38:42 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2012-01-17 05:38:42 +0000 |
commit | 85524a0050459146e6ffbce74f998cb789ed48b5 (patch) | |
tree | ca442fd676ef3478ea0ad2558047c6aa5d0b4867 | |
parent | 156ce25ce08fe67556e812f9361bf4ad57b860c5 (diff) | |
download | libbu++-85524a0050459146e6ffbce74f998cb789ed48b5.tar.gz libbu++-85524a0050459146e6ffbce74f998cb789ed48b5.tar.bz2 libbu++-85524a0050459146e6ffbce74f998cb789ed48b5.tar.xz libbu++-85524a0050459146e6ffbce74f998cb789ed48b5.zip |
Added some extras to the array class...it's kind of lagging behind the others.
-rw-r--r-- | mingw.bld | 2 | ||||
-rw-r--r-- | src/array.h | 38 |
2 files changed, 39 insertions, 1 deletions
@@ -44,7 +44,7 @@ target "libbu++win.a" | |||
44 | CXXFLAGS += "-I. -Isupport/windows"; | 44 | CXXFLAGS += "-I. -Isupport/windows"; |
45 | } | 45 | } |
46 | 46 | ||
47 | target "src/process.win_o" | 47 | target ["src/process.win_o", "src/deflate.win_o", "src/lzma.win_o"] |
48 | { | 48 | { |
49 | profile "build" | 49 | profile "build" |
50 | { | 50 | { |
diff --git a/src/array.h b/src/array.h index f091a81..fcd800e 100644 --- a/src/array.h +++ b/src/array.h | |||
@@ -197,6 +197,26 @@ namespace Bu | |||
197 | 197 | ||
198 | return *this; | 198 | return *this; |
199 | } | 199 | } |
200 | |||
201 | MyType &append( const MyType &rVal ) | ||
202 | { | ||
203 | _hardCopy(); | ||
204 | |||
205 | if( core->iSize + rVal.core->iSize > core->iCapacity ) | ||
206 | { | ||
207 | core->setCapacity( core->iSize + rVal.core->iSize + inc ); | ||
208 | } | ||
209 | |||
210 | for( int j = 0; j < rVal.core->iSize; j++ ) | ||
211 | { | ||
212 | core->va.construct( | ||
213 | &core->pData[core->iSize++], | ||
214 | rVal.core->pData[j] | ||
215 | ); | ||
216 | } | ||
217 | |||
218 | return *this; | ||
219 | } | ||
200 | 220 | ||
201 | //operator | 221 | //operator |
202 | value &operator[]( long iIndex ) | 222 | value &operator[]( long iIndex ) |
@@ -427,6 +447,11 @@ namespace Bu | |||
427 | long iPos; | 447 | long iPos; |
428 | 448 | ||
429 | public: | 449 | public: |
450 | const_iterator( iterator &rSrc ) : | ||
451 | src( rSrc.src ), | ||
452 | iPos( rSrc.iPos ) | ||
453 | { | ||
454 | } | ||
430 | const_iterator operator++( int ) | 455 | const_iterator operator++( int ) |
431 | { | 456 | { |
432 | if( iPos < 0 ) | 457 | if( iPos < 0 ) |
@@ -570,6 +595,19 @@ namespace Bu | |||
570 | core->erase( i.iPos ); | 595 | core->erase( i.iPos ); |
571 | } | 596 | } |
572 | 597 | ||
598 | void erase( const value &v ) | ||
599 | { | ||
600 | _hardCopy(); | ||
601 | for( int j = 0; j < core->iSize; j++ ) | ||
602 | { | ||
603 | if( core->pData[j] == v ) | ||
604 | { | ||
605 | core->erase( j ); | ||
606 | return; | ||
607 | } | ||
608 | } | ||
609 | } | ||
610 | |||
573 | void eraseLast() | 611 | void eraseLast() |
574 | { | 612 | { |
575 | _hardCopy(); | 613 | _hardCopy(); |