diff options
author | Mike Buland <eichlan@xagasoft.com> | 2011-03-24 23:59:39 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2011-03-24 23:59:39 +0000 |
commit | 58a0ba451a28497e5b4572a89db4f8f98ee441ee (patch) | |
tree | 4139468b266cdae0a07ae90ed170e15f397b331d /src | |
parent | 847eff6703ad71eb6c59947a8cf9d6803597c43c (diff) | |
download | libbu++-58a0ba451a28497e5b4572a89db4f8f98ee441ee.tar.gz libbu++-58a0ba451a28497e5b4572a89db4f8f98ee441ee.tar.bz2 libbu++-58a0ba451a28497e5b4572a89db4f8f98ee441ee.tar.xz libbu++-58a0ba451a28497e5b4572a89db4f8f98ee441ee.zip |
This may really screw things up, but the trimBack function made no sense, so
I changed it. We'll have to add back in the other one if anyone needs it.
This will most likely require things to be rebuilt, but they'll complain instead
of mislinking this time :-P
Diffstat (limited to '')
-rw-r--r-- | src/string.cpp | 19 | ||||
-rw-r--r-- | src/string.h | 3 |
2 files changed, 20 insertions, 2 deletions
diff --git a/src/string.cpp b/src/string.cpp index ce86c0d..9cf3ffc 100644 --- a/src/string.cpp +++ b/src/string.cpp | |||
@@ -1103,7 +1103,7 @@ void Bu::String::trimFront( long nAmnt ) | |||
1103 | core->clear(); | 1103 | core->clear(); |
1104 | core->appendChunk( pNew ); | 1104 | core->appendChunk( pNew ); |
1105 | } | 1105 | } |
1106 | 1106 | /* | |
1107 | void Bu::String::trimBack( char c ) | 1107 | void Bu::String::trimBack( char c ) |
1108 | { | 1108 | { |
1109 | if( core->pFirst == NULL || core->nLength == 0 ) | 1109 | if( core->pFirst == NULL || core->nLength == 0 ) |
@@ -1113,6 +1113,23 @@ void Bu::String::trimBack( char c ) | |||
1113 | core->pFirst->pData[core->pFirst->nLength-1] == c; | 1113 | core->pFirst->pData[core->pFirst->nLength-1] == c; |
1114 | core->pFirst->nLength--, core->nLength-- ) { } | 1114 | core->pFirst->nLength--, core->nLength-- ) { } |
1115 | } | 1115 | } |
1116 | */ | ||
1117 | void Bu::String::trimBack( long iAmnt ) | ||
1118 | { | ||
1119 | if( iAmnt < 0 ) | ||
1120 | return; | ||
1121 | if( core->nLength - iAmnt < 0 ) | ||
1122 | { | ||
1123 | clear(); | ||
1124 | return; | ||
1125 | } | ||
1126 | if( core->pFirst == NULL || core->nLength == 0 ) | ||
1127 | return; | ||
1128 | |||
1129 | flatten(); | ||
1130 | core->pFirst->nLength -= iAmnt; | ||
1131 | core->nLength -= iAmnt; | ||
1132 | } | ||
1116 | 1133 | ||
1117 | Bu::String::iterator Bu::String::begin() | 1134 | Bu::String::iterator Bu::String::begin() |
1118 | { | 1135 | { |
diff --git a/src/string.h b/src/string.h index 59a2cd1..71798db 100644 --- a/src/string.h +++ b/src/string.h | |||
@@ -923,7 +923,8 @@ namespace Bu | |||
923 | */ | 923 | */ |
924 | void trimFront( long nAmnt ); | 924 | void trimFront( long nAmnt ); |
925 | 925 | ||
926 | void trimBack( char c ); | 926 | // void trimBack( char c ); |
927 | void trimBack( long iAmnt ); | ||
927 | 928 | ||
928 | iterator begin(); | 929 | iterator begin(); |
929 | 930 | ||