From 72f72c4404a49a1fb2191e6d6405296461b40a32 Mon Sep 17 00:00:00 2001 From: Determinant Date: Sun, 2 Sep 2018 21:50:57 -0400 Subject: minor --- include/salticidae/msg.h | 2 +- include/salticidae/stream.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/salticidae/msg.h b/include/salticidae/msg.h index 80b468a..fa4283e 100644 --- a/include/salticidae/msg.h +++ b/include/salticidae/msg.h @@ -149,7 +149,7 @@ class MsgBase { opcode = _opcode; } - bytearray_t &&get_payload() const { + DataStream &&get_payload() const { #ifndef SALTICIDAE_NOCHECK if (no_payload) throw std::runtime_error("payload not available"); diff --git a/include/salticidae/stream.h b/include/salticidae/stream.h index 50a7f70..e7e5640 100644 --- a/include/salticidae/stream.h +++ b/include/salticidae/stream.h @@ -43,6 +43,9 @@ class DataStream { DataStream(const uint8_t *begin, const uint8_t *end): buffer(begin, end), offset(0) {} DataStream(bytearray_t &&data): buffer(std::move(data)), offset(0) {} DataStream(const bytearray_t &data): buffer(data), offset(0) {} + DataStream(const std::string &data): + DataStream((uint8_t *)data.data(), + (uint8_t *)data.data() + data.size()) {} DataStream(DataStream &&other): buffer(std::move(other.buffer)), -- cgit v1.2.3-70-g09d2