summaryrefslogtreecommitdiff
path: root/include/value.h
diff options
context:
space:
mode:
authorljfa-ag <ljfa-ag@web.de>2015-06-30 17:45:50 +0200
committerljfa-ag <ljfa-ag@web.de>2015-06-30 17:45:50 +0200
commit49ce5a019c5f8e4d862432734a42bc7aa2a18387 (patch)
tree34485de7d6d1ad1b68ebc4262fa73893a1551d20 /include/value.h
parent5390c8e5a84aa4bbbf87981dbe13f60b0ee96655 (diff)
downloadProject-Tick-49ce5a019c5f8e4d862432734a42bc7aa2a18387.tar.gz
Project-Tick-49ce5a019c5f8e4d862432734a42bc7aa2a18387.zip
Change interfaces of tag_compound and value once again
Diffstat (limited to 'include/value.h')
-rw-r--r--include/value.h29
1 files changed, 14 insertions, 15 deletions
diff --git a/include/value.h b/include/value.h
index d55acf3c80..21e945625a 100644
--- a/include/value.h
+++ b/include/value.h
@@ -34,15 +34,15 @@ class tag_list;
/**
* @brief Contains an NBT value of fixed type
*
- * A wrapper class that can contain a tag of an arbitrary but fixed type.
- * Casting or assigning incompatible types will throw an exception.
- * It can also refer to an uninitialized value (e.g. when using tag_compound::operator[]
- * with a non-existant key).
+ * A wrapper class that contains a dynamically allocated tag of a fixed type.
+ * Casting or assigning incompatible types will throw a exceptions.
*/
class value
{
public:
explicit value() {}
+ explicit value(std::unique_ptr<tag>&& t);
+ explicit value(tag&& t);
//Movable but not (implicitly) copyable
value(const value&) = delete;
@@ -50,9 +50,10 @@ public:
value& operator=(const value&) = delete;
value& operator=(value&&) = default;
- //value& operator=(std::unique_ptr<tag>&& ptr);
+ value& operator=(std::unique_ptr<tag>&& t);
+ value& operator=(tag&& t);
- //Assignment
+ //Assignment of primitives and string
/**
* @brief Assigns the given value to the tag if the type matches
* @throw std::bad_cast if the value is not convertible to the tag type
@@ -65,8 +66,6 @@ public:
value& operator=(float val);
value& operator=(double val);
value& operator=(const std::string& str);
- value& operator=(tag_compound&& comp);
- value& operator=(tag_list&& list);
//Conversion to tag
operator tag&();
@@ -78,13 +77,13 @@ public:
* @throw std::bad_cast if the tag type is not convertible to the desired
* type via a widening conversion
*/
- explicit operator int8_t() const;
- explicit operator int16_t() const;
- explicit operator int32_t() const;
- explicit operator int64_t() const;
- explicit operator float() const;
- explicit operator double() const;
- explicit operator const std::string&() const;
+ operator int8_t() const;
+ operator int16_t() const;
+ operator int32_t() const;
+ operator int64_t() const;
+ operator float() const;
+ operator double() const;
+ operator const std::string&() const;
/**
* @brief In case of a tag_compound, accesses a tag by key with bounds checking