summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorljfa-ag <ljfa-ag@web.de>2015-08-23 10:24:00 +0200
committerljfa-ag <ljfa-ag@web.de>2015-08-23 10:24:00 +0200
commit936b2390d89f4e20380c060b39a670dc9fae873f (patch)
tree01790ff708026df488d243f9fea428f171fff356 /src
parent71176e1f0700d8567d436a9321ca02ad2a553b26 (diff)
downloadProject-Tick-936b2390d89f4e20380c060b39a670dc9fae873f.tar.gz
Project-Tick-936b2390d89f4e20380c060b39a670dc9fae873f.zip
Inline some methods
Diffstat (limited to 'src')
-rw-r--r--src/tag_array.cpp74
-rw-r--r--src/tag_compound.cpp20
-rw-r--r--src/tag_list.cpp38
-rw-r--r--src/tag_string.cpp37
-rw-r--r--src/value.cpp49
-rw-r--r--src/value_initializer.cpp5
6 files changed, 0 insertions, 223 deletions
diff --git a/src/tag_array.cpp b/src/tag_array.cpp
index 41f00eedc3..6c12b9a2cd 100644
--- a/src/tag_array.cpp
+++ b/src/tag_array.cpp
@@ -26,28 +26,6 @@ namespace nbt
{
template<class T>
-tag_array<T>::tag_array(std::initializer_list<T> init):
- data(init)
-{}
-
-template<class T>
-tag_array<T>::tag_array(std::vector<T>&& vec) noexcept:
- data(std::move(vec))
-{}
-
-template<class T>
-std::vector<T>& tag_array<T>::get()
-{
- return data;
-}
-
-template<class T>
-const std::vector<T>& tag_array<T>::get() const
-{
- return data;
-}
-
-template<class T>
T& tag_array<T>::at(size_t i)
{
return data.at(i);
@@ -59,42 +37,6 @@ T tag_array<T>::at(size_t i) const
return data.at(i);
}
-template<class T>
-T& tag_array<T>::operator[](size_t i)
-{
- return data[i];
-}
-
-template<class T>
-T tag_array<T>::operator[](size_t i) const
-{
- return data[i];
-}
-
-template<class T>
-void tag_array<T>::push_back(T val)
-{
- data.push_back(val);
-}
-
-template<class T>
-void tag_array<T>::pop_back()
-{
- data.pop_back();
-}
-
-template<class T>
-size_t tag_array<T>::size() const
-{
- return data.size();
-}
-
-template<class T>
-void tag_array<T>::clear()
-{
- data.clear();
-}
-
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(); }
@@ -168,24 +110,8 @@ void tag_array<int32_t>::write_payload(io::stream_writer& writer) const
writer.write_num(i);
}
-template<class T>
-bool operator==(const tag_array<T>& lhs, const tag_array<T>& rhs)
-{
- return lhs.get() == rhs.get();
-}
-
-template<class T>
-bool operator!=(const tag_array<T>& lhs, const tag_array<T>& rhs)
-{
- return !(lhs == rhs);
-}
-
//Enforce template instantiations
template class tag_array<int8_t>;
template class tag_array<int32_t>;
-template bool operator==<int8_t> (const tag_array<int8_t>& , const tag_array<int8_t>&);
-template bool operator==<int32_t>(const tag_array<int32_t>&, const tag_array<int32_t>&);
-template bool operator!=<int8_t> (const tag_array<int8_t>& , const tag_array<int8_t>&);
-template bool operator!=<int32_t>(const tag_array<int32_t>&, const tag_array<int32_t>&);
}
diff --git a/src/tag_compound.cpp b/src/tag_compound.cpp
index d0f20512ae..746a07955e 100644
--- a/src/tag_compound.cpp
+++ b/src/tag_compound.cpp
@@ -82,16 +82,6 @@ bool tag_compound::has_key(const std::string& key, tag_type type) const
return it != tags.end() && it->second.get_type() == type;
}
-size_t tag_compound::size() const
-{
- return tags.size();
-}
-
-void tag_compound::clear()
-{
- tags.clear();
-}
-
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(); }
@@ -128,14 +118,4 @@ void tag_compound::write_payload(io::stream_writer& writer) const
writer.write_type(tag_type::End);
}
-bool operator==(const tag_compound& lhs, const tag_compound& rhs)
-{
- return lhs.tags == rhs.tags;
-}
-
-bool operator!=(const tag_compound& lhs, const tag_compound& rhs)
-{
- return !(lhs == rhs);
-}
-
}
diff --git a/src/tag_list.cpp b/src/tag_list.cpp
index d2aa01d314..0e7dda4ae6 100644
--- a/src/tag_list.cpp
+++ b/src/tag_list.cpp
@@ -26,14 +26,6 @@
namespace nbt
{
-tag_list::tag_list():
- tag_list(tag_type::Null)
-{}
-
-tag_list::tag_list(tag_type type):
- el_type_(type)
-{}
-
tag_list::tag_list(std::initializer_list<int8_t> il) { init<tag_byte>(il); }
tag_list::tag_list(std::initializer_list<int16_t> il) { init<tag_short>(il); }
tag_list::tag_list(std::initializer_list<int32_t> il) { init<tag_int>(il); }
@@ -72,16 +64,6 @@ const value& tag_list::at(size_t i) const
return tags.at(i);
}
-value& tag_list::operator[](size_t i)
-{
- return tags[i];
-}
-
-const value& tag_list::operator[](size_t i) const
-{
- return tags[i];
-}
-
void tag_list::set(size_t i, value&& val)
{
if(val.get_type() != el_type_)
@@ -100,26 +82,6 @@ void tag_list::push_back(value_initializer&& val)
tags.push_back(std::move(val));
}
-void tag_list::pop_back()
-{
- tags.pop_back();
-}
-
-tag_type tag_list::el_type() const
-{
- return el_type_;
-}
-
-size_t tag_list::size() const
-{
- return tags.size();
-}
-
-void tag_list::clear()
-{
- tags.clear();
-}
-
void tag_list::reset(tag_type type)
{
clear();
diff --git a/src/tag_string.cpp b/src/tag_string.cpp
index 1a8f1cd5d2..2d04c25fdc 100644
--- a/src/tag_string.cpp
+++ b/src/tag_string.cpp
@@ -24,33 +24,6 @@
namespace nbt
{
-tag_string::tag_string(const std::string& str):
- value(str)
-{}
-
-tag_string::tag_string(std::string&& str) noexcept:
- value(std::move(str))
-{}
-
-tag_string::tag_string(const char* str):
- value(str)
-{}
-
-tag_string::operator std::string&()
-{
- return value;
-}
-
-tag_string::operator const std::string&() const
-{
- return value;
-
-}
-const std::string& tag_string::get() const
-{
- return value;
-}
-
tag_string& tag_string::operator=(const std::string& str)
{
value = str;
@@ -96,14 +69,4 @@ void tag_string::write_payload(io::stream_writer& writer) const
writer.write_string(value);
}
-bool operator==(const tag_string& lhs, const tag_string& rhs)
-{
- return lhs.get() == rhs.get();
-}
-
-bool operator!=(const tag_string& lhs, const tag_string& rhs)
-{
- return !(lhs == rhs);
-}
-
}
diff --git a/src/value.cpp b/src/value.cpp
index 4b3fa47678..8376dc9b9e 100644
--- a/src/value.cpp
+++ b/src/value.cpp
@@ -24,10 +24,6 @@
namespace nbt
{
-value::value(std::unique_ptr<tag>&& t) noexcept:
- tag_(std::move(t))
-{}
-
value::value(tag&& t):
tag_(std::move(t).move_clone())
{}
@@ -59,26 +55,6 @@ void value::set(tag&& t)
tag_ = std::move(t).move_clone();
}
-value::operator tag&()
-{
- return get();
-}
-
-value::operator const tag&() const
-{
- return get();
-}
-
-tag& value::get()
-{
- return *tag_;
-}
-
-const tag& value::get() const
-{
- return *tag_;
-}
-
//Primitive assignment
//FIXME: Make this less copypaste!
value& value::operator=(int8_t val)
@@ -325,11 +301,6 @@ value::operator double() const
}
}
-value& value::operator=(const std::string& str)
-{
- return *this = std::move(std::string(str));
-}
-
value& value::operator=(std::string&& str)
{
if(!tag_)
@@ -344,11 +315,6 @@ value::operator const std::string&() const
return dynamic_cast<tag_string&>(*tag_).get();
}
-value::operator bool() const
-{
- return tag_ != nullptr;
-}
-
value& value::at(const std::string& key)
{
return dynamic_cast<tag_compound&>(*tag_).at(key);
@@ -389,21 +355,6 @@ const value& value::operator[](size_t i) const
return dynamic_cast<const tag_list&>(*tag_)[i];
}
-std::unique_ptr<tag>& value::get_ptr()
-{
- return tag_;
-}
-
-const std::unique_ptr<tag>& value::get_ptr() const
-{
- return tag_;
-}
-
-void value::set_ptr(std::unique_ptr<tag>&& t)
-{
- tag_ = std::move(t);
-}
-
tag_type value::get_type() const
{
return tag_ ? tag_->get_type() : tag_type::Null;
diff --git a/src/value_initializer.cpp b/src/value_initializer.cpp
index 0431bfaef2..3735bfdf09 100644
--- a/src/value_initializer.cpp
+++ b/src/value_initializer.cpp
@@ -23,11 +23,6 @@
namespace nbt
{
-value_initializer::value_initializer(std::unique_ptr<tag>&& t) noexcept: value(std::move(t)) {}
-value_initializer::value_initializer(std::nullptr_t) noexcept: value(nullptr) {}
-value_initializer::value_initializer(value&& val) noexcept : value(std::move(val)) {}
-value_initializer::value_initializer(tag&& t) : value(std::move(t)) {}
-
value_initializer::value_initializer(int8_t val) : value(tag_byte(val)) {}
value_initializer::value_initializer(int16_t val) : value(tag_short(val)) {}
value_initializer::value_initializer(int32_t val) : value(tag_int(val)) {}