From 5835c63bdaecd50b37609c4e55f1c5fa41c0ebef Mon Sep 17 00:00:00 2001 From: Riyyi Date: Tue, 12 Jul 2022 11:06:46 +0200 Subject: [PATCH] Util: Rename Array m_values -> m_elements --- src/util/json/array.cpp | 10 +++++----- src/util/json/array.h | 20 ++++++++++---------- src/util/json/fromjson.h | 4 ++-- src/util/json/serializer.cpp | 2 +- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/util/json/array.cpp b/src/util/json/array.cpp index a771574..b2553d8 100644 --- a/src/util/json/array.cpp +++ b/src/util/json/array.cpp @@ -9,18 +9,18 @@ namespace Json { -void Array::emplace_back(Value value) +void Array::emplace_back(Value element) { - m_values.emplace_back(std::move(value)); + m_elements.emplace_back(std::move(element)); } Value& Array::operator[](size_t index) { - if (index + 1 > m_values.size()) { - m_values.resize(index + 1); + if (index + 1 > m_elements.size()) { + m_elements.resize(index + 1); } - return m_values[index]; + return m_elements[index]; } } // namespace Json diff --git a/src/util/json/array.h b/src/util/json/array.h index e3456e0..df5c6d8 100644 --- a/src/util/json/array.h +++ b/src/util/json/array.h @@ -21,28 +21,28 @@ public: Array() {} virtual ~Array() {} - Array(const std::vector& values) - : m_values(values) + Array(const std::vector& elements) + : m_elements(elements) {} Array(const Array& other) - : m_values(other.m_values) + : m_elements(other.m_elements) { } - void emplace_back(Value value); - void reserve(size_t size) { m_values.reserve(size); } + void emplace_back(Value element); + void reserve(size_t size) { m_elements.reserve(size); } Value& operator[](size_t index); - Value& at(size_t index) { return m_values.at(index); } - const Value& at(size_t index) const { return m_values.at(index); } + Value& at(size_t index) { return m_elements.at(index); } + const Value& at(size_t index) const { return m_elements.at(index); } - size_t size() const { return m_values.size(); } - const std::vector& values() const { return m_values; } + size_t size() const { return m_elements.size(); } + const std::vector& elements() const { return m_elements; } private: - std::vector m_values; + std::vector m_elements; }; } // namespace Json diff --git a/src/util/json/fromjson.h b/src/util/json/fromjson.h index 1729bd1..f2d5285 100644 --- a/src/util/json/fromjson.h +++ b/src/util/json/fromjson.h @@ -72,8 +72,8 @@ void fromJson(const Json& json, std::vector& array) assert(json.type() == Json::Type::Array); array.resize(json.size()); std::transform( - json.asArray().values().begin(), - json.asArray().values().end(), + json.asArray().elements().begin(), + json.asArray().elements().end(), array.begin(), [](const Json& json) { return json.template get(); // (missing-dependent-template-keyword) diff --git a/src/util/json/serializer.cpp b/src/util/json/serializer.cpp index e724529..7e17c17 100644 --- a/src/util/json/serializer.cpp +++ b/src/util/json/serializer.cpp @@ -77,7 +77,7 @@ std::string Serializer::dumpArray(const Value& value, const uint32_t indentLevel result += '\n'; } - auto values = value.asArray().values(); + auto values = value.asArray().elements(); for (auto it = values.begin(); it != values.end(); ++it) { result += std::string(m_indent * (indentLevel + 1), m_indentCharacter); result += dumpHelper(*it, indentLevel + 1);