Cleanup includes in the QtProtobuf module

- Unify the include style.
- Use forward declarations where applicable.
- Remove unused includes.

Pick-to: 6.8
Task-number: QTBUG-123626
Change-Id: I40b2d7428079145c5828c3579aa3f840c343390e
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
This commit is contained in:
Alexey Edelev 2024-08-24 11:39:56 +02:00
parent 7dedb683e9
commit 0c12d6964b
22 changed files with 73 additions and 68 deletions

View File

@ -5,19 +5,17 @@
#ifndef QABSTRACTPROTOBUFSERIALIZER_H
#define QABSTRACTPROTOBUFSERIALIZER_H
#include <QtProtobuf/qtprotobufglobal.h>
#include <QtProtobuf/qtprotobufexports.h>
#include <QtProtobuf/qtprotobuftypes.h>
#include <QtProtobuf/qprotobufmessage.h>
#include <QtCore/qbytearray.h>
#include <QtCore/qbytearrayview.h>
#include <QtCore/qstring.h>
#include <QtCore/qmetaobject.h>
#include <QtCore/qvariant.h>
QT_BEGIN_NAMESPACE
class QProtobufMessage;
class Q_PROTOBUF_EXPORT QAbstractProtobufSerializer
{
public:

View File

@ -1,11 +1,11 @@
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qprotobufjsonserializer.h"
#include "qprotobufregistration_p.h"
#include "qprotobufserializer_p.h"
#include "qtprotobufdefs_p.h"
#include <QtProtobuf/qprotobufjsonserializer.h>
#include <QtProtobuf/private/qprotobufregistration_p.h>
#include <QtProtobuf/private/qprotobufserializer_p.h>
#include <QtProtobuf/private/qtprotobufdefs_p.h>
#include <QtProtobuf/private/qtprotobufserializerhelpers_p.h>
#include <QtCore/qcoreapplication.h>

View File

@ -7,7 +7,6 @@
#include <QtProtobuf/qtprotobufglobal.h>
#include <QtProtobuf/qabstractprotobufserializer.h>
#include <QtProtobuf/qtprotobuftypes.h>
#include <memory>

View File

@ -5,7 +5,7 @@
#ifndef QPROTOBUFLAZYMESSAGEPOINTER_H
#define QPROTOBUFLAZYMESSAGEPOINTER_H
#include <QtProtobuf/qtprotobufglobal.h>
#include <QtProtobuf/qtprotobufexports.h>
#include <QtProtobuf/qprotobufmessage.h>
#include <QtProtobuf/qtprotobuftypes.h>

View File

@ -1,14 +1,12 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qprotobufmessage.h"
#include "qprotobufmessage_p.h"
#include "qabstractprotobufserializer.h"
#include "qprotobufregistration.h"
#include "qprotobufpropertyorderingbuilder_p.h"
#include "qtprotobuftypes.h"
#include <QtProtobuf/qprotobufmessage.h>
#include <QtProtobuf/private/qprotobufmessage_p.h>
#include <QtProtobuf/private/qprotobufpropertyorderingbuilder_p.h>
#include <QtProtobuf/qabstractprotobufserializer.h>
#include <QtProtobuf/qprotobufpropertyordering.h>
#include <QtCore/qassert.h>
#include <QtCore/qmetaobject.h>

View File

@ -4,24 +4,32 @@
#ifndef QPROTOBUFMESSAGE_H
#define QPROTOBUFMESSAGE_H
#include <QtProtobuf/qtprotobufglobal.h>
#include <QtProtobuf/qtprotobufexports.h>
#include <QtProtobuf/qprotobufpropertyordering.h>
#include <QtCore/qtconfigmacros.h>
#include <QtCore/qtmetamacros.h>
#include <QtCore/qanystringview.h>
#include <QtCore/qbytearray.h>
#include <QtCore/qbytearrayview.h>
#include <QtCore/qlist.h>
#include <QtCore/qmetaobject.h>
#include <QtCore/qshareddata.h>
#include <QtCore/qtmetamacros.h>
QT_BEGIN_NAMESPACE
class QAbstractProtobufSerializer;
struct QMetaObject;
class QVariant;
class QProtobufMessage;
struct QProtobufMessageDeleter {
Q_PROTOBUF_EXPORT void operator()(QProtobufMessage *ptr) const noexcept;
};
using QProtobufMessagePointer = std::unique_ptr<QProtobufMessage, QProtobufMessageDeleter>;
class QAbstractProtobufSerializer;
namespace QtProtobufPrivate {
struct QProtobufPropertyOrdering;
}
class QProtobufMessagePrivate;
QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QProtobufMessagePrivate, Q_PROTOBUF_EXPORT)

View File

@ -15,18 +15,18 @@
// We mean it.
//
#include <QtProtobuf/qtprotobufglobal.h>
#include <QtProtobuf/qprotobufmessage.h>
#include <QtProtobuf/qprotobufpropertyordering.h>
#include <QtProtobuf/qtprotobufexports.h>
#include <QtCore/qtconfigmacros.h>
#include <QtCore/qhash.h>
#include <QtCore/private/qglobal_p.h>
#include <QtCore/qshareddata.h>
#include <optional>
QT_BEGIN_NAMESPACE
struct QMetaObject;
class QMetaProperty;
class Q_PROTOBUF_EXPORT QProtobufMessagePrivate : public QSharedData

View File

@ -1,7 +1,7 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qprotobufoneof.h"
#include <QtProtobuf/qprotobufoneof.h>
QT_BEGIN_NAMESPACE

View File

@ -1,12 +1,12 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qprotobufpropertyordering.h"
#include "qprotobufpropertyorderingbuilder_p.h"
#include "qtprotobuflogging_p.h"
#include "qtprotobufdefs_p.h"
#include "qprotobufregistration.h"
#include <QtProtobuf/qprotobufpropertyordering.h>
#include <QtProtobuf/private/qprotobufpropertyorderingbuilder_p.h>
#include <QtProtobuf/private/qtprotobufdefs_p.h>
#include <QtProtobuf/private/qtprotobuflogging_p.h>
#include <QtProtobuf/qprotobufregistration.h>
#include <QtCore/qhash.h>
#include <QtCore/qmetatype.h>

View File

@ -9,11 +9,11 @@
# pragma qt_sync_stop_processing
#endif
#include <QtProtobuf/qtprotobufglobal.h>
#include <QtProtobuf/qtprotobufexports.h>
#include <QtCore/qflags.h>
#include <QtCore/qtclasshelpermacros.h>
#include <QtCore/qutf8stringview.h>
#include <QtCore/qxptype_traits.h>
QT_BEGIN_NAMESPACE

View File

@ -4,12 +4,6 @@
#ifndef QPROTOBUFPROPERTYORDERINGBUILDER_P_H
#define QPROTOBUFPROPERTYORDERINGBUILDER_P_H
#include <QtProtobuf/qtprotobufglobal.h>
#include <QtProtobuf/qprotobufpropertyordering.h>
#include <QtCore/qbytearray.h>
// Source is in qprotobufpropertyordering.cpp
// The intent is to share some of the code
@ -24,6 +18,12 @@
// We mean it.
//
#include <QtProtobuf/qprotobufpropertyordering.h>
#include <QtProtobuf/qtprotobufexports.h>
#include <QtCore/qbytearray.h>
#include <QtCore/qtclasshelpermacros.h>
QT_BEGIN_NAMESPACE
namespace QtProtobufPrivate {

View File

@ -1,10 +1,10 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qprotobufregistration.h"
#include "qtprotobuftypes.h"
#include <QtProtobuf/qprotobufregistration.h>
#include <QtProtobuf/private/qprotobufregistration_p.h>
#include <QtProtobuf/qtprotobuftypes.h>
#include <QtCore/qmutex.h>
#include <QtCore/qmetatype.h>

View File

@ -9,19 +9,21 @@
# pragma qt_sync_stop_processing
#endif
#include <QtProtobuf/qtprotobufglobal.h>
#include <QtProtobuf/qtprotobufexports.h>
#include <QtProtobuf/qprotobufmessage.h>
#include <QtProtobuf/qprotobufpropertyordering.h>
#include <QtProtobuf/qprotobufrepeatediterator.h>
#include <QtProtobuf/qtprotobuftypes.h>
#include <QtCore/qhash.h>
#include <QtCore/qlist.h>
#include <QtCore/qmetaobject.h>
#include <QtCore/qmetatype.h>
QT_BEGIN_NAMESPACE
class QProtobufMessage;
namespace QtProtobuf {
using RegisterFunction = void (*)();
// This struct is used for type registrations in generated code

View File

@ -16,7 +16,7 @@
// We mean it.
//
#include <QtProtobuf/qtprotobufglobal.h>
#include <QtProtobuf/qtprotobufexports.h>
#include <QtCore/qnumeric.h>
#include <QtCore/qbytearray.h>

View File

@ -2,13 +2,15 @@
// Copyright (C) 2019 Alexey Edelev <semlanik@gmail.com>, Viktor Kopp <vifactor@gmail.com>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qprotobufserializer.h"
#include "qprotobufregistration_p.h"
#include "qprotobufserializer_p.h"
#include "qtprotobufdefs_p.h"
#include "qtprotobuftypes.h"
#include <QtProtobuf/qprotobufserializer.h>
#include <QtProtobuf/private/qprotobufmessage_p.h>
#include <QtProtobuf/private/qprotobufserializer_p.h>
#include <QtProtobuf/private/qprotobufregistration_p.h>
#include <QtProtobuf/private/qtprotobufdefs_p.h>
#include <QtProtobuf/private/qtprotobufserializerhelpers_p.h>
#include <QtProtobuf/qprotobufmessage.h>
#include <QtProtobuf/qtprotobuftypes.h>
#include <QtCore/qmetatype.h>
#include <QtCore/qcoreapplication.h>
@ -16,11 +18,6 @@
#include <QtCore/qvariant.h>
#include <QtCore/qreadwritelock.h>
#include <QtProtobuf/qprotobufmessage.h>
#include <QtProtobuf/private/qprotobufserializer_p.h>
#include <QtProtobuf/private/qprotobufmessage_p.h>
QT_BEGIN_NAMESPACE
/*!

View File

@ -5,10 +5,11 @@
#ifndef QPROTOBUFSERIALIZER_H
#define QPROTOBUFSERIALIZER_H
#include <QtProtobuf/qtprotobufglobal.h>
#include <QtProtobuf/qabstractprotobufserializer.h>
#include <QtProtobuf/qtprotobuftypes.h>
#include <QtProtobuf/qtprotobufexports.h>
#include <QtCore/qbytearrayview.h>
#include <QtCore/qstring.h>
#include <memory>

View File

@ -17,6 +17,7 @@
//
#include <QtProtobuf/qabstractprotobufserializer.h>
#include <QtProtobuf/qprotobufpropertyordering.h>
#include <QtProtobuf/qprotobufserializer.h>
#include <QtProtobuf/qprotobufrepeatediterator.h>
#include <QtProtobuf/qtprotobuftypes.h>

View File

@ -1,7 +1,7 @@
// Copyright (C) 2019 Alexey Edelev <semlanik@gmail.com>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qtprotobuflogging_p.h"
#include <QtProtobuf/private/qtprotobuflogging_p.h>
QT_BEGIN_NAMESPACE

View File

@ -16,7 +16,7 @@
// We mean it.
//
#include <QtProtobuf/qtprotobufglobal.h>
#include <QtProtobuf/qtprotobufexports.h>
#include <QtCore/qloggingcategory.h>
#include <QtCore/private/qglobal_p.h>

View File

@ -1,7 +1,7 @@
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qtprotobufserializerhelpers_p.h"
#include <QtProtobuf/private/qtprotobufserializerhelpers_p.h>
#include <QtProtobuf/private/qprotobufmessage_p.h>
QT_BEGIN_NAMESPACE

View File

@ -2,7 +2,7 @@
// Copyright (C) 2019 Alexey Edelev <semlanik@gmail.com>
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qtprotobuftypes.h"
#include <QtProtobuf/qtprotobuftypes.h>
QT_BEGIN_NAMESPACE

View File

@ -5,13 +5,14 @@
#ifndef QTPROTOBUFTYPES_H
#define QTPROTOBUFTYPES_H
#include <QtProtobuf/qtprotobufglobal.h>
#include <QtProtobuf/qprotobufmessage.h>
#include <QtProtobuf/qtprotobufexports.h>
#include <QtCore/qhash.h>
#include <QtCore/qmetatype.h>
#include <QtCore/qendian.h>
#include <QtCore/qhash.h>
#include <QtCore/qlist.h>
#include <QtCore/qmetatype.h>
#include <QtCore/qstring.h>
#include <type_traits>