diff options
| author | ljfa-ag <ljfa-ag@web.de> | 2015-08-09 22:44:09 +0200 |
|---|---|---|
| committer | ljfa-ag <ljfa-ag@web.de> | 2015-08-09 22:44:09 +0200 |
| commit | 50dc555de3198938109d2a595245374e9dde8709 (patch) | |
| tree | b3e5135911df71710d637534984db6e12d1d615e | |
| parent | 70e84ad70772dbacf4554c12650bb11a87f5a1ad (diff) | |
| download | Project-Tick-50dc555de3198938109d2a595245374e9dde8709.tar.gz Project-Tick-50dc555de3198938109d2a595245374e9dde8709.zip | |
Rename tag_visitor to nbt_visitor
Change some override/final modifiers
| -rw-r--r-- | include/crtp_tag.h | 6 | ||||
| -rw-r--r-- | include/nbt_visitor.h (renamed from include/tag_visitor.h) | 12 | ||||
| -rw-r--r-- | include/tag.h | 4 | ||||
| -rw-r--r-- | test/nbttest.cpp | 26 |
4 files changed, 24 insertions, 24 deletions
diff --git a/include/crtp_tag.h b/include/crtp_tag.h index 11c41cb5b3..637e5be244 100644 --- a/include/crtp_tag.h +++ b/include/crtp_tag.h @@ -21,7 +21,7 @@ #define CRTP_TAG_H_INCLUDED #include "tag.h" -#include "tag_visitor.h" +#include "nbt_visitor.h" #include "make_unique.h" namespace nbt @@ -44,7 +44,7 @@ namespace detail tag& assign(tag&& rhs) override final; - void accept(tag_visitor& visitor); + void accept(nbt_visitor& visitor) override final; private: bool equals(const tag& rhs) const override final; @@ -81,7 +81,7 @@ namespace detail } template<class Sub> - void crtp_tag<Sub>::accept(tag_visitor& visitor) + void crtp_tag<Sub>::accept(nbt_visitor& visitor) { visitor.visit(sub_this()); } diff --git a/include/tag_visitor.h b/include/nbt_visitor.h index bc5113918c..dc281bd7e4 100644 --- a/include/tag_visitor.h +++ b/include/nbt_visitor.h @@ -17,8 +17,8 @@ * You should have received a copy of the GNU Lesser General Public License * along with libnbt++. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef TAG_VISITOR_H_INCLUDED -#define TAG_VISITOR_H_INCLUDED +#ifndef NBT_VISITOR_H_INCLUDED +#define NBT_VISITOR_H_INCLUDED #include "tagfwd.h" @@ -30,10 +30,10 @@ namespace nbt * * Implementing the Visitor pattern */ -class tag_visitor +class nbt_visitor { public: - virtual ~tag_visitor() noexcept = 0; //Abstract class + virtual ~nbt_visitor() noexcept = 0; //Abstract class virtual void visit(tag_byte& tag) {} virtual void visit(tag_short& tag) {} @@ -48,8 +48,8 @@ public: virtual void visit(tag_int_array& tag) {} }; -inline tag_visitor::~tag_visitor() noexcept {} +inline nbt_visitor::~nbt_visitor() noexcept {} } -#endif // TAG_VISITOR_H_INCLUDED +#endif // NBT_VISITOR_H_INCLUDED diff --git a/include/tag.h b/include/tag.h index f3e9696a53..c7ddd44c52 100644 --- a/include/tag.h +++ b/include/tag.h @@ -52,7 +52,7 @@ enum class tag_type : int8_t bool is_valid_type(int type, bool allow_end = false); //Forward declarations -class tag_visitor; +class nbt_visitor; namespace io { class stream_reader; } @@ -90,7 +90,7 @@ public: * @brief Calls the appropriate overload of @c visit() on the visitor with * @c *this as argument */ - virtual void accept(tag_visitor& visitor) = 0; + virtual void accept(nbt_visitor& visitor) = 0; /** * @brief Reads the tag's payload from the stream diff --git a/test/nbttest.cpp b/test/nbttest.cpp index 4c46668f0b..fd74995d67 100644 --- a/test/nbttest.cpp +++ b/test/nbttest.cpp @@ -19,7 +19,7 @@ */ #include "microtest.h" #include "nbt_tags.h" -#include "tag_visitor.h" +#include "nbt_visitor.h" #include <algorithm> #include <stdexcept> @@ -428,21 +428,21 @@ void test_tag_int_array() void test_visitor() { - struct : public tag_visitor + struct : public nbt_visitor { tag_type visited = tag_type::Null; - void visit(tag_byte& tag) override { visited = tag_type::Byte; } - void visit(tag_short& tag) override { visited = tag_type::Short; } - void visit(tag_int& tag) override { visited = tag_type::Int; } - void visit(tag_long& tag) override { visited = tag_type::Long; } - void visit(tag_float& tag) override { visited = tag_type::Float; } - void visit(tag_double& tag) override { visited = tag_type::Double; } - void visit(tag_byte_array& tag) override { visited = tag_type::Byte_Array; } - void visit(tag_string& tag) override { visited = tag_type::String; } - void visit(tag_list& tag) override { visited = tag_type::List; } - void visit(tag_compound& tag) override { visited = tag_type::Compound; } - void visit(tag_int_array& tag) override { visited = tag_type::Int_Array; } + void visit(tag_byte& tag) { visited = tag_type::Byte; } + void visit(tag_short& tag) { visited = tag_type::Short; } + void visit(tag_int& tag) { visited = tag_type::Int; } + void visit(tag_long& tag) { visited = tag_type::Long; } + void visit(tag_float& tag) { visited = tag_type::Float; } + void visit(tag_double& tag) { visited = tag_type::Double; } + void visit(tag_byte_array& tag) { visited = tag_type::Byte_Array; } + void visit(tag_string& tag) { visited = tag_type::String; } + void visit(tag_list& tag) { visited = tag_type::List; } + void visit(tag_compound& tag) { visited = tag_type::Compound; } + void visit(tag_int_array& tag) { visited = tag_type::Int_Array; } } v; tag_byte().accept(v); |
