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

marble

  • sources
  • kde-4.14
  • kdeedu
  • marble
  • src
  • lib
  • marble
  • geodata
  • handlers
  • dgml
DgmlLicenseTagHandler.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 (C) 2012 Illya Kovalevskyy <illya.kovalevskyy@gmail.com>
9 //
10 
11 #include "DgmlLicenseTagHandler.h"
12 #include "GeoSceneLicense.h"
13 
14 #include "DgmlElementDictionary.h"
15 #include "DgmlAttributeDictionary.h"
16 #include "GeoParser.h"
17 #include "GeoSceneHead.h"
18 #include "MarbleDebug.h"
19 
20 namespace Marble
21 {
22 namespace dgml
23 {
24 DGML_DEFINE_TAG_HANDLER(License)
25 
26 GeoNode* DgmlLicenseTagHandler::parse( GeoParser& parser ) const
27 {
28  // Check whether the tag is valid
29  Q_ASSERT( parser.isStartElement() && parser.isValidElement( dgmlTag_License ) );
30 
31  GeoStackItem parentItem = parser.parentElement();
32  if( parentItem.represents( dgmlTag_Head ) ) {
33  QString const attribution = parser.attribute(dgmlAttr_attribution).trimmed().toLower();
34  if ( attribution == "never" ) {
35  parentItem.nodeAs<GeoSceneHead>()->license()->setAttribution( GeoSceneLicense::Never );
36  } else if( attribution == "opt-in" || attribution == "optin" ) {
37  parentItem.nodeAs<GeoSceneHead>()->license()->setAttribution( GeoSceneLicense::OptIn );
38  } else if( attribution.isEmpty() || attribution == "opt-out" || attribution == "optout" ) {
39  parentItem.nodeAs<GeoSceneHead>()->license()->setAttribution( GeoSceneLicense::OptOut );
40  } else if ( attribution == "always" ) {
41  parentItem.nodeAs<GeoSceneHead>()->license()->setAttribution( GeoSceneLicense::Always );
42  } else {
43  mDebug() << "Unknown license attribution value " << attribution << ", falling back to 'opt-out'.";
44  parentItem.nodeAs<GeoSceneHead>()->license()->setAttribution( GeoSceneLicense::OptOut );
45  }
46  QString const shortLicense = parser.attribute( dgmlAttr_short ).trimmed();
47  parentItem.nodeAs<GeoSceneHead>()->license()->setShortLicense( shortLicense );
48  QString const fullLicense = parser.readElementText().trimmed();
49  parentItem.nodeAs<GeoSceneHead>()->license()->setLicense( fullLicense );
50  }
51 
52  return 0;
53 }
54 
55 }
56 }
GeoSceneHead.h
DgmlAttributeDictionary.h
DGML_DEFINE_TAG_HANDLER
#define DGML_DEFINE_TAG_HANDLER(Name)
Definition: DgmlElementDictionary.h:85
Marble::GeoSceneHead
General properties and identifiers of a GeoScene document.
Definition: GeoSceneHead.h:42
Marble::dgml::dgmlTag_Head
const char * dgmlTag_Head
Definition: DgmlElementDictionary.cpp:48
Marble::dgml::dgmlAttr_short
const char * dgmlAttr_short
Definition: DgmlAttributeDictionary.cpp:65
Marble::GeoNode
A shared base class for all classes that are mapped to a specific tag (ie.
Definition: GeoDocument.h:60
GeoParser.h
MarbleDebug.h
Marble::GeoParser
Definition: GeoParser.h:40
QString::isEmpty
bool isEmpty() const
QString::trimmed
QString trimmed() const
DgmlElementDictionary.h
Marble::GeoStackItem
Definition: GeoParser.h:97
QString
QString::toLower
QString toLower() const
Marble::GeoSceneLicense::OptOut
Definition: GeoSceneLicense.h:28
Marble::dgml::DgmlLicenseTagHandler
Definition: DgmlLicenseTagHandler.h:21
Marble::dgml::dgmlTag_License
const char * dgmlTag_License
Definition: DgmlElementDictionary.cpp:55
Marble::GeoSceneLicense::Always
Definition: GeoSceneLicense.h:30
Marble::dgml::dgmlAttr_attribution
const char * dgmlAttr_attribution
Definition: DgmlAttributeDictionary.cpp:35
DgmlLicenseTagHandler.h
GeoSceneLicense.h
Marble::mDebug
QDebug mDebug()
a function to replace qDebug() in Marble library code
Definition: MarbleDebug.cpp:36
Marble::GeoSceneLicense::Never
Definition: GeoSceneLicense.h:27
Marble::GeoSceneLicense::OptIn
Definition: GeoSceneLicense.h:29
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:38 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
  • 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