• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.12
  • kdeedu
  • marble
  • src
  • lib
  • marble
  • geodata
  • data
GeoDataExtendedData.cpp
Go to the documentation of this file.
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 2010 Harshit Jain <hjain.itbhu@gmail.com>
9 // Copyright 2011 Niko Sams <niko.sams@gmail.com>
10 //
11 
12 #include "GeoDataExtendedData.h"
13 #include "GeoDataExtendedData_p.h"
14 #include <QDataStream>
15 
16 #include "GeoDataTypes.h"
17 
18 namespace Marble
19 {
20 
21 GeoDataExtendedData::GeoDataExtendedData()
22  : GeoDataObject(), d( new GeoDataExtendedDataPrivate )
23 {
24 }
25 
26 GeoDataExtendedData::GeoDataExtendedData( const GeoDataExtendedData& other )
27  : GeoDataObject( other ), d( new GeoDataExtendedDataPrivate( *other.d ) )
28 {
29 }
30 
31 GeoDataExtendedData::~GeoDataExtendedData()
32 {
33  qDeleteAll( d->arrayHash );
34  delete d;
35 }
36 
37 GeoDataExtendedData& GeoDataExtendedData::operator=( const GeoDataExtendedData& other )
38 {
39  GeoDataObject::operator=( other );
40  *d = *other.d;
41  return *this;
42 }
43 
44 const char* GeoDataExtendedData::nodeType() const
45 {
46  return d->nodeType();
47 }
48 
49 GeoDataData& GeoDataExtendedData::valueRef( const QString& key ) const
50 {
51  return d->hash[ key ];
52 }
53 
54 GeoDataData GeoDataExtendedData::value( const QString& key ) const
55 {
56  return d->hash.value( key );
57 }
58 
59 void GeoDataExtendedData::addValue( const GeoDataData& data )
60 {
61  d->hash.insert( data.name(), data );
62 }
63 
64 QHash< QString, GeoDataData >::const_iterator GeoDataExtendedData::constBegin( ) const
65 {
66  return d->hash.constBegin();
67 }
68 
69 QHash< QString, GeoDataData >::const_iterator GeoDataExtendedData::constEnd( ) const
70 {
71  return d->hash.constEnd();
72 }
73 
74 int GeoDataExtendedData::size() const
75 {
76  return d->hash.size();
77 }
78 
79 bool GeoDataExtendedData::isEmpty( ) const
80 {
81  return d->hash.empty();
82 }
83 
84 bool GeoDataExtendedData::contains( const QString &key ) const
85 {
86  return d->hash.contains( key );
87 }
88 
89 void GeoDataExtendedData::setSimpleArrayData( const QString& key, GeoDataSimpleArrayData *values )
90 {
91  d->arrayHash[ key ] = values;
92 }
93 
94 GeoDataSimpleArrayData* GeoDataExtendedData::simpleArrayData( const QString& key ) const
95 {
96  if ( !d->arrayHash.contains( key ) ) return 0;
97  return d->arrayHash[ key ];
98 }
99 
100 void GeoDataExtendedData::pack( QDataStream& stream ) const
101 {
102  GeoDataObject::pack( stream );
103 }
104 
105 void GeoDataExtendedData::unpack( QDataStream& stream )
106 {
107  GeoDataObject::unpack( stream );
108 }
109 
110 }
GeoDataExtendedData_p.h
Marble::GeoDataExtendedDataPrivate::arrayHash
QHash< QString, GeoDataSimpleArrayData * > arrayHash
Definition: GeoDataExtendedData_p.h:35
Marble::GeoDataExtendedData::unpack
virtual void unpack(QDataStream &stream)
Unserialize the ExtendedData from a stream.
Definition: GeoDataExtendedData.cpp:105
Marble::GeoDataExtendedDataPrivate::hash
QHash< QString, GeoDataData > hash
Definition: GeoDataExtendedData_p.h:34
Marble::GeoDataExtendedData::pack
virtual void pack(QDataStream &stream) const
Serialize the ExtendedData to a stream.
Definition: GeoDataExtendedData.cpp:100
Marble::GeoDataObject
A base class for all geodata objects.
Definition: GeoDataObject.h:48
Marble::GeoDataExtendedData::valueRef
GeoDataData & valueRef(const QString &key) const
return value of GeoDataExtendedData object associated with the given key as a modifiable reference ...
Definition: GeoDataExtendedData.cpp:49
Marble::GeoDataExtendedData::nodeType
virtual const char * nodeType() const
Provides type information for downcasting a GeoNode.
Definition: GeoDataExtendedData.cpp:44
Marble::GeoDataObject::pack
virtual void pack(QDataStream &stream) const
Reimplemented from Serializable.
Definition: GeoDataObject.cpp:114
Marble::GeoDataExtendedData::~GeoDataExtendedData
virtual ~GeoDataExtendedData()
Definition: GeoDataExtendedData.cpp:31
GeoDataExtendedData.h
Marble::GeoDataExtendedData::constEnd
QHash< QString, GeoDataData >::const_iterator constEnd() const
return const End iterator for QHash
Definition: GeoDataExtendedData.cpp:69
Marble::GeoDataExtendedData
a class which allows to add custom data to KML Feature.
Definition: GeoDataExtendedData.h:35
Marble::GeoDataExtendedData::isEmpty
bool isEmpty() const
return wthethe QHash is empty or not
Definition: GeoDataExtendedData.cpp:79
Marble::GeoDataSimpleArrayData
Definition: GeoDataSimpleArrayData.h:22
Marble::GeoDataExtendedDataPrivate
Definition: GeoDataExtendedData_p.h:25
Marble::GeoDataExtendedData::operator=
GeoDataExtendedData & operator=(const GeoDataExtendedData &other)
assignment operator
Definition: GeoDataExtendedData.cpp:37
Marble::GeoDataExtendedData::size
int size() const
return size of QHash
Definition: GeoDataExtendedData.cpp:74
Marble::GeoDataExtendedData::value
GeoDataData value(const QString &key) const
return the value of GeoDataExtendedData associated with the given key
Definition: GeoDataExtendedData.cpp:54
Marble::GeoDataExtendedDataPrivate::nodeType
const char * nodeType() const
Definition: GeoDataExtendedData_p.h:29
Marble::GeoDataExtendedData::GeoDataExtendedData
GeoDataExtendedData()
Definition: GeoDataExtendedData.cpp:21
Marble::GeoDataExtendedData::simpleArrayData
GeoDataSimpleArrayData * simpleArrayData(const QString &key) const
return SimpleArrayData for given key, 0 pointer if none is set
Definition: GeoDataExtendedData.cpp:94
Marble::GeoDataData
Definition: GeoDataData.h:26
Marble::GeoDataExtendedData::addValue
void addValue(const GeoDataData &data)
add a data object to the GeoDataExtendedData with the key
Definition: GeoDataExtendedData.cpp:59
Marble::GeoDataObject::operator=
GeoDataObject & operator=(const GeoDataObject &)
Definition: GeoDataObject.cpp:54
Marble::GeoDataExtendedData::contains
bool contains(const QString &key) const
Returns true if there exists a value for the given key.
Definition: GeoDataExtendedData.cpp:84
Marble::GeoDataObject::unpack
virtual void unpack(QDataStream &steam)
Reimplemented from Serializable.
Definition: GeoDataObject.cpp:120
Marble::GeoDataExtendedData::setSimpleArrayData
void setSimpleArrayData(const QString &key, GeoDataSimpleArrayData *values)
set SimpleArrayData for given key
Definition: GeoDataExtendedData.cpp:89
Marble::GeoDataData::name
QString name() const
return the name of data
Definition: GeoDataData.cpp:65
GeoDataTypes.h
Marble::GeoDataExtendedData::constBegin
QHash< QString, GeoDataData >::const_iterator constBegin() const
return const Begin iterator for QHash
Definition: GeoDataExtendedData.cpp:64
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:38:49 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal