Marble

KmlDescriptionTagHandler.cpp
1/*
2 SPDX-FileCopyrightText: 2008 Patrick Spendrin <ps_ml@gmx.de>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "KmlDescriptionTagHandler.h"
8
9#include "MarbleDebug.h"
10
11#include "KmlElementDictionary.h"
12
13#include "GeoDataFeature.h"
14#include "GeoParser.h"
15
16namespace Marble
17{
18namespace kml
19{
20KML_DEFINE_TAG_HANDLER( description )
21
22GeoNode* KmldescriptionTagHandler::parse( GeoParser& parser ) const
23{
24 Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1String(kmlTag_description)));
25
26 GeoStackItem parentItem = parser.parentElement();
27
28 if( parentItem.is<GeoDataFeature>() ) {
29
30 QString result;
31 bool finished = false;
32 bool isCDATA = false;
33 while( !finished ) {
34 switch ( parser.readNext() ) {
37 result.append( parser.text() );
38 if( parser.isCDATA() ) {
39 isCDATA = true;
40 }
41 break;
42 }
44 finished = true;
45 break;
48 break;
49 default:
50 finished = true;
51 break;
52 }
53 }
54
55 QString description = result.trimmed();
56
57 parentItem.nodeAs<GeoDataFeature>()->setDescription( description );
58 parentItem.nodeAs<GeoDataFeature>()->setDescriptionCDATA( isCDATA );
59 }
60
61 return nullptr;
62}
63
64}
65}
Binds a QML item to a specific geodetic location in screen coordinates.
QString & append(QChar ch)
QString trimmed() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jun 21 2024 12:00:07 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.