Marble

GeoDataDocumentWriter.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_GEODATADOCUMENTWRITER_H
7#define MARBLE_GEODATADOCUMENTWRITER_H
8
9#include "marble_export.h"
10
11#include <QIODevice>
12#include <QSet>
13
14namespace Marble
15{
16
17class GeoWriterBackend;
18class GeoDataDocument;
19
20/**
21 * Write GeoDataDocument content to I/O devices (e.g. a file)
22 */
23class MARBLE_EXPORT GeoDataDocumentWriter
24{
25public:
26 /**
27 * Write the content of the given GeoDataDocument to the given I/O device
28 * @param device An I/O device open for writing
29 * @param document A GeoDataDocument with content to write
30 * @param documentIdentifier XML document identifier or file extension that determines
31 * @return True if writing is successful, false otherwise
32 */
33 static bool write(QIODevice* device, const GeoDataDocument &document, const QString &documentIdentifier);
34
35 /**
36 * Convenience method that uses a QFile as QIODevice and determines the document type from the filename extension
37 * @param filename Target file's name
38 * @param document Document to write
39 * @param documentIdentifier XML document identifier or filename extension that determines the content type.
40 * Use an empty string (default) to determine it automatically
41 * @return True if writing is successful, false otherwise
42 */
43 static bool write(const QString &filename, const GeoDataDocument &document, const QString &documentIdentifier = QString());
44
45 /**
46 * Registers a plugin as a backend for writing a certain file extension. Usually called by the MARBLE_ADD_WRITER macro.
47 * @param writer Backend to register
48 * @param fileExtension File extension to associate the backend with
49 */
50 static void registerWriter(GeoWriterBackend* writer, const QString &fileExtension);
51 static void unregisterWriter(GeoWriterBackend* writer, const QString &fileExtension);
52
53private:
54 static QString determineDocumentIdentifier(const QString &filename);
56};
57
58}
59
60#endif
Write GeoDataDocument content to I/O devices (e.g.
A container for Features, Styles and in the future Schemas.
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 Tue Mar 26 2024 11:18:17 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.