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 "KmlElementDictionary.h"
10
11#include "GeoDataFeature.h"
12#include "GeoParser.h"
13
14namespace Marble
15{
16namespace kml
17{
18KML_DEFINE_TAG_HANDLER(description)
19
20GeoNode *KmldescriptionTagHandler::parse(GeoParser &parser) const
21{
22 Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1StringView(kmlTag_description)));
23
24 GeoStackItem parentItem = parser.parentElement();
25
26 if (parentItem.is<GeoDataFeature>()) {
27 QString result;
28 bool finished = false;
29 bool isCDATA = false;
30 while (!finished) {
31 switch (parser.readNext()) {
34 result.append(parser.text());
35 if (parser.isCDATA()) {
36 isCDATA = true;
37 }
38 break;
39 }
41 finished = true;
42 break;
45 break;
46 default:
47 finished = true;
48 break;
49 }
50 }
51
52 QString description = result.trimmed();
53
54 parentItem.nodeAs<GeoDataFeature>()->setDescription(description);
55 parentItem.nodeAs<GeoDataFeature>()->setDescriptionCDATA(isCDATA);
56 }
57
58 return nullptr;
59}
60
61}
62}
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 Mon Nov 4 2024 16:37:03 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.