Json.h revision 836bf249
1/*
2 * Copyright 2014, Augustin Cavalier (waddlesplash)
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef JSON_H
6#define JSON_H
7
8#include <Message.h>
9#include <String.h>
10
11namespace BPrivate {
12
13class BJson {
14public:
15			enum JsonObjectType {
16				JSON_TYPE_MAP = '_JTM',
17				JSON_TYPE_ARRAY = '_JTA'
18			};
19
20public:
21	static	status_t			Parse(BMessage& message, const char* JSON);
22	static	status_t			Parse(BMessage& message, BString& JSON);
23
24private:
25	static	BString				_Parser_ParseString(BString& JSON, int32& pos);
26	static	double				_Parser_ParseNumber(BString& JSON, int32& pos);
27	static	bool				_Parser_ParseConstant(BString& JSON, int32& pos,
28													  const char* constant);
29};
30
31} // namespace BPrivate
32
33using BPrivate::BJson;
34
35#endif	// JSON_H
36