aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/fstring.h67
-rw-r--r--src/hash.h10
2 files changed, 77 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() )
diff --git a/src/hash.h b/src/hash.h
index aa02960..e819379 100644
--- a/src/hash.h
+++ b/src/hash.h
@@ -119,6 +119,16 @@ public:
119 119
120 return nval; 120 return nval;
121 } 121 }
122
123 _value *operator->()
124 {
125 if( bFilled == false )
126 throw HashException(
127 excodeNotFilled,
128 "No data assosiated with that key."
129 );
130 return pValue;
131 }
122}; 132};
123 133
124template<typename key, typename value, typename sizecalc, typename keyalloc, typename valuealloc, typename challoc > 134template<typename key, typename value, typename sizecalc, typename keyalloc, typename valuealloc, typename challoc >