From 944e2b6a9d8ee97c3202ac0403edec234d0bfa31 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 24 Apr 2023 10:37:48 -0700 Subject: More tweaks to make things easier to transition. --- src/stable/string.cpp | 10 ++++++++++ src/stable/string.h | 12 ++++++++++++ src/unstable/blob.cpp | 4 ++-- src/unstable/blob.h | 2 ++ src/unstable/utfstring.cpp | 5 +++-- src/unstable/utfstring.h | 2 +- 6 files changed, 30 insertions(+), 5 deletions(-) (limited to 'src') 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 return core->pFirst->pData; } +char *Bu::String::getData() +{ + return getStr(); +} + +const char *Bu::String::getData() const +{ + return getStr(); +} + const char *Bu::String::getConstStr() const { 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 *@returns (const char *) The string data. */ const char *getStr() const; + + /** + * Get a pointer to the string array. + *@returns (char *) The string data. + */ + char *getData(); + + /** + * Get a const pointer to the string array. + *@returns (const char *) The string data. + */ + const char *getData() const; /** * 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 ) return rOut; } -Bu::ArchiveBase &operator<<( Bu::ArchiveBase &ar, const Bu::Blob &b ) +Bu::ArchiveBase &Bu::operator<<( Bu::ArchiveBase &ar, const Bu::Blob &b ) { int32_t iSize = b.getSize(); ar << iSize; @@ -819,7 +819,7 @@ Bu::ArchiveBase &operator<<( Bu::ArchiveBase &ar, const Bu::Blob &b ) return ar; } -Bu::ArchiveBase &operator>>( Bu::ArchiveBase &ar, Bu::Blob &b ) +Bu::ArchiveBase &Bu::operator>>( Bu::ArchiveBase &ar, Bu::Blob &b ) { int32_t iSize; 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 */ class Blob { + friend ArchiveBase &operator<<( ArchiveBase &ar, const Blob &s ); + friend ArchiveBase &operator>>( ArchiveBase &ar, Blob &s ); public: class iterator; 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 return false; } -Bu::Blob Bu::UtfString::get( Encoding eEnc ) const +Bu::String Bu::UtfString::get( Encoding eEnc ) const { Bu::MemBuf mb; write( mb, eEnc ); - return Bu::Blob( mb.getString().getStr(), mb.getString().getSize() ); + //return Bu::Blob( mb.getString().getStr(), mb.getString().getSize() ); + return Bu::String( mb.getString().getStr(), mb.getString().getSize() ); } 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 * a binary Bu::Blob. Like write, this also includes the proper BOM * at the begining. */ - Bu::Blob get( Encoding eEnc=Utf8 ) const; + Bu::String get( Encoding eEnc=Utf8 ) const; void debug() const; -- cgit v1.2.3