Move Converter class, in eponymous example, to a file of its own
There's more details coming and it's good hygiene anyway. Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: Ief3acf6e508bc93eaa8490f6c49300b25c1d3556 Reviewed-by: Juha Vuolle <juha.vuolle@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
d57a78657e
commit
8b8fc42f2c
@ -20,7 +20,7 @@ qt_standard_project_setup()
|
|||||||
|
|
||||||
qt_add_executable(convert
|
qt_add_executable(convert
|
||||||
cborconverter.cpp cborconverter.h
|
cborconverter.cpp cborconverter.h
|
||||||
converter.h
|
converter.cpp converter.h
|
||||||
datastreamconverter.cpp datastreamconverter.h
|
datastreamconverter.cpp datastreamconverter.h
|
||||||
debugtextdumper.cpp debugtextdumper.h
|
debugtextdumper.cpp debugtextdumper.h
|
||||||
jsonconverter.cpp jsonconverter.h
|
jsonconverter.cpp jsonconverter.h
|
||||||
|
@ -11,6 +11,7 @@ target.path = $$[QT_INSTALL_EXAMPLES]/corelib/serialization/convert
|
|||||||
INSTALLS += target
|
INSTALLS += target
|
||||||
|
|
||||||
SOURCES += main.cpp \
|
SOURCES += main.cpp \
|
||||||
|
converter.cpp \
|
||||||
cborconverter.cpp \
|
cborconverter.cpp \
|
||||||
datastreamconverter.cpp \
|
datastreamconverter.cpp \
|
||||||
debugtextdumper.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;
|
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,
|
static const Converter *prepareConverter(QString format, Converter::Direction direction,
|
||||||
QFile *stream)
|
QFile *stream)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user