From 50dc555de3198938109d2a595245374e9dde8709 Mon Sep 17 00:00:00 2001 From: ljfa-ag Date: Sun, 9 Aug 2015 22:44:09 +0200 Subject: Rename tag_visitor to nbt_visitor Change some override/final modifiers --- include/crtp_tag.h | 6 +++--- include/nbt_visitor.h | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++ include/tag.h | 4 ++-- include/tag_visitor.h | 55 --------------------------------------------------- 4 files changed, 60 insertions(+), 60 deletions(-) create mode 100644 include/nbt_visitor.h delete mode 100644 include/tag_visitor.h (limited to 'include') 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 - void crtp_tag::accept(tag_visitor& visitor) + void crtp_tag::accept(nbt_visitor& visitor) { visitor.visit(sub_this()); } diff --git a/include/nbt_visitor.h b/include/nbt_visitor.h new file mode 100644 index 0000000000..dc281bd7e4 --- /dev/null +++ b/include/nbt_visitor.h @@ -0,0 +1,55 @@ +/* + * libnbt++ - A library for the Minecraft Named Binary Tag format. + * Copyright (C) 2013, 2015 ljfa-ag + * + * This file is part of libnbt++. + * + * libnbt++ is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * libnbt++ is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with libnbt++. If not, see . + */ +#ifndef NBT_VISITOR_H_INCLUDED +#define NBT_VISITOR_H_INCLUDED + +#include "tagfwd.h" + +namespace nbt +{ + +/** + * @brief Base class for visitors of tags + * + * Implementing the Visitor pattern + */ +class nbt_visitor +{ +public: + virtual ~nbt_visitor() noexcept = 0; //Abstract class + + virtual void visit(tag_byte& tag) {} + virtual void visit(tag_short& tag) {} + virtual void visit(tag_int& tag) {} + virtual void visit(tag_long& tag) {} + virtual void visit(tag_float& tag) {} + virtual void visit(tag_double& tag) {} + virtual void visit(tag_byte_array& tag) {} + virtual void visit(tag_string& tag) {} + virtual void visit(tag_list& tag) {} + virtual void visit(tag_compound& tag) {} + virtual void visit(tag_int_array& tag) {} +}; + +inline nbt_visitor::~nbt_visitor() noexcept {} + +} + +#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/include/tag_visitor.h b/include/tag_visitor.h deleted file mode 100644 index bc5113918c..0000000000 --- a/include/tag_visitor.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * libnbt++ - A library for the Minecraft Named Binary Tag format. - * Copyright (C) 2013, 2015 ljfa-ag - * - * This file is part of libnbt++. - * - * libnbt++ is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * libnbt++ is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with libnbt++. If not, see . - */ -#ifndef TAG_VISITOR_H_INCLUDED -#define TAG_VISITOR_H_INCLUDED - -#include "tagfwd.h" - -namespace nbt -{ - -/** - * @brief Base class for visitors of tags - * - * Implementing the Visitor pattern - */ -class tag_visitor -{ -public: - virtual ~tag_visitor() noexcept = 0; //Abstract class - - virtual void visit(tag_byte& tag) {} - virtual void visit(tag_short& tag) {} - virtual void visit(tag_int& tag) {} - virtual void visit(tag_long& tag) {} - virtual void visit(tag_float& tag) {} - virtual void visit(tag_double& tag) {} - virtual void visit(tag_byte_array& tag) {} - virtual void visit(tag_string& tag) {} - virtual void visit(tag_list& tag) {} - virtual void visit(tag_compound& tag) {} - virtual void visit(tag_int_array& tag) {} -}; - -inline tag_visitor::~tag_visitor() noexcept {} - -} - -#endif // TAG_VISITOR_H_INCLUDED -- cgit 0.0.5-2-1-g0f52