aboutsummaryrefslogtreecommitdiff
path: root/src/unstable/textbuilder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/unstable/textbuilder.cpp')
-rw-r--r--src/unstable/textbuilder.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/unstable/textbuilder.cpp b/src/unstable/textbuilder.cpp
index 26b46f5..acd3501 100644
--- a/src/unstable/textbuilder.cpp
+++ b/src/unstable/textbuilder.cpp
@@ -196,8 +196,15 @@ void Bu::TextBuilderCore::copyTo( void *pDestRaw, int32_t iLength )
196 Chunk *pCur = pFirst; 196 Chunk *pCur = pFirst;
197 while( pCur && iLength ) 197 while( pCur && iLength )
198 { 198 {
199 int32_t iChunkLun = pCur->iLength; 199 int32_t iChunkLen = pCur->iLength;
200 if( iChunkLen > iLength )
201 iChunkLen = iLength;
200 202
203 memcpy( pDest, pCur->pData, iChunkLen*sizeof(CodePoint) );
204 pDest += iChunkLen;
205 iLength -= iChunkLen;
206
207 pCur = pCur->pNext;
201 } 208 }
202} 209}
203 210
@@ -225,6 +232,7 @@ Bu::TextBuilder::TextBuilder()
225 232
226Bu::TextBuilder::TextBuilder( const Text &rSrc ) 233Bu::TextBuilder::TextBuilder( const Text &rSrc )
227{ 234{
235 core->append( rSrc.getData(), rSrc.getSize() );
228} 236}
229 237
230Bu::TextBuilder::TextBuilder( const TextBuilder &rSrc ) : 238Bu::TextBuilder::TextBuilder( const TextBuilder &rSrc ) :
@@ -245,26 +253,31 @@ void Bu::TextBuilder::set( const Text &rSrc )
245void Bu::TextBuilder::append( const Text &rSrc ) 253void Bu::TextBuilder::append( const Text &rSrc )
246{ 254{
247 _hardCopy(); 255 _hardCopy();
256 core->append( rSrc.getData(), rSrc.getSize() );
248} 257}
249 258
250void Bu::TextBuilder::append( const CodePoint *pSrc, int32_t iLength ) 259void Bu::TextBuilder::append( const CodePoint *pSrc, int32_t iLength )
251{ 260{
252 _hardCopy(); 261 _hardCopy();
262 core->append( pSrc, iLength );
253} 263}
254 264
255void Bu::TextBuilder::prepend( const Text &rSrc ) 265void Bu::TextBuilder::prepend( const Text &rSrc )
256{ 266{
257 _hardCopy(); 267 _hardCopy();
268 core->prepend( rSrc.getData(), rSrc.getSize() );
258} 269}
259 270
260void Bu::TextBuilder::insert( const Text &rSrc ) 271void Bu::TextBuilder::insert( int32_t iBefore, const Text &rSrc )
261{ 272{
262 _hardCopy(); 273 _hardCopy();
274 core->insert( iBefore, rSrc.getData(), rSrc.getSize() );
263} 275}
264 276
265void Bu::TextBuilder::clear() 277void Bu::TextBuilder::clear()
266{ 278{
267 _hardCopy(); 279 _hardCopy();
280 core->clear();
268} 281}
269 282
270int32_t Bu::TextBuilder::getSize() const 283int32_t Bu::TextBuilder::getSize() const
@@ -295,7 +308,7 @@ Bu::TextBuilder &Bu::TextBuilder::operator=( const Text &rSrc )
295 308
296Bu::TextBuilder &Bu::TextBuilder::operator==( const Text &rSrc ) 309Bu::TextBuilder &Bu::TextBuilder::operator==( const Text &rSrc )
297{ 310{
298 set( pSrc ); 311
299 return *this; 312 return *this;
300} 313}
301 314