aboutsummaryrefslogtreecommitdiff
path: root/src/fstring.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2007-03-25 21:13:52 +0000
committerMike Buland <eichlan@xagasoft.com>2007-03-25 21:13:52 +0000
commit58d5ac863b8f94f74b20edee7604f33cca186b2f (patch)
tree1e3ad911361d78d89a0a17038cb41cf26e2c2132 /src/fstring.h
parent76185dca1136f9542e75361961c2e7362d8b670b (diff)
downloadlibbu++-58d5ac863b8f94f74b20edee7604f33cca186b2f.tar.gz
libbu++-58d5ac863b8f94f74b20edee7604f33cca186b2f.tar.bz2
libbu++-58d5ac863b8f94f74b20edee7604f33cca186b2f.tar.xz
libbu++-58d5ac863b8f94f74b20edee7604f33cca186b2f.zip
Some more updates to Hash and FString.
Diffstat (limited to 'src/fstring.h')
-rw-r--r--src/fstring.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/src/fstring.h b/src/fstring.h
index 2f7dc67..f0462cb 100644
--- a/src/fstring.h
+++ b/src/fstring.h
@@ -76,6 +76,33 @@ public:
76 //copyFrom( rSrc ); 76 //copyFrom( rSrc );
77 } 77 }
78 78
79 FBasicString( const MyType &rSrc, long nLength ) :
80 nLength( 0 ),
81 pnRefs( NULL ),
82 pFirst( NULL ),
83 pLast( NULL )
84 {
85 append( rSrc.pFirst->pData, nLength );
86 }
87
88 FBasicString( const MyType &rSrc, long nStart, long nLength ) :
89 nLength( 0 ),
90 pnRefs( NULL ),
91 pFirst( NULL ),
92 pLast( NULL )
93 {
94 append( rSrc.pFirst->pData+nStart, nLength );
95 }
96
97 FBasicString( long nSize ) :
98 nLength( nSize ),
99 pnRefs( NULL ),
100 pFirst( NULL ),
101 pLast( NULL )
102 {
103 pFirst = pLast = newChunk( nSize );
104 }
105
79 virtual ~FBasicString() 106 virtual ~FBasicString()
80 { 107 {
81 clear(); 108 clear();
@@ -190,6 +217,14 @@ public:
190 217
191 return (*this); 218 return (*this);
192 } 219 }
220
221 MyType &operator +=( const MyType &rSrc )
222 {
223 rSrc.flatten();
224 append( rSrc.pFirst->pData, rSrc.nLength );
225
226 return (*this);
227 }
193 228
194 MyType &operator +=( const chr pData ) 229 MyType &operator +=( const chr pData )
195 { 230 {
@@ -294,6 +329,38 @@ public:
294 || pFirst->pData[nIndex]=='\r' || pFirst->pData[nIndex]=='\n'; 329 || pFirst->pData[nIndex]=='\r' || pFirst->pData[nIndex]=='\n';
295 } 330 }
296 331
332 bool isAlpha( long nIndex ) const
333 {
334 flatten();
335
336 return (pFirst->pData[nIndex] >= 'a' && pFirst->pData[nIndex] <= 'z')
337 || (pFirst->pData[nIndex] >= 'A' && pFirst->pData[nIndex] <= 'Z');
338 }
339
340 void toLower()
341 {
342 flatten();
343 unShare();
344
345 for( long j = 0; j < nLength; j++ )
346 {
347 if( pFirst->pData[j] >= 'A' && pFirst->pData[j] <= 'Z' )
348 pFirst->pData[j] -= 'A'-'a';
349 }
350 }
351
352 void toUpper()
353 {
354 flatten();
355 unShare();
356
357 for( long j = 0; j < nLength; j++ )
358 {
359 if( pFirst->pData[j] >= 'a' && pFirst->pData[j] <= 'z' )
360 pFirst->pData[j] += 'A'-'a';
361 }
362 }
363
297 void serialize( class Serializer &ar ) 364 void serialize( class Serializer &ar )
298 { 365 {
299 if( ar.isLoading() ) 366 if( ar.isLoading() )