aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fbasicstring.h119
1 files changed, 44 insertions, 75 deletions
diff --git a/src/fbasicstring.h b/src/fbasicstring.h
index af11bb2..9378c1c 100644
--- a/src/fbasicstring.h
+++ b/src/fbasicstring.h
@@ -236,44 +236,8 @@ namespace Bu
236 using SharedCore<MyType, Core >::core; 236 using SharedCore<MyType, Core >::core;
237 using SharedCore<MyType, Core >::_hardCopy; 237 using SharedCore<MyType, Core >::_hardCopy;
238 238
239 public: 239 public: // Iterators
240 FBasicString() 240 typedef struct const_iterator
241 {
242 }
243
244 FBasicString( const chr *pData )
245 {
246 append( pData );
247 }
248
249 FBasicString( const chr *pData, long nLength )
250 {
251 append( pData, nLength );
252 }
253
254 FBasicString( const MyType &rSrc ) :
255 SharedCore<MyType, Core>( rSrc )
256 {
257 }
258
259 FBasicString( const MyType &rSrc, long nLength )
260 {
261 append( rSrc, nLength );
262 }
263
264 FBasicString( const MyType &rSrc, long nStart, long nLength )
265 {
266 append( rSrc, nStart, nLength );
267 }
268
269 FBasicString( long nSize )
270 {
271 core->pFirst = core->pLast = core->newChunk( nSize );
272 core->nLength = nSize;
273 }
274
275 struct iterator;
276 struct const_iterator
277 { 241 {
278 friend class FBasicString<chr, nMinSize, chralloc, chunkalloc>; 242 friend class FBasicString<chr, nMinSize, chralloc, chunkalloc>;
279 friend struct iterator; 243 friend struct iterator;
@@ -505,7 +469,7 @@ namespace Bu
505 } 469 }
506 return const_iterator( NULL, 0 ); 470 return const_iterator( NULL, 0 );
507 } 471 }
508 }; 472 } const_iterator;
509 473
510 typedef struct iterator 474 typedef struct iterator
511 { 475 {
@@ -753,11 +717,41 @@ namespace Bu
753 } 717 }
754 } iterator; 718 } iterator;
755 719
756 typedef struct const_iterator const_iterator; 720 public:
721 FBasicString()
722 {
723 }
724
725 FBasicString( const chr *pData )
726 {
727 append( pData );
728 }
729
730 FBasicString( const chr *pData, long nLength )
731 {
732 append( pData, nLength );
733 }
734
735 FBasicString( const MyType &rSrc ) :
736 SharedCore<MyType, Core>( rSrc )
737 {
738 }
757 739
758 //typedef chr *iterator; 740 FBasicString( const MyType &rSrc, long nLength )
759// typedef const chr *const_iterator; 741 {
760 // typedef iterator const_iterator; 742 append( rSrc, nLength );
743 }
744
745 FBasicString( const MyType &rSrc, long nStart, long nLength )
746 {
747 append( rSrc, nStart, nLength );
748 }
749
750 FBasicString( long nSize )
751 {
752 core->pFirst = core->pLast = core->newChunk( nSize );
753 core->nLength = nSize;
754 }
761 755
762 FBasicString( const const_iterator &s ) 756 FBasicString( const const_iterator &s )
763 { 757 {
@@ -784,7 +778,13 @@ namespace Bu
784 for( nLen = 0; pData[nLen] != (chr)0; nLen++ ) { } 778 for( nLen = 0; pData[nLen] != (chr)0; nLen++ ) { }
785 if( nLen == 0 ) 779 if( nLen == 0 )
786 return; 780 return;
787 781
782 if( core->pLast->nLength < nMinSize )
783 {
784 // Put things here, good things
785 // yeah...spare space block mapping
786 }
787
788 Chunk *pNew = core->newChunk( nLen ); 788 Chunk *pNew = core->newChunk( nLen );
789 cpy( pNew->pData, pData, nLen ); 789 cpy( pNew->pData, pData, nLen );
790 790
@@ -1263,37 +1263,6 @@ namespace Bu
1263 } 1263 }
1264 } 1264 }
1265 1265
1266 /**
1267 * (std::string compatability) Get a pointer to the string array.
1268 *@returns (chr *) The string data.
1269 */
1270 DEPRECATED
1271 chr *c_str()
1272 {
1273 if( core->pFirst == NULL )
1274 return NULL;
1275
1276 flatten();
1277 _hardCopy();
1278 core->pFirst->pData[core->nLength] = (chr)0;
1279 return core->pFirst->pData;
1280 }
1281
1282 /**
1283 * (std::string compatability) Get a const pointer to the string array.
1284 *@returns (const chr *) The string data.
1285 */
1286 DEPRECATED
1287 const chr *c_str() const
1288 {
1289 if( core->pFirst == NULL )
1290 return NULL;
1291
1292 flatten();
1293 core->pFirst->pData[core->nLength] = (chr)0;
1294 return core->pFirst->pData;
1295 }
1296
1297 Bu::List<MyType> split( const chr c ) const 1266 Bu::List<MyType> split( const chr c ) const
1298 { 1267 {
1299 Bu::List<MyType> ret; 1268 Bu::List<MyType> ret;