diff options
Diffstat (limited to 'src/fstring.h')
-rw-r--r-- | src/fstring.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/fstring.h b/src/fstring.h index 877e5a7..f738f63 100644 --- a/src/fstring.h +++ b/src/fstring.h | |||
@@ -28,7 +28,7 @@ namespace Bu | |||
28 | * data is actually copied. This also means that you never need to put any | 28 | * data is actually copied. This also means that you never need to put any |
29 | * FBasicString into a ref-counting container class. | 29 | * FBasicString into a ref-counting container class. |
30 | */ | 30 | */ |
31 | template< typename chr, typename chralloc=std::allocator<chr>, typename chunkalloc=std::allocator<struct FStringChunk<chr> > > | 31 | template< typename chr, int nMinSize=256, typename chralloc=std::allocator<chr>, typename chunkalloc=std::allocator<struct FStringChunk<chr> > > |
32 | class FBasicString : public Archival | 32 | class FBasicString : public Archival |
33 | { | 33 | { |
34 | #ifndef VALTEST | 34 | #ifndef VALTEST |
@@ -36,7 +36,7 @@ namespace Bu | |||
36 | #endif | 36 | #endif |
37 | private: | 37 | private: |
38 | typedef struct FStringChunk<chr> Chunk; | 38 | typedef struct FStringChunk<chr> Chunk; |
39 | typedef struct FBasicString<chr, chralloc, chunkalloc> MyType; | 39 | typedef struct FBasicString<chr, nMinSize, chralloc, chunkalloc> MyType; |
40 | 40 | ||
41 | public: | 41 | public: |
42 | FBasicString() : | 42 | FBasicString() : |
@@ -131,6 +131,11 @@ namespace Bu | |||
131 | appendChunk( pNew ); | 131 | appendChunk( pNew ); |
132 | } | 132 | } |
133 | 133 | ||
134 | void append( const chr cData ) | ||
135 | { | ||
136 | append( &cData, 1 ); | ||
137 | } | ||
138 | |||
134 | void prepend( const chr *pData ) | 139 | void prepend( const chr *pData ) |
135 | { | 140 | { |
136 | long nLen; | 141 | long nLen; |
@@ -231,8 +236,7 @@ namespace Bu | |||
231 | 236 | ||
232 | MyType &operator +=( const chr pData ) | 237 | MyType &operator +=( const chr pData ) |
233 | { | 238 | { |
234 | chr tmp[2] = { pData, (chr)0 }; | 239 | append( &pData, 1 ); |
235 | append( tmp ); | ||
236 | 240 | ||
237 | return (*this); | 241 | return (*this); |
238 | } | 242 | } |
@@ -475,7 +479,7 @@ namespace Bu | |||
475 | } | 479 | } |
476 | } | 480 | } |
477 | 481 | ||
478 | void copyFrom( const FBasicString<chr, chralloc, chunkalloc> &rSrc ) | 482 | void copyFrom( const FBasicString<chr, nMinSize, chralloc, chunkalloc> &rSrc ) |
479 | { | 483 | { |
480 | if( rSrc.pFirst == NULL ) | 484 | if( rSrc.pFirst == NULL ) |
481 | return; | 485 | return; |