From 94ade05ca12fd6a14dba67ed449cf2831df5186f Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 4 Sep 2023 15:14:41 +0200 Subject: [PATCH] Split VariantOrderedMap out of Converter's header in example Although used mostly in the same files, they're separate types, so define them in separate places. Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: I9e64b382ad48f9a74e432ccd49b6f5fcc9316da3 Reviewed-by: Ivan Solovev --- .../serialization/convert/CMakeLists.txt | 1 + .../serialization/convert/cborconverter.cpp | 1 + .../corelib/serialization/convert/convert.pro | 1 + .../corelib/serialization/convert/converter.h | 16 +------------ .../convert/datastreamconverter.cpp | 1 + .../serialization/convert/debugtextdumper.cpp | 1 + .../serialization/convert/variantorderedmap.h | 24 +++++++++++++++++++ .../serialization/convert/xmlconverter.cpp | 1 + 8 files changed, 31 insertions(+), 15 deletions(-) create mode 100644 examples/corelib/serialization/convert/variantorderedmap.h diff --git a/examples/corelib/serialization/convert/CMakeLists.txt b/examples/corelib/serialization/convert/CMakeLists.txt index b5b960c005..d948d76ace 100644 --- a/examples/corelib/serialization/convert/CMakeLists.txt +++ b/examples/corelib/serialization/convert/CMakeLists.txt @@ -27,6 +27,7 @@ qt_add_executable(convert main.cpp nullconverter.cpp nullconverter.h textconverter.cpp textconverter.h + variantorderedmap.h xmlconverter.cpp xmlconverter.h ) diff --git a/examples/corelib/serialization/convert/cborconverter.cpp b/examples/corelib/serialization/convert/cborconverter.cpp index f6a4ee35d2..a067fe5ea4 100644 --- a/examples/corelib/serialization/convert/cborconverter.cpp +++ b/examples/corelib/serialization/convert/cborconverter.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause #include "cborconverter.h" +#include "variantorderedmap.h" #include #include diff --git a/examples/corelib/serialization/convert/convert.pro b/examples/corelib/serialization/convert/convert.pro index 5f4d8c203e..c4c6e6722a 100644 --- a/examples/corelib/serialization/convert/convert.pro +++ b/examples/corelib/serialization/convert/convert.pro @@ -27,4 +27,5 @@ HEADERS += \ jsonconverter.h \ nullconverter.h \ textconverter.h \ + variantorderedmap.h \ xmlconverter.h diff --git a/examples/corelib/serialization/convert/converter.h b/examples/corelib/serialization/convert/converter.h index e412abb711..7b37af12f9 100644 --- a/examples/corelib/serialization/convert/converter.h +++ b/examples/corelib/serialization/convert/converter.h @@ -5,22 +5,8 @@ #define CONVERTER_H #include -#include -#include +#include #include -#include - -class VariantOrderedMap : public QList> -{ -public: - VariantOrderedMap() = default; - VariantOrderedMap(const QVariantMap &map) - { - reserve(map.size()); - for (auto it = map.begin(); it != map.end(); ++it) - append({it.key(), it.value()}); - } -}; class Converter { diff --git a/examples/corelib/serialization/convert/datastreamconverter.cpp b/examples/corelib/serialization/convert/datastreamconverter.cpp index 0cce9dd286..2da9cbd765 100644 --- a/examples/corelib/serialization/convert/datastreamconverter.cpp +++ b/examples/corelib/serialization/convert/datastreamconverter.cpp @@ -3,6 +3,7 @@ #include "datastreamconverter.h" #include "debugtextdumper.h" +#include "variantorderedmap.h" #include diff --git a/examples/corelib/serialization/convert/debugtextdumper.cpp b/examples/corelib/serialization/convert/debugtextdumper.cpp index dfe3e5624a..16f974a719 100644 --- a/examples/corelib/serialization/convert/debugtextdumper.cpp +++ b/examples/corelib/serialization/convert/debugtextdumper.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause #include "debugtextdumper.h" +#include "variantorderedmap.h" #include #include diff --git a/examples/corelib/serialization/convert/variantorderedmap.h b/examples/corelib/serialization/convert/variantorderedmap.h new file mode 100644 index 0000000000..c65316b182 --- /dev/null +++ b/examples/corelib/serialization/convert/variantorderedmap.h @@ -0,0 +1,24 @@ +// Copyright (C) 2018 Intel Corporation. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +#ifndef VARIANTORDEREDMAP_H +#define VARIANTORDEREDMAP_H + +#include +#include +#include +#include + +class VariantOrderedMap : public QList> +{ +public: + VariantOrderedMap() = default; + VariantOrderedMap(const QVariantMap &map) + { + reserve(map.size()); + for (auto it = map.begin(); it != map.end(); ++it) + append({it.key(), it.value()}); + } +}; + +#endif // VARIANTORDEREDMAP_H diff --git a/examples/corelib/serialization/convert/xmlconverter.cpp b/examples/corelib/serialization/convert/xmlconverter.cpp index b625595fc7..11d298e04c 100644 --- a/examples/corelib/serialization/convert/xmlconverter.cpp +++ b/examples/corelib/serialization/convert/xmlconverter.cpp @@ -2,6 +2,7 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause #include "xmlconverter.h" +#include "variantorderedmap.h" #include #include