diff options
| author | ljfa-ag <ljfa-ag@web.de> | 2015-07-22 16:55:58 +0200 |
|---|---|---|
| committer | ljfa-ag <ljfa-ag@web.de> | 2015-07-22 20:29:56 +0200 |
| commit | 3a99fb629cf059061d2aba9aab3a18d9ebe5703c (patch) | |
| tree | 57ab285986c356b5ba27c3623ed50a35132018ca | |
| parent | 473f094be33ccd92c003ec25c9a9f940629ecdc9 (diff) | |
| download | Project-Tick-3a99fb629cf059061d2aba9aab3a18d9ebe5703c.tar.gz Project-Tick-3a99fb629cf059061d2aba9aab3a18d9ebe5703c.zip | |
Add a few comments
| -rw-r--r-- | include/tag_primitive.h | 3 | ||||
| -rw-r--r-- | include/tag_string.h | 3 | ||||
| -rw-r--r-- | include/value.h | 5 |
3 files changed, 9 insertions, 2 deletions
diff --git a/include/tag_primitive.h b/include/tag_primitive.h index fd8de3906e..93c7936d99 100644 --- a/include/tag_primitive.h +++ b/include/tag_primitive.h @@ -41,12 +41,15 @@ public: ///The type of the tag static constexpr tag_type type = detail::get_primitive_type<T>::value; + //Constructor tag_primitive(T value = 0); + //Getters operator T&(); operator T() const; T get() const; + //Setters tag_primitive& operator=(T value); void set(T value); diff --git a/include/tag_string.h b/include/tag_string.h index 846650e507..e28d18cd88 100644 --- a/include/tag_string.h +++ b/include/tag_string.h @@ -33,14 +33,17 @@ public: ///The type of the tag static constexpr tag_type type = tag_type::String; + //Constructors tag_string(const std::string& str); tag_string(std::string&& str = ""); tag_string(const char* str); + //Getters operator std::string&(); operator const std::string&() const; const std::string& get() const; + //Setters tag_string& operator=(const std::string& str); tag_string& operator=(std::string&& str); tag_string& operator=(const char* str); diff --git a/include/value.h b/include/value.h index 670fc3fe8e..7c9511d74d 100644 --- a/include/value.h +++ b/include/value.h @@ -34,8 +34,6 @@ namespace nbt * A value can contain any kind of tag or no tag (nullptr) and provides * operations for handling tags of which the type is not known at compile time. * Assignment or the set method on a value with no tag will fill in the value. - * Once the value contains a tag, the type of the contained tag will not change - * unless set_ptr is used. * * The rationale for the existance of this class is to provide a type-erasured * means of storing tags, especially when they are contained in tag_compound @@ -62,6 +60,7 @@ namespace nbt class value { public: + //Constructors value() {} explicit value(std::unique_ptr<tag>&& t); explicit value(tag&& t); @@ -189,8 +188,10 @@ public: value& operator[](size_t i); const value& operator[](size_t i) const; + ///Returns a reference to the underlying std::unique_ptr<tag> std::unique_ptr<tag>& get_ptr(); const std::unique_ptr<tag>& get_ptr() const; + ///Resets the underlying std::unique_ptr<tag> to a different value void set_ptr(std::unique_ptr<tag>&& t); ///@sa tag::get_type |
