Augustin Cavalier 6c9415e3ca BJson: Use the normal "input, output" argument ordering instead of the reverse.
Update all in-tree consumers of the BJson API to match. Also added
const-qualifiers to the BString versions of the API, and added the leading
"_" to the header guards.
2017-02-09 13:43:26 -05:00

37 lines
828 B
C++

/*
* Copyright 2014, Augustin Cavalier (waddlesplash)
* Distributed under the terms of the MIT License.
*/
#ifndef _JSON_H
#define _JSON_H
#include <Message.h>
#include <String.h>
namespace BPrivate {
class BJson {
public:
enum JsonObjectType {
JSON_TYPE_MAP = '_JTM',
JSON_TYPE_ARRAY = '_JTA'
};
public:
static status_t Parse(const char* JSON, BMessage& message);
static status_t Parse(const BString& JSON, BMessage& message);
private:
static void _Parse(const BString& JSON, BMessage& message);
static BString _ParseString(const BString& JSON, int32& pos);
static double _ParseNumber(const BString& JSON, int32& pos);
static bool _ParseConstant(const BString& JSON, int32& pos,
const char* constant);
};
} // namespace BPrivate
using BPrivate::BJson;
#endif // _JSON_H