summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorljfa-ag <ljfa-ag@web.de>2015-09-02 21:31:36 +0200
committerljfa-ag <ljfa-ag@web.de>2015-09-02 21:31:36 +0200
commit5c6cb9eca80a7bb18beb0fae42426b97a9f99fe0 (patch)
tree6f4b8891374c1d13ac7dd56170ca91c2bc0eaf8c
parent7b3e7818d0dd104f4a8da6e98b73d6def0f1407b (diff)
downloadProject-Tick-5c6cb9eca80a7bb18beb0fae42426b97a9f99fe0.tar.gz
Project-Tick-5c6cb9eca80a7bb18beb0fae42426b97a9f99fe0.zip
More inlining. Closes #3
-rw-r--r--include/tag_array.h12
-rw-r--r--include/tag_compound.h14
-rw-r--r--include/tag_list.h12
-rw-r--r--include/tag_string.h10
-rw-r--r--src/tag_array.cpp7
-rw-r--r--src/tag_compound.cpp12
-rw-r--r--src/tag_list.cpp7
-rw-r--r--src/tag_string.cpp28
8 files changed, 24 insertions, 78 deletions
diff --git a/include/tag_array.h b/include/tag_array.h
index 342d3a4ceb..c59249b571 100644
--- a/include/tag_array.h
+++ b/include/tag_array.h
@@ -97,12 +97,12 @@ public:
void clear() { data.clear(); }
//Iterators
- iterator begin();
- iterator end();
- const_iterator begin() const;
- const_iterator end() const;
- const_iterator cbegin() const;
- const_iterator cend() const;
+ iterator begin() { return data.begin(); }
+ iterator end() { return data.end(); }
+ const_iterator begin() const { return data.begin(); }
+ const_iterator end() const { return data.end(); }
+ const_iterator cbegin() const { return data.cbegin(); }
+ const_iterator cend() const { return data.cend(); }
void read_payload(io::stream_reader& reader) override;
/**
diff --git a/include/tag_compound.h b/include/tag_compound.h
index 2948059ce9..b1c4c996dc 100644
--- a/include/tag_compound.h
+++ b/include/tag_compound.h
@@ -63,7 +63,7 @@ public:
* Returns a value to the tag with the specified key. If it does not exist,
* creates a new uninitialized entry under the key.
*/
- value& operator[](const std::string& key);
+ value& operator[](const std::string& key) { return tags[key]; }
/**
* @brief Inserts or assigns a tag
@@ -112,12 +112,12 @@ public:
void clear() { tags.clear(); }
//Iterators
- iterator begin();
- iterator end();
- const_iterator begin() const;
- const_iterator end() const;
- const_iterator cbegin() const;
- const_iterator cend() const;
+ iterator begin() { return tags.begin(); }
+ iterator end() { return tags.end(); }
+ const_iterator begin() const { return tags.begin(); }
+ const_iterator end() const { return tags.end(); }
+ const_iterator cbegin() const { return tags.cbegin(); }
+ const_iterator cend() const { return tags.cend(); }
void read_payload(io::stream_reader& reader) override;
void write_payload(io::stream_writer& writer) const override;
diff --git a/include/tag_list.h b/include/tag_list.h
index 05150323b9..c27da8697d 100644
--- a/include/tag_list.h
+++ b/include/tag_list.h
@@ -151,12 +151,12 @@ public:
void reset(tag_type type = tag_type::Null);
//Iterators
- iterator begin();
- iterator end();
- const_iterator begin() const;
- const_iterator end() const;
- const_iterator cbegin() const;
- const_iterator cend() const;
+ iterator begin() { return tags.begin(); }
+ iterator end() { return tags.end(); }
+ const_iterator begin() const { return tags.begin(); }
+ const_iterator end() const { return tags.end(); }
+ const_iterator cbegin() const { return tags.cbegin(); }
+ const_iterator cend() const { return tags.cend(); }
/**
* @inheritdoc
diff --git a/include/tag_string.h b/include/tag_string.h
index 48e7adf497..dee47f5f97 100644
--- a/include/tag_string.h
+++ b/include/tag_string.h
@@ -45,11 +45,11 @@ public:
const std::string& get() const { return value; }
//Setters
- tag_string& operator=(const std::string& str);
- tag_string& operator=(std::string&& str);
- tag_string& operator=(const char* str);
- void set(const std::string& str);
- void set(std::string&& str);
+ tag_string& operator=(const std::string& str) { value = str; return *this; }
+ tag_string& operator=(std::string&& str) { value = std::move(str); return *this; }
+ tag_string& operator=(const char* str) { value = str; return *this; }
+ void set(const std::string& str) { value = str; }
+ void set(std::string&& str) { value = std::move(str); }
void read_payload(io::stream_reader& reader) override;
/**
diff --git a/src/tag_array.cpp b/src/tag_array.cpp
index 6c12b9a2cd..8bb8bf72e4 100644
--- a/src/tag_array.cpp
+++ b/src/tag_array.cpp
@@ -37,13 +37,6 @@ T tag_array<T>::at(size_t i) const
return data.at(i);
}
-template<class T> auto tag_array<T>::begin() -> iterator { return data.begin(); }
-template<class T> auto tag_array<T>::end() -> iterator { return data.end(); }
-template<class T> auto tag_array<T>::begin() const -> const_iterator { return data.begin(); }
-template<class T> auto tag_array<T>::end() const -> const_iterator { return data.end(); }
-template<class T> auto tag_array<T>::cbegin() const -> const_iterator { return data.cbegin(); }
-template<class T> auto tag_array<T>::cend() const -> const_iterator { return data.cend(); }
-
//Slightly different between byte_array and int_array
//Reading
template<>
diff --git a/src/tag_compound.cpp b/src/tag_compound.cpp
index 746a07955e..4085bb4e0c 100644
--- a/src/tag_compound.cpp
+++ b/src/tag_compound.cpp
@@ -42,11 +42,6 @@ const value& tag_compound::at(const std::string& key) const
return tags.at(key);
}
-value& tag_compound::operator[](const std::string& key)
-{
- return tags[key];
-}
-
std::pair<tag_compound::iterator, bool> tag_compound::put(const std::string& key, value_initializer&& val)
{
auto it = tags.find(key);
@@ -82,13 +77,6 @@ bool tag_compound::has_key(const std::string& key, tag_type type) const
return it != tags.end() && it->second.get_type() == type;
}
-auto tag_compound::begin() -> iterator { return tags.begin(); }
-auto tag_compound::end() -> iterator { return tags.end(); }
-auto tag_compound::begin() const -> const_iterator { return tags.begin(); }
-auto tag_compound::end() const -> const_iterator { return tags.end(); }
-auto tag_compound::cbegin() const -> const_iterator { return tags.cbegin(); }
-auto tag_compound::cend() const -> const_iterator { return tags.cend(); }
-
void tag_compound::read_payload(io::stream_reader& reader)
{
clear();
diff --git a/src/tag_list.cpp b/src/tag_list.cpp
index 0e7dda4ae6..a1a708a6a6 100644
--- a/src/tag_list.cpp
+++ b/src/tag_list.cpp
@@ -88,13 +88,6 @@ void tag_list::reset(tag_type type)
el_type_ = type;
}
-auto tag_list::begin() -> iterator { return tags.begin(); }
-auto tag_list::end() -> iterator { return tags.end(); }
-auto tag_list::begin() const -> const_iterator { return tags.begin(); }
-auto tag_list::end() const -> const_iterator { return tags.end(); }
-auto tag_list::cbegin() const -> const_iterator { return tags.cbegin(); }
-auto tag_list::cend() const -> const_iterator { return tags.cend(); }
-
void tag_list::read_payload(io::stream_reader& reader)
{
tag_type lt = reader.read_type(true);
diff --git a/src/tag_string.cpp b/src/tag_string.cpp
index 2d04c25fdc..30347818bd 100644
--- a/src/tag_string.cpp
+++ b/src/tag_string.cpp
@@ -24,34 +24,6 @@
namespace nbt
{
-tag_string& tag_string::operator=(const std::string& str)
-{
- value = str;
- return *this;
-}
-
-tag_string& tag_string::operator=(std::string&& str)
-{
- value = std::move(str);
- return *this;
-}
-
-tag_string& tag_string::operator=(const char* str)
-{
- value = std::string(str);
- return *this;
-}
-
-void tag_string::set(const std::string& str)
-{
- value = str;
-}
-
-void tag_string::set(std::string&& str)
-{
- value = std::move(str);
-}
-
void tag_string::read_payload(io::stream_reader& reader)
{
try