aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2018-09-02 21:50:57 -0400
committerDeterminant <[email protected]>2018-09-02 21:50:57 -0400
commit72f72c4404a49a1fb2191e6d6405296461b40a32 (patch)
treee5941d5aa270ba38b49eab90755e55d557ba48fe /include
parent52e051cb6924266003ef21814b5ebaf2b7b45241 (diff)
minor
Diffstat (limited to 'include')
-rw-r--r--include/salticidae/msg.h2
-rw-r--r--include/salticidae/stream.h3
2 files changed, 4 insertions, 1 deletions
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)),