diff options
| author | ljfa-ag <ljfa-ag@web.de> | 2015-08-02 18:33:39 +0200 |
|---|---|---|
| committer | ljfa-ag <ljfa-ag@web.de> | 2015-08-02 18:33:39 +0200 |
| commit | 0577e90fd1d73777e0c73995ac83bb2e0fc77db3 (patch) | |
| tree | 993548472a6b7d952e193de14c4ac6d4cdbf2cf3 /include | |
| parent | 89425523eac6e16eb85a8a0126134f2bf3c54180 (diff) | |
| download | Project-Tick-0577e90fd1d73777e0c73995ac83bb2e0fc77db3.tar.gz Project-Tick-0577e90fd1d73777e0c73995ac83bb2e0fc77db3.zip | |
Add reset method to tag_list
Changes to doxygen
Diffstat (limited to 'include')
| -rw-r--r-- | include/tag_list.h | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/include/tag_list.h b/include/tag_list.h index 87b2742e92..af5a87d5ee 100644 --- a/include/tag_list.h +++ b/include/tag_list.h @@ -32,6 +32,13 @@ namespace nbt /** * @brief Tag that contains multiple unnamed tags of the same type * + * All the tags contained in the list have the same type, which can be queried + * with el_type(). + * + * If the list is empty, the type can be undetermined, in which case el_type() + * will return tag_type::Null. The type will then be set when the first tag + * is added to the list. + * * The list's behavior is undefined if the contained values are changed in a * way that their type differs from the list's content type. */ @@ -46,8 +53,10 @@ public: static constexpr tag_type type = tag_type::List; /** - * @brief Constructs a list with the given contents of type T - * @param init list of values that are, one by one, given to a constructor of T + * @brief Constructs a list of type T with the given values + * + * Example: @code tag_list::of<tag_byte>({3, 4, 5}) @endcode + * @param init list of values from which the elements are constructed */ template<class T> static tag_list of(std::initializer_list<T> init); @@ -135,6 +144,12 @@ public: ///Erases all tags from the list. Preserves the content type. void clear(); + /** + * @brief Erases all tags from the list and changes the content type. + * @param type the new content type. Can be tag_type::Null to leave it undetermined. + */ + void reset(tag_type type = tag_type::Null); + //Iterators iterator begin(); iterator end(); @@ -147,7 +162,7 @@ public: * @brief Equality comparison for lists * * Lists are considered equal if they contain equal tags. Empty lists - * are always considered equal. + * are always considered equal to each other. */ friend bool operator==(const tag_list& lhs, const tag_list& rhs); friend bool operator!=(const tag_list& lhs, const tag_list& rhs); |
