1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Implemented 'strict' json support

This commit is contained in:
Ivan Savenko
2024-02-13 18:08:35 +02:00
parent d1c274f93f
commit 41493d6f67
8 changed files with 69 additions and 13 deletions

View File

@@ -16,6 +16,8 @@ VCMI_LIB_NAMESPACE_BEGIN
//Internal class for string -> JsonNode conversion
class JsonParser
{
const JsonParsingSettings settings;
std::string errors; // Contains description of all encountered errors
std::string_view input; // Input data
ui32 lineCount; // Currently parsed line, starting from 1
@@ -44,7 +46,7 @@ class JsonParser
bool error(const std::string &message, bool warning=false);
public:
JsonParser(const char * inputString, size_t stringSize);
JsonParser(const char * inputString, size_t stringSize, const JsonParsingSettings & settings);
/// do actual parsing. filename is name of file that will printed to console if any errors were found
JsonNode parse(const std::string & fileName);