Marble

GeoWriterBackend.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2016 Dennis Nienhüser <nienhueser@kde.org>
4//
5
6#ifndef MARBLE_GEOWRITERBACKEND_H
7#define MARBLE_GEOWRITERBACKEND_H
8
9#include "marble_export.h"
10
11#include <QString>
12
13class QIODevice;
14
15namespace Marble
16{
17
18class GeoDataDocument;
19
20class MARBLE_EXPORT GeoWriterBackend
21{
22public:
23 virtual ~GeoWriterBackend();
24
25 /**
26 * Write the contents of the given document to the device. This method is to be implemented by plugins.
27 * @param device An I/O device open for writing
28 * @param document A GeoDataDocument with content to write
29 * @return True if the content is successfully written to the device, false otherwise
30 */
31 virtual bool write(QIODevice *device, const GeoDataDocument &document) = 0;
32};
33
34/**
35 * Helper class for writer backend registration. This class is commonly used through the MARBLE_ADD_WRITER macro
36 */
37class MARBLE_EXPORT GeoWriterBackendRegistrar
38{
39public:
40 GeoWriterBackendRegistrar(GeoWriterBackend *writer, const QString &fileExtension);
42
43private:
44 GeoWriterBackend *m_writer;
45 QString m_fileExtension;
46};
47
48#ifndef STATIC_BUILD
49#define MARBLE_ADD_WRITER(Class, fileExtension) static GeoWriterBackendRegistrar s_##Class##Registrar(new Class, fileExtension);
50#else
51#define MARBLE_ADD_WRITER(Class, fileExtension)
52#endif
53
54}
55
56#endif
Helper class for writer backend registration.
Binds a QML item to a specific geodetic location in screen coordinates.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:14 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.