diff options
author | Mike Buland <mbuland@penny-arcade.com> | 2023-04-24 10:37:48 -0700 |
---|---|---|
committer | Mike Buland <mbuland@penny-arcade.com> | 2023-04-24 10:37:48 -0700 |
commit | 944e2b6a9d8ee97c3202ac0403edec234d0bfa31 (patch) | |
tree | 28a8383f475f2e2fb8f22de609671cb379603cf3 | |
parent | af849fa314ad335e14c82a2018ee7d7bea91842a (diff) | |
download | libbu++-944e2b6a9d8ee97c3202ac0403edec234d0bfa31.tar.gz libbu++-944e2b6a9d8ee97c3202ac0403edec234d0bfa31.tar.bz2 libbu++-944e2b6a9d8ee97c3202ac0403edec234d0bfa31.tar.xz libbu++-944e2b6a9d8ee97c3202ac0403edec234d0bfa31.zip |
More tweaks to make things easier to transition.
Diffstat (limited to '')
-rw-r--r-- | src/stable/string.cpp | 10 | ||||
-rw-r--r-- | src/stable/string.h | 12 | ||||
-rw-r--r-- | src/unstable/blob.cpp | 4 | ||||
-rw-r--r-- | src/unstable/blob.h | 2 | ||||
-rw-r--r-- | src/unstable/utfstring.cpp | 5 | ||||
-rw-r--r-- | src/unstable/utfstring.h | 2 |
6 files changed, 30 insertions, 5 deletions
diff --git a/src/stable/string.cpp b/src/stable/string.cpp index ed4e58b..98b78bd 100644 --- a/src/stable/string.cpp +++ b/src/stable/string.cpp | |||
@@ -516,6 +516,16 @@ const char *Bu::String::getStr() const | |||
516 | return core->pFirst->pData; | 516 | return core->pFirst->pData; |
517 | } | 517 | } |
518 | 518 | ||
519 | char *Bu::String::getData() | ||
520 | { | ||
521 | return getStr(); | ||
522 | } | ||
523 | |||
524 | const char *Bu::String::getData() const | ||
525 | { | ||
526 | return getStr(); | ||
527 | } | ||
528 | |||
519 | const char *Bu::String::getConstStr() const | 529 | const char *Bu::String::getConstStr() const |
520 | { | 530 | { |
521 | return getStr(); | 531 | return getStr(); |
diff --git a/src/stable/string.h b/src/stable/string.h index c469580..1fc5496 100644 --- a/src/stable/string.h +++ b/src/stable/string.h | |||
@@ -721,6 +721,18 @@ namespace Bu | |||
721 | *@returns (const char *) The string data. | 721 | *@returns (const char *) The string data. |
722 | */ | 722 | */ |
723 | const char *getStr() const; | 723 | const char *getStr() const; |
724 | |||
725 | /** | ||
726 | * Get a pointer to the string array. | ||
727 | *@returns (char *) The string data. | ||
728 | */ | ||
729 | char *getData(); | ||
730 | |||
731 | /** | ||
732 | * Get a const pointer to the string array. | ||
733 | *@returns (const char *) The string data. | ||
734 | */ | ||
735 | const char *getData() const; | ||
724 | 736 | ||
725 | /** | 737 | /** |
726 | * A convinience function, this one won't cause as much work as the | 738 | * A convinience function, this one won't cause as much work as the |
diff --git a/src/unstable/blob.cpp b/src/unstable/blob.cpp index c4148e1..213a1ec 100644 --- a/src/unstable/blob.cpp +++ b/src/unstable/blob.cpp | |||
@@ -811,7 +811,7 @@ Bu::Formatter &Bu::operator<<( Bu::Formatter &rOut, const Bu::Blob &b ) | |||
811 | return rOut; | 811 | return rOut; |
812 | } | 812 | } |
813 | 813 | ||
814 | Bu::ArchiveBase &operator<<( Bu::ArchiveBase &ar, const Bu::Blob &b ) | 814 | Bu::ArchiveBase &Bu::operator<<( Bu::ArchiveBase &ar, const Bu::Blob &b ) |
815 | { | 815 | { |
816 | int32_t iSize = b.getSize(); | 816 | int32_t iSize = b.getSize(); |
817 | ar << iSize; | 817 | ar << iSize; |
@@ -819,7 +819,7 @@ Bu::ArchiveBase &operator<<( Bu::ArchiveBase &ar, const Bu::Blob &b ) | |||
819 | return ar; | 819 | return ar; |
820 | } | 820 | } |
821 | 821 | ||
822 | Bu::ArchiveBase &operator>>( Bu::ArchiveBase &ar, Bu::Blob &b ) | 822 | Bu::ArchiveBase &Bu::operator>>( Bu::ArchiveBase &ar, Bu::Blob &b ) |
823 | { | 823 | { |
824 | int32_t iSize; | 824 | int32_t iSize; |
825 | ar >> iSize; | 825 | ar >> iSize; |
diff --git a/src/unstable/blob.h b/src/unstable/blob.h index dfddb02..8f948e2 100644 --- a/src/unstable/blob.h +++ b/src/unstable/blob.h | |||
@@ -31,6 +31,8 @@ namespace Bu | |||
31 | */ | 31 | */ |
32 | class Blob | 32 | class Blob |
33 | { | 33 | { |
34 | friend ArchiveBase &operator<<( ArchiveBase &ar, const Blob &s ); | ||
35 | friend ArchiveBase &operator>>( ArchiveBase &ar, Blob &s ); | ||
34 | public: | 36 | public: |
35 | class iterator; | 37 | class iterator; |
36 | class const_iterator; | 38 | class const_iterator; |
diff --git a/src/unstable/utfstring.cpp b/src/unstable/utfstring.cpp index 6217f80..13a6046 100644 --- a/src/unstable/utfstring.cpp +++ b/src/unstable/utfstring.cpp | |||
@@ -729,11 +729,12 @@ bool Bu::UtfString::operator>=( const Bu::UtfString &rhs ) const | |||
729 | return false; | 729 | return false; |
730 | } | 730 | } |
731 | 731 | ||
732 | Bu::Blob Bu::UtfString::get( Encoding eEnc ) const | 732 | Bu::String Bu::UtfString::get( Encoding eEnc ) const |
733 | { | 733 | { |
734 | Bu::MemBuf mb; | 734 | Bu::MemBuf mb; |
735 | write( mb, eEnc ); | 735 | write( mb, eEnc ); |
736 | return Bu::Blob( mb.getString().getStr(), mb.getString().getSize() ); | 736 | //return Bu::Blob( mb.getString().getStr(), mb.getString().getSize() ); |
737 | return Bu::String( mb.getString().getStr(), mb.getString().getSize() ); | ||
737 | } | 738 | } |
738 | 739 | ||
739 | void Bu::UtfString::debug() const | 740 | void Bu::UtfString::debug() const |
diff --git a/src/unstable/utfstring.h b/src/unstable/utfstring.h index 3c64a75..5355f3e 100644 --- a/src/unstable/utfstring.h +++ b/src/unstable/utfstring.h | |||
@@ -216,7 +216,7 @@ namespace Bu | |||
216 | * a binary Bu::Blob. Like write, this also includes the proper BOM | 216 | * a binary Bu::Blob. Like write, this also includes the proper BOM |
217 | * at the begining. | 217 | * at the begining. |
218 | */ | 218 | */ |
219 | Bu::Blob get( Encoding eEnc=Utf8 ) const; | 219 | Bu::String get( Encoding eEnc=Utf8 ) const; |
220 | 220 | ||
221 | void debug() const; | 221 | void debug() const; |
222 | 222 | ||