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#include <QtCore/qutf8stringview.h>
22
23QT_BEGIN_NAMESPACE
24
25namespace QJsonPrivate {
26
27class Parser
28{
29public:
30 explicit Parser(QUtf8StringView json);
31
32 QCborValue parse(QJsonParseError *error);
33
34private:
35 inline void eatBOM();
36 inline bool eatSpace();
37 inline char nextToken();
38
39 bool parseObject();
40 bool parseArray();
41 bool parseMember();
42 bool parseString();
43 bool parseValueIntoContainer();
44 QCborValue parseValue();
45 QCborValue parseNumber();
46 const char *head;
47 const char *json;
48 const char *end;
49
50 int nestingLevel;
51 QJsonParseError::ParseError lastError;
52 QExplicitlySharedDataPointer<QCborContainerPrivate> container;
53};
54
55}
56
57QT_END_NAMESPACE
58
59#endif
60

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