diff options
| author | jhurst <jhurst@cinecert.com> | 2010-05-13 19:12:13 +0000 |
|---|---|---|
| committer | jhurst <> | 2010-05-13 19:12:13 +0000 |
| commit | f6382ee078c3d7de2dbf3a01f5624345d2c61e4a (patch) | |
| tree | 9418a7065bdedb15e9551d97743ec1a9b8cd8f71 /src/KM_util.h | |
| parent | 6413d43575d39c8560673515ca7e75e1e2c789a9 (diff) | |
release candidate
Diffstat (limited to 'src/KM_util.h')
| -rwxr-xr-x | src/KM_util.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/KM_util.h b/src/KM_util.h index 7ca30e0..ea83e63 100755 --- a/src/KM_util.h +++ b/src/KM_util.h @@ -230,6 +230,35 @@ namespace Kumu } }; + // archivable version of std::string + + // + class ArchivableString : public std::string, public Kumu::IArchive + { + + public: + ArchivableString() {} + ArchivableString(const char* sz) : std::string(sz) {} + ArchivableString(const std::string& s) : std::string(s) {} + virtual ~ArchivableString() {} + + bool HasValue() const { return ! this->empty(); } + ui32_t ArchiveLength() const { return sizeof(ui32_t) + this->size(); } + + bool Archive(MemIOWriter* Writer) const { + if ( Writer == 0 ) return false; + return Writer->WriteString(*this); + } + + bool Unarchive(MemIOReader* Reader) { + if ( Reader == 0 ) return false; + return Reader->ReadString(*this); + } + }; + + // + typedef Kumu::ArchivableList<ArchivableString> StringList; + // // the base of all identifier classes, Identifier is not usually used directly // see UUID and SymmetricKey below for more detail. |
