Move Converter class, in eponymous example, to a file of its own
There's more details coming and it's good hygiene anyway. Task-number: QTBUG-111228 Change-Id: Ief3acf6e508bc93eaa8490f6c49300b25c1d3556 Reviewed-by: Juha Vuolle <juha.vuolle@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 8b8fc42f2c6b08097bcd04038ed7f12667a90875) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 73a2f1edbc7bdb87a0936d65d2e58e1f9f831b20)
This commit is contained in:
parent
24dfc96fa8
commit
9bbe104034
@ -20,7 +20,7 @@ qt_standard_project_setup()
|
||||
|
||||
qt_add_executable(convert
|
||||
cborconverter.cpp cborconverter.h
|
||||
converter.h
|
||||
converter.cpp converter.h
|
||||
datastreamconverter.cpp datastreamconverter.h
|
||||
debugtextdumper.cpp debugtextdumper.h
|
||||
jsonconverter.cpp jsonconverter.h
|
||||
|
@ -11,6 +11,7 @@ target.path = $$[QT_INSTALL_EXAMPLES]/corelib/serialization/convert
|
||||
INSTALLS += target
|
||||
|
||||
SOURCES += main.cpp \
|
||||
converter.cpp \
|
||||
cborconverter.cpp \
|
||||
datastreamconverter.cpp \
|
||||
debugtextdumper.cpp \
|
||||
|
25
examples/corelib/serialization/convert/converter.cpp
Normal file
25
examples/corelib/serialization/convert/converter.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
// Copyright (C) 2023 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
||||
|
||||
#include "converter.h"
|
||||
|
||||
Converter::Converter()
|
||||
{
|
||||
converters().append(this);
|
||||
}
|
||||
|
||||
Converter::~Converter()
|
||||
{
|
||||
converters().removeAll(this);
|
||||
}
|
||||
|
||||
QList<const Converter *> &Converter::converters()
|
||||
{
|
||||
Q_CONSTINIT static QList<const Converter *> store;
|
||||
return store;
|
||||
}
|
||||
|
||||
const QList<const Converter *> &Converter::allConverters()
|
||||
{
|
||||
return converters();
|
||||
}
|
@ -14,27 +14,6 @@
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
Converter::Converter()
|
||||
{
|
||||
converters().append(this);
|
||||
}
|
||||
|
||||
Converter::~Converter()
|
||||
{
|
||||
converters().removeAll(this);
|
||||
}
|
||||
|
||||
QList<const Converter *> &Converter::converters()
|
||||
{
|
||||
Q_CONSTINIT static QList<const Converter *> store;
|
||||
return store;
|
||||
}
|
||||
|
||||
const QList<const Converter *> &Converter::allConverters()
|
||||
{
|
||||
return converters();
|
||||
}
|
||||
|
||||
static const Converter *prepareConverter(QString format, Converter::Direction direction,
|
||||
QFile *stream)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user