diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2012-06-04 08:11:36 +0000 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2012-06-04 08:11:36 +0000 |
| commit | 026cd6f71a15edd1a242c59d5cb9f8271a108506 (patch) | |
| tree | dc2d2ee77b94fa83e8312a2c3bb0d4531cf635e2 /src/unstable | |
| parent | 8ff104489cf8eb6322bec90ebc8d66fedae665c9 (diff) | |
| download | libbu++-026cd6f71a15edd1a242c59d5cb9f8271a108506.tar.gz libbu++-026cd6f71a15edd1a242c59d5cb9f8271a108506.tar.bz2 libbu++-026cd6f71a15edd1a242c59d5cb9f8271a108506.tar.xz libbu++-026cd6f71a15edd1a242c59d5cb9f8271a108506.zip | |
UtfString supports get and append now, but it still needs a lot of work.
Diffstat (limited to '')
| -rw-r--r-- | src/unstable/utfstring.cpp | 15 | ||||
| -rw-r--r-- | src/unstable/utfstring.h | 2 |
2 files changed, 17 insertions, 0 deletions
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 @@ | |||
| 11 | #include "bu/stream.h" | 11 | #include "bu/stream.h" |
| 12 | #include "bu/config.h" | 12 | #include "bu/config.h" |
| 13 | #include "bu/sio.h" | 13 | #include "bu/sio.h" |
| 14 | #include "bu/membuf.h" | ||
| 14 | using Bu::sio; | 15 | using Bu::sio; |
| 15 | 16 | ||
| 16 | Bu::UtfString::UtfString() | 17 | Bu::UtfString::UtfString() |
| @@ -86,6 +87,13 @@ void Bu::UtfString::append( UtfChar ch ) | |||
| 86 | } | 87 | } |
| 87 | } | 88 | } |
| 88 | 89 | ||
| 90 | void Bu::UtfString::append( const UtfString &rSrc ) | ||
| 91 | { | ||
| 92 | aData.append( rSrc.aData ); | ||
| 93 | iRawLen += rSrc.iRawLen; | ||
| 94 | iCharLen += rSrc.iCharLen; | ||
| 95 | } | ||
| 96 | |||
| 89 | void Bu::UtfString::setUtf8( const Bu::String &sInput ) | 97 | void Bu::UtfString::setUtf8( const Bu::String &sInput ) |
| 90 | { | 98 | { |
| 91 | static uint8_t lmask[8] = { | 99 | static uint8_t lmask[8] = { |
| @@ -468,6 +476,13 @@ Bu::UtfChar Bu::UtfString::nextChar( int &iIndex ) | |||
| 468 | } | 476 | } |
| 469 | } | 477 | } |
| 470 | 478 | ||
| 479 | Bu::String Bu::UtfString::get( Encoding eEnc ) | ||
| 480 | { | ||
| 481 | Bu::MemBuf mb; | ||
| 482 | write( mb, eEnc ); | ||
| 483 | return mb.getString(); | ||
| 484 | } | ||
| 485 | |||
| 471 | void Bu::UtfString::debug() | 486 | void Bu::UtfString::debug() |
| 472 | { | 487 | { |
| 473 | sio << "Raw Utf16: "; | 488 | sio << "Raw Utf16: "; |
diff --git a/src/unstable/utfstring.h b/src/unstable/utfstring.h index 02b015b..af233e8 100644 --- a/src/unstable/utfstring.h +++ b/src/unstable/utfstring.h | |||
| @@ -107,6 +107,8 @@ namespace Bu | |||
| 107 | */ | 107 | */ |
| 108 | void append( UtfChar ch ); | 108 | void append( UtfChar ch ); |
| 109 | 109 | ||
| 110 | void append( const UtfString &rSrc ); | ||
| 111 | |||
| 110 | /** | 112 | /** |
| 111 | * Set the value of the entire string based on the given input and | 113 | * Set the value of the entire string based on the given input and |
| 112 | * encoding. The default encoding is Utf8, which is compatible with | 114 | * encoding. The default encoding is Utf8, which is compatible with |
