From 026cd6f71a15edd1a242c59d5cb9f8271a108506 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 4 Jun 2012 08:11:36 +0000 Subject: UtfString supports get and append now, but it still needs a lot of work. --- src/unstable/utfstring.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/unstable/utfstring.cpp') diff --git a/src/unstable/utfstring.cpp b/src/unstable/utfstring.cpp index a5d6605..1c6813c 100644 --- a/src/unstable/utfstring.cpp +++ b/src/unstable/utfstring.cpp @@ -11,6 +11,7 @@ #include "bu/stream.h" #include "bu/config.h" #include "bu/sio.h" +#include "bu/membuf.h" using Bu::sio; Bu::UtfString::UtfString() @@ -86,6 +87,13 @@ void Bu::UtfString::append( UtfChar ch ) } } +void Bu::UtfString::append( const UtfString &rSrc ) +{ + aData.append( rSrc.aData ); + iRawLen += rSrc.iRawLen; + iCharLen += rSrc.iCharLen; +} + void Bu::UtfString::setUtf8( const Bu::String &sInput ) { static uint8_t lmask[8] = { @@ -468,6 +476,13 @@ Bu::UtfChar Bu::UtfString::nextChar( int &iIndex ) } } +Bu::String Bu::UtfString::get( Encoding eEnc ) +{ + Bu::MemBuf mb; + write( mb, eEnc ); + return mb.getString(); +} + void Bu::UtfString::debug() { sio << "Raw Utf16: "; -- cgit v1.2.3