summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjhurst <jhurst@cinecert.com>2019-11-28 10:14:27 -0800
committerjhurst <jhurst@cinecert.com>2019-11-28 10:14:27 -0800
commit7ce81497e2592d5787b9a4285d6a89ae09f79022 (patch)
tree1c29afcdd290cd2103d4f858010399ebb3a6ee4b
parentcf8ae65acd6ffdc424604a4d3350b4eca47af220 (diff)
created new type ArchivableUi16
-rwxr-xr-xsrc/KM_util.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/KM_util.h b/src/KM_util.h
index e8004c1..b209d27 100755
--- a/src/KM_util.h
+++ b/src/KM_util.h
@@ -257,6 +257,35 @@ namespace Kumu
};
//
+ class ArchivableUi16 : public Kumu::IArchive
+ {
+ ui16_t m_Value;
+
+ public:
+ ArchivableUi16() : m_Value(0) {}
+ ArchivableUi16(const ui16_t& value) : m_Value(value) {}
+ virtual ~ArchivableUi16() {}
+
+ bool HasValue() const { return true; }
+ ui32_t ArchiveLength() const { return sizeof(ui16_t); }
+
+ bool Archive(MemIOWriter* Writer) const {
+ if ( Writer == 0 ) return false;
+ return Writer->WriteUi16BE(m_Value);
+ }
+
+ bool Unarchive(MemIOReader* Reader) {
+ if ( Reader == 0 ) return false;
+ return Reader->ReadUi16BE(&m_Value);
+ }
+
+ const char* EncodeString(char* str_buf, ui32_t buf_len) const {
+ snprintf(str_buf, buf_len, "%hu", m_Value);
+ return str_buf;
+ }
+ };
+
+ //
typedef Kumu::ArchivableList<ArchivableString> StringList;
//