1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QJSONPARSER_P_H
5#define QJSONPARSER_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtCore/private/qglobal_p.h>
19#include <QtCore/private/qcborvalue_p.h>
20#include <QtCore/qjsondocument.h>
21
22QT_BEGIN_NAMESPACE
23
24namespace QJsonPrivate {
25
26class Parser
27{
28public:
29 Parser(const char *json, int length);
30
31 QCborValue parse(QJsonParseError *error);
32
33private:
34 inline void eatBOM();
35 inline bool eatSpace();
36 inline char nextToken();
37
38 bool parseObject();
39 bool parseArray();
40 bool parseMember();
41 bool parseString();
42 bool parseValue();
43 bool parseNumber();
44 const char *head;
45 const char *json;
46 const char *end;
47
48 int nestingLevel;
49 QJsonParseError::ParseError lastError;
50 QExplicitlySharedDataPointer<QCborContainerPrivate> container;
51};
52
53}
54
55QT_END_NAMESPACE
56
57#endif
58

source code of qtbase/src/corelib/serialization/qjsonparser_p.h