2 * Copyright 2017, Andrew Lindesay <apl@lindesay.co.nz>
3 * Copyright 2014, Augustin Cavalier (waddlesplash)
4 * Distributed under the terms of the MIT License.
10 #include "JsonEventListener.h"
18 class JsonParseContext
;
23 static status_t
Parse(const char* JSON
, BMessage
& message
);
24 static status_t
Parse(const BString
& JSON
, BMessage
& message
);
25 static void Parse(BDataIO
* data
,
26 BJsonEventListener
* listener
);
29 static bool NextChar(JsonParseContext
& jsonParseContext
,
31 static bool NextNonWhitespaceChar(
32 JsonParseContext
& jsonParseContext
,
35 static bool ParseAny(JsonParseContext
& jsonParseContext
);
36 static bool ParseObjectNameValuePair(
37 JsonParseContext
& jsonParseContext
);
38 static bool ParseObject(JsonParseContext
& jsonParseContext
);
39 static bool ParseArray(JsonParseContext
& jsonParseContext
);
40 static bool ParseEscapeUnicodeSequence(
41 JsonParseContext
& jsonParseContext
,
42 BString
& stringResult
);
43 static bool ParseStringEscapeSequence(
44 JsonParseContext
& jsonParseContext
,
45 BString
& stringResult
);
46 static bool ParseString(JsonParseContext
& jsonParseContext
,
47 json_event_type eventType
);
48 static bool ParseExpectedVerbatimStringAndRaiseEvent(
49 JsonParseContext
& jsonParseContext
,
50 const char* expectedString
,
51 size_t expectedStringLength
,
53 json_event_type jsonEventType
);
54 static bool ParseExpectedVerbatimString(
55 JsonParseContext
& jsonParseContext
,
56 const char* expectedString
,
57 size_t expectedStringLength
,
60 static bool IsValidNumber(BString
& number
);
61 static bool ParseNumber(JsonParseContext
& jsonParseContext
);
64 } // namespace BPrivate
66 using BPrivate::BJson
;