summaryrefslogtreecommitdiff
path: root/src/KM_memio.h
diff options
context:
space:
mode:
authorjhurst <jhurst@cinecert.com>2006-09-23 23:47:17 +0000
committerjhurst <>2006-09-23 23:47:17 +0000
commit72e5392ca11c06a1ac0732c71f86df0d9a712ce3 (patch)
tree25c9f223d62700409fbe883865dc5a54677726a0 /src/KM_memio.h
parent1cd511e77b968ba068c59f4771cb67810e4ba4c4 (diff)
1.1.9 release a
Diffstat (limited to 'src/KM_memio.h')
-rwxr-xr-xsrc/KM_memio.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/KM_memio.h b/src/KM_memio.h
index 8416b57..483bbde 100755
--- a/src/KM_memio.h
+++ b/src/KM_memio.h
@@ -33,7 +33,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define _KM_MEMIO_H_
#include <KM_platform.h>
-#include <string.h>
+#include <string>
namespace Kumu
{
@@ -207,6 +207,26 @@ namespace Kumu
}
};
+ //
+ inline bool
+ UnarchiveString(MemIOReader& Reader, std::string& str)
+ {
+ ui32_t str_length;
+ if ( ! Reader.ReadUi32BE(&str_length) ) return false;
+ str.assign((const char*)Reader.CurrentData(), str_length);
+ if ( ! Reader.SkipOffset(str_length) ) return false;
+ return true;
+ }
+
+ //
+ inline bool
+ ArchiveString(MemIOWriter& Writer, const std::string& str)
+ {
+ if ( ! Writer.WriteUi32BE(str.length()) ) return false;
+ if ( ! Writer.WriteRaw((const byte_t*)str.c_str(), str.length()) ) return false;
+ return true;
+ }
+
} // namespace Kumu
#endif // _KM_MEMIO_H_