Util: Rename Stringify -> Serializer

This commit is contained in:
Riyyi
2022-07-04 17:04:16 +02:00
parent 5d844554f5
commit c3d6af85ba
3 changed files with 16 additions and 16 deletions
@@ -12,31 +12,31 @@
#include "util/json/array.h"
#include "util/json/lexer.h"
#include "util/json/object.h"
#include "util/json/stringify.h"
#include "util/json/serializer.h"
namespace Json {
Stringify::Stringify(const Value& value, const uint32_t indent, const char indentCharacter)
Serializer::Serializer(const Value& value, const uint32_t indent, const char indentCharacter)
: m_value(value)
, m_indent(indent)
, m_indentCharacter(indentCharacter)
{
}
Stringify::~Stringify()
Serializer::~Serializer()
{
}
// ------------------------------------------
std::string Stringify::dump()
std::string Serializer::dump()
{
return dumpHelper(m_value);
}
// ------------------------------------------
std::string Stringify::dumpHelper(const Value& value, const uint32_t indentLevel)
std::string Serializer::dumpHelper(const Value& value, const uint32_t indentLevel)
{
switch (value.type()) {
case Value::Type::Null:
@@ -67,7 +67,7 @@ std::string Stringify::dumpHelper(const Value& value, const uint32_t indentLevel
return "";
}
std::string Stringify::dumpArray(const Value& value, const uint32_t indentLevel)
std::string Serializer::dumpArray(const Value& value, const uint32_t indentLevel)
{
std::string result;
@@ -100,7 +100,7 @@ std::string Stringify::dumpArray(const Value& value, const uint32_t indentLevel)
return result;
}
std::string Stringify::dumpObject(const Value& value, const uint32_t indentLevel)
std::string Serializer::dumpObject(const Value& value, const uint32_t indentLevel)
{
std::string result;
@@ -4,8 +4,8 @@
* SPDX-License-Identifier: MIT
*/
#ifndef JSON_STRINGIFY_H
#define JSON_STRINGIFY_H
#ifndef JSON_SERIALIZER_H
#define JSON_SERIALIZER_H
#include <cstdint> // uint32_t
#include <string>
@@ -14,10 +14,10 @@
namespace Json {
class Stringify {
class Serializer {
public:
Stringify(const Value& value, const uint32_t indent = 0, const char indentCharacter = ' ');
virtual ~Stringify();
Serializer(const Value& value, const uint32_t indent = 0, const char indentCharacter = ' ');
virtual ~Serializer();
std::string dump();
@@ -34,4 +34,4 @@ private:
} // namespace Json
#endif // JSON_STRINGIFY_H
#endif // JSON_SERIALIZER_H
+3 -3
View File
@@ -15,7 +15,7 @@
#include "util/json/array.h"
#include "util/json/job.h"
#include "util/json/object.h"
#include "util/json/stringify.h"
#include "util/json/serializer.h"
#include "util/json/value.h"
namespace Json {
@@ -118,8 +118,8 @@ Value Value::parse(const std::string& input)
std::string Value::dump(const uint32_t indent, const char indentCharacter) const
{
Stringify stringify(*this, indent, indentCharacter);
return stringify.dump();
Serializer serializer(*this, indent, indentCharacter);
return serializer.dump();
}
void Value::emplace_back(Value value)