1 | // Copyright (C) 2022 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 Q_PROTOBUF_MESSAGE_P_H |
5 | #define Q_PROTOBUF_MESSAGE_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 for the convenience |
12 | // of the Qt Protobuf API. This header file may change from |
13 | // version to version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include "qprotobufmessage.h" |
19 | |
20 | #include <QtProtobuf/qtprotobufglobal.h> |
21 | |
22 | #include <QtCore/qtconfigmacros.h> |
23 | #include <QtCore/qhash.h> |
24 | #include <QtCore/private/qglobal_p.h> |
25 | |
26 | #include <optional> |
27 | |
28 | QT_BEGIN_NAMESPACE |
29 | |
30 | class QMetaProperty; |
31 | |
32 | class QProtobufMessagePrivate |
33 | { |
34 | public: |
35 | // QHash of form <bytes, occurrences>. A non-packed array is serialized as |
36 | // the (field index + wiretype) + bytes, which, if the serialized data is |
37 | // the same, will just be a bunch of identical segments, all of which we |
38 | // need. |
39 | QHash<QByteArray, qint32> unknownEntries; |
40 | const QMetaObject *metaObject = nullptr; |
41 | |
42 | int getPropertyIndex(QAnyStringView propertyName) const; |
43 | void storeUnknownEntry(QByteArrayView entry); |
44 | |
45 | std::optional<QMetaProperty> metaProperty(QAnyStringView name) const; |
46 | std::optional<QMetaProperty> |
47 | metaProperty(QtProtobufPrivate::QProtobufPropertyOrderingInfo ord) const; |
48 | |
49 | static QProtobufMessagePrivate *get(QProtobufMessage *message) { return message->d_func(); } |
50 | static const QProtobufMessagePrivate *get(const QProtobufMessage *message) |
51 | { |
52 | return message->d_func(); |
53 | } |
54 | }; |
55 | |
56 | QT_END_NAMESPACE |
57 | |
58 | #endif // Q_PROTOBUF_MESSAGE_P_H |
59 | |