mirror of
https://review.haiku-os.org/haiku
synced 2025-01-26 08:17:59 +01:00
6c9415e3ca
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.
37 lines
828 B
C++
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
|