qt6windows7/examples/corelib/serialization/convert/nullconverter.cpp

40 lines
898 B
C++
Raw Normal View History

2023-10-30 06:33:08 +08:00
// Copyright (C) 2018 Intel Corporation.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "nullconverter.h"
2023-11-02 01:02:52 +08:00
using namespace Qt::StringLiterals;
2023-10-30 06:33:08 +08:00
static NullConverter nullConverter;
2023-12-05 01:42:35 +08:00
bool Converter::isNull(const Converter *converter)
{
return converter == &nullConverter;
}
2023-10-30 06:33:08 +08:00
2023-11-02 01:02:52 +08:00
QString NullConverter::name() const
2023-10-30 06:33:08 +08:00
{
2023-11-02 01:02:52 +08:00
return "null"_L1;
2023-10-30 06:33:08 +08:00
}
2023-11-02 01:02:52 +08:00
Converter::Directions NullConverter::directions() const
2023-10-30 06:33:08 +08:00
{
2023-11-02 01:02:52 +08:00
return Direction::Out;
2023-10-30 06:33:08 +08:00
}
2023-11-02 01:02:52 +08:00
Converter::Options NullConverter::outputOptions() const
2023-10-30 06:33:08 +08:00
{
return SupportsArbitraryMapKeys;
}
2023-11-02 01:02:52 +08:00
void NullConverter::saveFile(QIODevice *f, const QVariant &contents,
const QStringList &options) const
2023-10-30 06:33:08 +08:00
{
if (!options.isEmpty()) {
2023-12-05 01:42:35 +08:00
qFatal("Unknown option '%s' to null output. This format has no options.",
qPrintable(options.first()));
2023-10-30 06:33:08 +08:00
}
Q_UNUSED(f);
Q_UNUSED(contents);
}