Marble

DgmlAvailableTagHandler.cpp
1 /*
2  SPDX-FileCopyrightText: 2008 Nikolas Zimmermann <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #include "DgmlAvailableTagHandler.h"
8 
9 #include "MarbleDebug.h"
10 
11 #include "DgmlElementDictionary.h"
12 #include "DgmlAuxillaryDictionary.h"
13 #include "GeoParser.h"
14 #include "GeoSceneProperty.h"
15 
16 namespace Marble
17 {
18 namespace dgml
19 {
20 DGML_DEFINE_TAG_HANDLER(Available)
21 
22 GeoNode* DgmlAvailableTagHandler::parse(GeoParser& parser) const
23 {
24  // Check whether the tag is valid
25  Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1String(dgmlTag_Available)));
26 
27  // Checking for parent item
28  GeoStackItem parentItem = parser.parentElement();
29  if (parentItem.represents(dgmlTag_Property)) {
30  QString parsedText = parser.readElementText().toLower().trimmed();
31  parentItem.nodeAs<GeoSceneProperty>()->setAvailable(parsedText == dgmlValue_true || parsedText == dgmlValue_on);
32  }
33 
34  return nullptr;
35 }
36 
37 }
38 }
QString trimmed() const const
Binds a QML item to a specific geodetic location in screen coordinates.
QString toLower() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Oct 2 2023 03:52:07 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.