diff options
author | Mike Buland <eichlan@xagasoft.com> | 2009-02-27 15:21:33 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2009-02-27 15:21:33 +0000 |
commit | 7433ec9074051ea5d9f91458e2e91e29ec8020f2 (patch) | |
tree | 1e2d95a54c03c9c2129be8ec20acaf9ee7e45db0 /src/fbasicstring.h | |
parent | e198e10ffd710e9681635593dff65bf4abd45bda (diff) | |
download | libbu++-7433ec9074051ea5d9f91458e2e91e29ec8020f2.tar.gz libbu++-7433ec9074051ea5d9f91458e2e91e29ec8020f2.tar.bz2 libbu++-7433ec9074051ea5d9f91458e2e91e29ec8020f2.tar.xz libbu++-7433ec9074051ea5d9f91458e2e91e29ec8020f2.zip |
Fixed a bug in Bu::FString, it wouldn't concatinate properly when using the +
operator and the left-hand-side FString was const. Also, added a formatter <<
operator for Bu::List. The other containers should get their own formatter <<
operators soon too.
Diffstat (limited to '')
-rw-r--r-- | src/fbasicstring.h | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/fbasicstring.h b/src/fbasicstring.h index cac7dd7..a532d69 100644 --- a/src/fbasicstring.h +++ b/src/fbasicstring.h | |||
@@ -999,7 +999,7 @@ namespace Bu | |||
999 | * Plus equals operator for FString. | 999 | * Plus equals operator for FString. |
1000 | *@param pData (const chr *) The data to append to your FString. | 1000 | *@param pData (const chr *) The data to append to your FString. |
1001 | */ | 1001 | */ |
1002 | MyType &operator +=( const chr *pData ) | 1002 | MyType &operator+=( const chr *pData ) |
1003 | { | 1003 | { |
1004 | append( pData ); | 1004 | append( pData ); |
1005 | 1005 | ||
@@ -1010,7 +1010,7 @@ namespace Bu | |||
1010 | * Plus equals operator for FString. | 1010 | * Plus equals operator for FString. |
1011 | *@param pData (const MyType &) The FString to append to your FString. | 1011 | *@param pData (const MyType &) The FString to append to your FString. |
1012 | */ | 1012 | */ |
1013 | MyType &operator +=( const MyType &rSrc ) | 1013 | MyType &operator+=( const MyType &rSrc ) |
1014 | { | 1014 | { |
1015 | if( rSrc.nLength == 0 ) | 1015 | if( rSrc.nLength == 0 ) |
1016 | return (*this); | 1016 | return (*this); |
@@ -1024,7 +1024,7 @@ namespace Bu | |||
1024 | * Plus equals operator for FString. | 1024 | * Plus equals operator for FString. |
1025 | *@param pData (const chr) The character to append to your FString. | 1025 | *@param pData (const chr) The character to append to your FString. |
1026 | */ | 1026 | */ |
1027 | MyType &operator +=( const chr cData ) | 1027 | MyType &operator+=( const chr cData ) |
1028 | { | 1028 | { |
1029 | if( pLast && pLast->nLength < nMinSize ) | 1029 | if( pLast && pLast->nLength < nMinSize ) |
1030 | { | 1030 | { |
@@ -1046,7 +1046,7 @@ namespace Bu | |||
1046 | *@param pData (const chr *) The character array to append to your | 1046 | *@param pData (const chr *) The character array to append to your |
1047 | * FString. | 1047 | * FString. |
1048 | */ | 1048 | */ |
1049 | MyType &operator =( const chr *pData ) | 1049 | MyType &operator=( const chr *pData ) |
1050 | { | 1050 | { |
1051 | clear(); | 1051 | clear(); |
1052 | append( pData ); | 1052 | append( pData ); |
@@ -1054,7 +1054,7 @@ namespace Bu | |||
1054 | return (*this); | 1054 | return (*this); |
1055 | } | 1055 | } |
1056 | 1056 | ||
1057 | MyType &operator =( const std::basic_string<chr> &rData ) | 1057 | MyType &operator=( const std::basic_string<chr> &rData ) |
1058 | { | 1058 | { |
1059 | clear(); | 1059 | clear(); |
1060 | append( rData.c_str(), rData.size() ); | 1060 | append( rData.c_str(), rData.size() ); |
@@ -1062,21 +1062,21 @@ namespace Bu | |||
1062 | return (*this); | 1062 | return (*this); |
1063 | } | 1063 | } |
1064 | 1064 | ||
1065 | MyType operator +( const MyType &rRight ) | 1065 | MyType operator+( const MyType &rRight ) const |
1066 | { | 1066 | { |
1067 | MyType ret( *this ); | 1067 | MyType ret( *this ); |
1068 | ret.append( rRight ); | 1068 | ret.append( rRight ); |
1069 | return ret; | 1069 | return ret; |
1070 | } | 1070 | } |
1071 | 1071 | ||
1072 | MyType operator +( const chr *pRight ) | 1072 | MyType operator+( const chr *pRight ) const |
1073 | { | 1073 | { |
1074 | MyType ret( *this ); | 1074 | MyType ret( *this ); |
1075 | ret.append( pRight ); | 1075 | ret.append( pRight ); |
1076 | return ret; | 1076 | return ret; |
1077 | } | 1077 | } |
1078 | 1078 | ||
1079 | MyType operator +( chr *pRight ) | 1079 | MyType operator+( chr *pRight ) const |
1080 | { | 1080 | { |
1081 | MyType ret( *this ); | 1081 | MyType ret( *this ); |
1082 | ret.append( pRight ); | 1082 | ret.append( pRight ); |
@@ -1171,7 +1171,7 @@ namespace Bu | |||
1171 | * Assignment operator. | 1171 | * Assignment operator. |
1172 | *@param rSrc (const MyType &) The FString to set your FString to. | 1172 | *@param rSrc (const MyType &) The FString to set your FString to. |
1173 | */ | 1173 | */ |
1174 | MyType &operator =( const MyType &rSrc ) | 1174 | MyType &operator=( const MyType &rSrc ) |
1175 | { | 1175 | { |
1176 | copyFrom( rSrc ); | 1176 | copyFrom( rSrc ); |
1177 | 1177 | ||
@@ -1183,7 +1183,7 @@ namespace Bu | |||
1183 | *@param pData (const chr *) The character array to compare your FString | 1183 | *@param pData (const chr *) The character array to compare your FString |
1184 | * to. | 1184 | * to. |
1185 | */ | 1185 | */ |
1186 | bool operator ==( const chr *pData ) const | 1186 | bool operator==( const chr *pData ) const |
1187 | { | 1187 | { |
1188 | if( pFirst == NULL ) { | 1188 | if( pFirst == NULL ) { |
1189 | if( pData == NULL ) | 1189 | if( pData == NULL ) |
@@ -1212,7 +1212,7 @@ namespace Bu | |||
1212 | * Equals comparison operator. | 1212 | * Equals comparison operator. |
1213 | *@param pData (const MyType &) The FString to compare your FString to. | 1213 | *@param pData (const MyType &) The FString to compare your FString to. |
1214 | */ | 1214 | */ |
1215 | bool operator ==( const MyType &pData ) const | 1215 | bool operator==( const MyType &pData ) const |
1216 | { | 1216 | { |
1217 | if( pFirst == pData.pFirst ) | 1217 | if( pFirst == pData.pFirst ) |
1218 | return true; | 1218 | return true; |
@@ -1239,7 +1239,7 @@ namespace Bu | |||
1239 | *@param pData (const chr *) The character array to compare your FString | 1239 | *@param pData (const chr *) The character array to compare your FString |
1240 | * to. | 1240 | * to. |
1241 | */ | 1241 | */ |
1242 | bool operator !=(const chr *pData ) const | 1242 | bool operator!=(const chr *pData ) const |
1243 | { | 1243 | { |
1244 | return !(*this == pData); | 1244 | return !(*this == pData); |
1245 | } | 1245 | } |
@@ -1248,7 +1248,7 @@ namespace Bu | |||
1248 | * Not equals comparison operator. | 1248 | * Not equals comparison operator. |
1249 | *@param pData (const MyType &) The FString to compare your FString to. | 1249 | *@param pData (const MyType &) The FString to compare your FString to. |
1250 | */ | 1250 | */ |
1251 | bool operator !=(const MyType &pData ) const | 1251 | bool operator!=(const MyType &pData ) const |
1252 | { | 1252 | { |
1253 | return !(*this == pData); | 1253 | return !(*this == pData); |
1254 | } | 1254 | } |
@@ -1759,7 +1759,7 @@ namespace Bu | |||
1759 | mutable chunkalloc aChunk; | 1759 | mutable chunkalloc aChunk; |
1760 | }; | 1760 | }; |
1761 | 1761 | ||
1762 | template<class T> FBasicString<T> operator +( const T *pLeft, const FBasicString<T> &rRight ) | 1762 | template<class T> FBasicString<T> operator+( const T *pLeft, const FBasicString<T> &rRight ) |
1763 | { | 1763 | { |
1764 | Bu::FBasicString<T> ret( pLeft ); | 1764 | Bu::FBasicString<T> ret( pLeft ); |
1765 | ret.append( rRight ); | 1765 | ret.append( rRight ); |