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 addObjectArrayField(
15 ::Json::Value& rootValue,
16 ::std::string const& fieldName,
17 ::std::vector<::Json::Value> const& objectArray
18);
19
20MCNAPI void addStringArrayField(
21 ::Json::Value& rootValue,
22 ::std::string const& fieldName,
23 ::std::vector<::std::string> const& stringArray
24);
25
26MCNAPI ::std::optional<bool> getAsOptBool(::Json::Value const& value);
27#endif
28
29MCNAPI ::std::string getAsString(::Json::Value const& value, ::std::string_view defaultString);
30
31#ifdef LL_PLAT_C
32MCNAPI ::std::vector<::std::string> getAsStringArray(::Json::Value const& value);
33
34MCNAPI float getFieldAsFloat(::Json::Value const& rootValue, ::std::string const& fieldName, float defaultFloat);
35
36MCNAPI int getFieldAsInt(::Json::Value const& rootValue, ::std::string const& fieldName, int defaultInt);
37
38MCNAPI ::std::unordered_map<::std::string, ::std::string>
39getFieldAsLocDictionary(::Json::Value const& rootValue, ::std::string const& fieldName);
40
41MCNAPI ::std::unordered_map<::std::string, ::std::string>
42getFieldAsMapOfKeyValuePairs(::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#endif
53
54MCNAPI ::std::string serialize(::Json::Value const& root);
55// NOLINTEND
56
57// static variables
58// NOLINTBEGIN
59MCNAPI ::Json::Value const& EMPTY_JSON();
60// NOLINTEND
61
62} // namespace JsonHelpers
Definition Value.h:16