LeviLamina
Loading...
Searching...
No Matches
JsonHelpers.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated forward declare list
6// clang-format off
7namespace Json { class Value; }
8// clang-format on
9
10namespace JsonHelpers {
11// functions
12// NOLINTBEGIN
13#ifdef LL_PLAT_C
14MCNAPI void addIntField(::Json::Value& rootValue, ::std::string const& fieldName, int const& value);
15
16MCNAPI void addStringField(::Json::Value& rootValue, ::std::string const& fieldName, ::std::string const& value);
17#endif
18
19MCNAPI ::std::string getAsString(::Json::Value const& value, ::std::string_view defaultString);
20
21#ifdef LL_PLAT_C
22MCNAPI ::std::vector<::std::string> getAsStringArray(::Json::Value const& value);
23
24MCNAPI ::Json::Value const& getField(::Json::Value const& rootValue, ::std::string const& fieldName);
25
26MCNAPI ::Json::Value const& getFieldAsArray(::Json::Value const& rootValue, ::std::string const& fieldName);
27
28MCNAPI bool getFieldAsBool(::Json::Value const& rootValue, ::std::string const& fieldName, bool defaultBool);
29
30MCNAPI float getFieldAsFloat(::Json::Value const& rootValue, ::std::string const& fieldName, float defaultFloat);
31
32MCNAPI int getFieldAsInt(::Json::Value const& rootValue, ::std::string const& fieldName, int defaultInt);
33
34MCNAPI int64 getFieldAsInt64(::Json::Value const& rootValue, ::std::string const& fieldName, int64 defaultInt64);
35
36MCNAPI ::std::unordered_map<::std::string, ::std::string>
37getFieldAsLocDictionary(::Json::Value const& rootValue, ::std::string const& fieldName);
38
39MCNAPI ::std::unordered_map<::std::string, ::std::string>
40getFieldAsMapOfKeyValuePairs(::Json::Value const& rootValue, ::std::string const& fieldName);
41
42MCNAPI ::Json::Value const& getFieldAsObject(::Json::Value const& rootValue, ::std::string const& fieldName);
43
44MCNAPI ::std::vector<::std::reference_wrapper<::Json::Value const>>
45getFieldAsObjectArray(::Json::Value const& rootValue, ::std::string const& fieldName);
46
47MCNAPI ::std::string
48getFieldAsString(::Json::Value const& rootValue, ::std::string const& fieldName, ::std::string const& defaultString);
49
50MCNAPI ::std::vector<::std::string>
51getFieldAsStringArray(::Json::Value const& rootValue, ::std::string const& fieldName);
52
53MCNAPI uint64 getFieldAsUint64(::Json::Value const& rootValue, ::std::string const& fieldName, uint64 defaultUint64);
54
55MCNAPI bool hasField(::Json::Value const& rootValue, ::std::string const& fieldName);
56
57MCNAPI bool parseJson(::std::string const& str, ::Json::Value& root);
58
59MCNAPI ::std::string serialize(::Json::Value const& root);
60#endif
61// NOLINTEND
62
63// static variables
64// NOLINTBEGIN
65MCNAPI ::Json::Value const& EMPTY_JSON();
66// NOLINTEND
67
68} // namespace JsonHelpers
Definition Value.h:16