summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/io/stream_reader.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/include/io/stream_reader.h b/include/io/stream_reader.h
index 659aacbd82..ab07f83ad9 100644
--- a/include/io/stream_reader.h
+++ b/include/io/stream_reader.h
@@ -39,6 +39,7 @@ public:
///Exception that gets thrown when reading is not successful
class input_error : public std::runtime_error
{
+ public:
input_error(const std::string& what_arg):
std::runtime_error(what_arg) {}
};
@@ -55,16 +56,27 @@ public:
///Returns the byte order
endian::endian get_endian() const;
- ///Reads a tag type from the stream
+ /**
+ * @brief Reads a tag type from the stream
+ * @param allow_end whether to consider tag_type::End valid
+ * @throw input_error on failure
+ */
tag_type read_type(bool allow_end = false);
- ///Reads a number from the stream
+
+ /**
+ * @brief Reads a binary number from the stream
+ *
+ * Does not check if the reading actually succeeds
+ */
template<class T>
void read_num(T& x);
+
/**
* @brief Reads an NBT string from the stream
*
* An NBT string consists of two bytes indicating the length, followed by
* the characters encoded in modified UTF-8.
+ * @throw input_error on failure
*/
std::string read_string();