Marble

GeoWriter.h
1 //
2 // This file is part of the Marble Virtual Globe.
3 //
4 // This program is free software licensed under the GNU LGPL. You can
5 // find a copy of this license in LICENSE.txt in the top directory of
6 // the source code.
7 //
8 // Copyright 2009 Andrew Manson <[email protected]>
9 //
10 
11 #ifndef MARBLE_GEOWRITER_H
12 #define MARBLE_GEOWRITER_H
13 
14 #include "marble_export.h"
15 
16 #include <QXmlStreamWriter>
17 #include <QVariant>
18 
19 namespace Marble
20 {
21 
22 class GeoNode;
23 
30 class MARBLE_EXPORT GeoWriter : public QXmlStreamWriter
31 {
32 public:
33  GeoWriter();
34 
42  bool write( QIODevice* device, const GeoNode *feature);
43 
50  void setDocumentType( const QString& documentType );
51 
56  void writeElement( const QString &namespaceUri, const QString &key, const QString &value );
57 
62  void writeElement( const QString &key, const QString &value );
63 
69  void writeOptionalElement(const QString &key, const QString &value , const QString &defaultValue = QString() );
70 
75  void writeOptionalAttribute( const QString &key, const QString &value, const QString &defaultValue = QString() );
76 
77  template<class T>
78  void writeOptionalElement( const QString &key, const T &value , const T &defaultValue = T() )
79  {
80  if ( value != defaultValue ) {
81  writeElement( key, QVariant::fromValue( value ).toString() );
82  }
83  }
84 
85 private:
86  friend class GeoTagWriter;
87  friend class GeoDataDocumentWriter;
88  bool writeElement( const GeoNode* object );
89 
90 private:
91  QString m_documentType;
92 };
93 
94 }
95 
96 #endif
Binds a QML item to a specific geodetic location in screen coordinates.
A shared base class for all classes that are mapped to a specific tag (ie.
Definition: GeoDocument.h:49
Base class intended to be subclassed by specific XML tag writers This class provides a base class tha...
Definition: GeoTagWriter.h:32
Standard Marble way of writing XML This class is intended to be a standardised way of writing XML for...
Definition: GeoWriter.h:30
QVariant fromValue(const T &value)
Write GeoDataDocument content to I/O devices (e.g.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun Jul 5 2020 23:20:14 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.