Marble

GeoTagWriter.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2009 Andrew Manson <g.real.ate@gmail.com>
4// SPDX-FileCopyrightText: 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
5//
6
7#include "GeoTagWriter.h"
8
9#include "GeoWriter.h"
10
11#include <QDebug>
12
13namespace Marble
14{
15
16GeoTagWriter::GeoTagWriter()
17{
18}
19
20GeoTagWriter::~GeoTagWriter()
21{
22}
23
24bool GeoTagWriter::writeElement( const GeoNode *object,
25 GeoWriter &writer)
26{
27 return writer.writeElement( object );
28}
29
30void GeoTagWriter::registerWriter(const QualifiedName& name,
31 const GeoTagWriter* writer )
32{
33 TagHash* tagHash = tagWriterHash();
34
35 if ( tagHash->contains( name ) ) {
36 qWarning() << "Warning: The tag" << name << "is already registered. Often this indicates that multiple versions of the marblewidget library are loaded at the same time. This will likely lead to problems. Please check your installation, especially internal Marble plugins and external applications that install Marble plugins.";
37 }
38 Q_ASSERT( !tagHash->contains( name ) );
39 tagHash->insert( name, writer );
40 Q_ASSERT( tagHash->contains( name ) );
41}
42
43void GeoTagWriter::unregisterWriter(const GeoTagWriter::QualifiedName &qName)
44{
45 auto hash = tagWriterHash();
46 Q_ASSERT(hash->contains(qName));
47 delete hash->value(qName);
48 hash->remove(qName);
49 Q_ASSERT(!hash->contains(qName));
50}
51
52GeoTagWriter::TagHash* GeoTagWriter::tagWriterHash()
53{
54 static TagHash s_tagWriterHash;
55 return &s_tagWriterHash;
56}
57
58const GeoTagWriter* GeoTagWriter::recognizes( const QualifiedName &qname )
59{
60 TagHash* hash = tagWriterHash();
61
62 if( !hash->contains( qname ) ) {
63 return nullptr;
64 }
65
66 return hash->value( qname );
67}
68
69}
QPair< QString, QString > QualifiedName
Object Name and Namespace Pair This type is intended to be used in a similar way to.
QString name(StandardShortcut id)
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.