diff options
| author | ljfa-ag <ljfa-ag@web.de> | 2015-08-12 19:17:59 +0200 |
|---|---|---|
| committer | ljfa-ag <ljfa-ag@web.de> | 2015-08-12 19:17:59 +0200 |
| commit | 1b9fd75fad70da33ad6b31a0da5f6b1c6d074849 (patch) | |
| tree | 03f15b72765a054ff51d98d7d9c43fa11c3147e6 /include | |
| parent | 8b792c2a968fed130c9869db37db658e92a0a587 (diff) | |
| download | Project-Tick-1b9fd75fad70da33ad6b31a0da5f6b1c6d074849.tar.gz Project-Tick-1b9fd75fad70da33ad6b31a0da5f6b1c6d074849.zip | |
Implement write_payload and write_tag
Diffstat (limited to 'include')
| -rw-r--r-- | include/io/stream_writer.h | 4 | ||||
| -rw-r--r-- | include/tag_array.h | 4 | ||||
| -rw-r--r-- | include/tag_list.h | 1 |
3 files changed, 7 insertions, 2 deletions
diff --git a/include/io/stream_writer.h b/include/io/stream_writer.h index 8c354cceba..1502593055 100644 --- a/include/io/stream_writer.h +++ b/include/io/stream_writer.h @@ -68,12 +68,12 @@ public: /** * @brief Writes the given tag's payload into the stream */ - void write_payload(const tag& t); + void write_payload(const tag& t) { t.write_payload(*this); } /** * @brief Writes a tag type to the stream */ - void write_type(tag_type tt); + void write_type(tag_type tt) { write_num(static_cast<int8_t>(tt)); } /** * @brief Writes a binary number to the stream diff --git a/include/tag_array.h b/include/tag_array.h index f2163f6486..14dd4d4480 100644 --- a/include/tag_array.h +++ b/include/tag_array.h @@ -105,6 +105,10 @@ public: const_iterator cend() const; void read_payload(io::stream_reader& reader) override; + /** + * @inheritdoc + * @throw std::length_error if the array is too large for NBT + */ void write_payload(io::stream_writer& writer) const override; private: diff --git a/include/tag_list.h b/include/tag_list.h index 61ada4a5b9..66f63e6ed9 100644 --- a/include/tag_list.h +++ b/include/tag_list.h @@ -166,6 +166,7 @@ public: /** * @inheritdoc * In case of a list of undetermined content type, the written type will be tag_end. + * @throw std::length_error if the list is too long for NBT */ void write_payload(io::stream_writer& writer) const override; |
