Coverage Report

Created: 2026-01-25 07:18

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/qtsvg/src/plugins/imageformats/svg/main.cpp
Line
Count
Source
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4
#include <qimageiohandler.h>
5
#include <qstringlist.h>
6
7
#if !defined(QT_NO_SVGRENDERER)
8
9
#include "qsvgiohandler.h"
10
11
#include <qiodevice.h>
12
#include <qbytearray.h>
13
#include <qdebug.h>
14
15
QT_BEGIN_NAMESPACE
16
17
class QSvgPlugin : public QImageIOPlugin
18
{
19
0
    Q_OBJECT
20
0
#ifndef QT_NO_COMPRESS
21
0
    Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "svg.json")
22
0
#else
23
0
    Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" FILE "svg-nocompress.json")
24
0
#endif
25
0
26
0
public:
27
0
    Capabilities capabilities(QIODevice *device, const QByteArray &format) const override;
28
0
    QImageIOHandler *create(QIODevice *device, const QByteArray &format = QByteArray()) const override;
29
0
};
30
0
31
0
QImageIOPlugin::Capabilities QSvgPlugin::capabilities(QIODevice *device, const QByteArray &format) const
32
39.4k
{
33
39.4k
#ifndef QT_NO_COMPRESS
34
39.4k
    if (format == "svg" || format == "svgz")
35
#else
36
    if (format == "svg")
37
#endif
38
0
        return Capabilities(CanRead);
39
39.4k
    Capabilities cap;
40
39.4k
    if (!format.isEmpty())
41
5.56k
        return cap;
42
33.9k
    if (device->isReadable() && QSvgIOHandler::canRead(device))
43
9.35k
        cap |= CanRead;
44
33.9k
    return cap;
45
39.4k
}
46
47
QImageIOHandler *QSvgPlugin::create(QIODevice *device, const QByteArray &format) const
48
9.35k
{
49
9.35k
    QSvgIOHandler *hand = new QSvgIOHandler();
50
9.35k
    hand->setDevice(device);
51
9.35k
    hand->setFormat(format);
52
9.35k
    return hand;
53
9.35k
}
54
55
QT_END_NAMESPACE
56
57
#include "main.moc"
58
59
#endif // !QT_NO_IMAGEFORMATPLUGIN