Util+Test: Change namespace of JSON classes: Json -> Util::JSON

This commit is contained in:
Riyyi
2022-07-22 12:41:27 +02:00
parent be74d89fea
commit deb9f29b47
19 changed files with 142 additions and 142 deletions
+2 -2
View File
@@ -7,7 +7,7 @@
#include "util/json/array.h"
#include "util/json/value.h"
namespace Json {
namespace Util::JSON {
void Array::emplace_back(Value element)
{
@@ -23,4 +23,4 @@ Value& Array::operator[](size_t index)
return m_elements[index];
}
} // namespace Json
} // namespace Util::JSON
+5 -5
View File
@@ -4,15 +4,15 @@
* SPDX-License-Identifier: MIT
*/
#ifndef JSON_ARRAY_H
#define JSON_ARRAY_H
#ifndef UTIL_JSON_ARRAY_H
#define UTIL_JSON_ARRAY_H
#include <utility> // move
#include <vector>
#include "util/json/parser.h"
namespace Json {
namespace Util::JSON {
class Value;
@@ -54,6 +54,6 @@ private:
std::vector<Value> m_elements;
};
} // namespace Json
} // namespace Util::JSON
#endif // JSON_ARRAY_H
#endif // UTIL_JSON_ARRAY_H
+5 -5
View File
@@ -4,8 +4,8 @@
* SPDX-License-Identifier: MIT
*/
#ifndef JSON_FROM_JSON_H
#define JSON_FROM_JSON_H
#ifndef UTIL_JSON_FROM_JSON_H
#define UTIL_JSON_FROM_JSON_H
#include <algorithm> // transform
#include <cassert> // assert
@@ -20,7 +20,7 @@
#include "util/json/object.h"
#include "util/meta/odr.h"
namespace Json {
namespace Util::JSON {
namespace Detail {
@@ -116,9 +116,9 @@ namespace {
constexpr const auto& fromJson = Util::Detail::staticConst<Detail::fromJsonFunction>; // NOLINT(misc-definitions-in-headers,clang-diagnostic-unused-variable)
} // namespace
} // namespace Json
} // namespace Util::JSON
#endif // JSON_FROM_JSON_H
#endif // UTIL_JSON_FROM_JSON_H
// Customization Points
// https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4381.html
+2 -2
View File
@@ -13,7 +13,7 @@
#include "util/json/parser.h"
#include "util/json/value.h"
namespace Json {
namespace Util::JSON {
Job::Job(std::string_view input)
: m_input(input)
@@ -111,4 +111,4 @@ void Job::printErrorLine(Token token, const char* message)
std::string(line.length() - token.column, '~').c_str());
}
} // namespace Json
} // namespace Util::JSON
+5 -5
View File
@@ -4,8 +4,8 @@
* SPDX-License-Identifier: MIT
*/
#ifndef JSON_JOB_H
#define JSON_JOB_H
#ifndef UTIL_JSON_JOB_H
#define UTIL_JSON_JOB_H
#include <cstddef> // size_t
#include <string_view>
@@ -13,7 +13,7 @@
#include "util/json/lexer.h"
namespace Json {
namespace Util::JSON {
class Value;
@@ -48,6 +48,6 @@ private:
std::vector<Token> m_tokens;
};
} // namespace Json
} // namespace Util::JSON
#endif // JSON_JOB_H
#endif // UTIL_JSON_JOB_H
+2 -2
View File
@@ -10,7 +10,7 @@
#include "util/json/job.h"
#include "util/json/lexer.h"
namespace Json {
namespace Util::JSON {
Lexer::Lexer(Job* job)
: GenericLexer(job->input())
@@ -214,4 +214,4 @@ bool Lexer::consumeLiteral()
return consumeNumberOrLiteral(Token::Type::Literal);
}
} // namespace Json
} // namespace Util::JSON
+5 -5
View File
@@ -4,8 +4,8 @@
* SPDX-License-Identifier: MIT
*/
#ifndef JSON_LEXER_H
#define JSON_LEXER_H
#ifndef UTIL_JSON_LEXER_H
#define UTIL_JSON_LEXER_H
// The JavaScript Object Notation (JSON) Data Interchange Format
// https://www.rfc-editor.org/rfc/pdfrfc/rfc8259.txt.pdf
@@ -16,7 +16,7 @@
#include "util/genericlexer.h"
namespace Json {
namespace Util::JSON {
class Job;
@@ -62,6 +62,6 @@ private:
std::vector<Token>* m_tokens { nullptr };
};
} // namespace Json
} // namespace Util::JSON
#endif // JSON_LEXER_H
#endif // UTIL_JSON_LEXER_H
+2 -2
View File
@@ -7,7 +7,7 @@
#include "util/json/object.h"
#include "util/json/value.h"
namespace Json {
namespace Util::JSON {
void Object::emplace(const std::string& name, Value value)
{
@@ -23,4 +23,4 @@ Value& Object::operator[](const std::string& name)
return m_members.at(name);
}
} // namespace Json
} // namespace Util::JSON
+5 -5
View File
@@ -4,8 +4,8 @@
* SPDX-License-Identifier: MIT
*/
#ifndef JSON_OBJECT_H
#define JSON_OBJECT_H
#ifndef UTIL_JSON_OBJECT_H
#define UTIL_JSON_OBJECT_H
#include <map>
#include <string>
@@ -13,7 +13,7 @@
#include "util/json/parser.h"
namespace Json {
namespace Util::JSON {
class Value;
@@ -50,6 +50,6 @@ private:
std::map<std::string, Value> m_members;
};
} // namespace Json
} // namespace Util::JSON
#endif // JSON_OBJECT_H
#endif // UTIL_JSON_OBJECT_H
+2 -2
View File
@@ -18,7 +18,7 @@
#include "util/json/parser.h"
#include "util/json/value.h"
namespace Json {
namespace Util::JSON {
Parser::Parser(Job* job)
: m_job(job)
@@ -493,4 +493,4 @@ Value Parser::consumeObject()
return object;
}
} // namespace Json
} // namespace Util::JSON
+5 -5
View File
@@ -4,15 +4,15 @@
* SPDX-License-Identifier: MIT
*/
#ifndef JSON_PARSER_H
#define JSON_PARSER_H
#ifndef UTIL_JSON_PARSER_H
#define UTIL_JSON_PARSER_H
#include <cstddef> // size_t
#include <vector>
#include "util/json/lexer.h"
namespace Json {
namespace Util::JSON {
class Job;
class Value;
@@ -43,6 +43,6 @@ private:
std::vector<Token>* m_tokens { nullptr };
};
} // namespace Json
} // namespace Util::JSON
#endif // JSON_PARSER_H
#endif // UTIL_JSON_PARSER_H
+2 -2
View File
@@ -14,7 +14,7 @@
#include "util/json/object.h"
#include "util/json/serializer.h"
namespace Json {
namespace Util::JSON {
Serializer::Serializer(const uint32_t indent, const char indentCharacter)
: m_indent(indent)
@@ -151,4 +151,4 @@ void Serializer::dumpObject(const Value& value, const uint32_t indentLevel)
m_output += '}';
}
} // namespace Json
} // namespace Util::JSON
+5 -5
View File
@@ -4,15 +4,15 @@
* SPDX-License-Identifier: MIT
*/
#ifndef JSON_SERIALIZER_H
#define JSON_SERIALIZER_H
#ifndef UTIL_JSON_SERIALIZER_H
#define UTIL_JSON_SERIALIZER_H
#include <cstdint> // uint32_t
#include <string>
#include "util/json/value.h"
namespace Json {
namespace Util::JSON {
class Serializer {
public:
@@ -32,6 +32,6 @@ private:
char m_indentCharacter { ' ' };
};
} // namespace Json
} // namespace Util::JSON
#endif // JSON_SERIALIZER_H
#endif // UTIL_JSON_SERIALIZER_H
+5 -5
View File
@@ -4,8 +4,8 @@
* SPDX-License-Identifier: MIT
*/
#ifndef JSON_TO_JSON_H
#define JSON_TO_JSON_H
#ifndef UTIL_JSON_TO_JSON_H
#define UTIL_JSON_TO_JSON_H
#include <cassert> // assert
#include <cstddef> // nullptr_t
@@ -18,7 +18,7 @@
#include "util/json/object.h"
#include "util/meta/odr.h"
namespace Json {
namespace Util::JSON {
namespace Detail {
@@ -136,9 +136,9 @@ namespace {
constexpr const auto& toJson = Util::Detail::staticConst<Detail::toJsonFunction>; // NOLINT(misc-definitions-in-headers,clang-diagnostic-unused-variable)
} // namespace
} // namespace Json
} // namespace Util::JSON
#endif // JSON_TO_JSON_H
#endif // UTIL_JSON_TO_JSON_H
// Customization Points
// https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4381.html
+2 -2
View File
@@ -19,7 +19,7 @@
#include "util/json/serializer.h"
#include "util/json/value.h"
namespace Json {
namespace Util::JSON {
Value::Value(std::nullptr_t)
: Value(Type::Null)
@@ -337,4 +337,4 @@ void format(FormatBuilder& builder, const Value& value)
builder.putString(value.dump(4));
}
} // namespace Json
} // namespace Util::JSON
+5 -5
View File
@@ -4,8 +4,8 @@
* SPDX-License-Identifier: MIT
*/
#ifndef JSON_VALUE_H
#define JSON_VALUE_H
#ifndef UTIL_JSON_VALUE_H
#define UTIL_JSON_VALUE_H
#include <cstddef> // nullptr_t, size_t
#include <cstdint> // uint32_t
@@ -18,7 +18,7 @@
#include "util/json/fromjson.h"
#include "util/json/tojson.h"
namespace Json {
namespace Util::JSON {
class Array;
class Object;
@@ -137,7 +137,7 @@ std::ostream& operator<<(std::ostream& output, const Value& value);
void format(FormatBuilder& builder, const Value& value);
} // namespace Json
} // namespace Util::JSON
/**
* User-defined string literal
@@ -149,4 +149,4 @@ inline Json::Value operator"" _json(const char* input, size_t length)
return Json::Value::parse(std::string(input, length));
}
#endif // JSON_VALUE_H
#endif // UTIL_JSON_VALUE_H