[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdeedu/marble/src/lib/geodata/parser
From:       Andrew Manson <g.real.ate () gmail ! com>
Date:       2009-07-23 10:48:38
Message-ID: 1248346118.265385.14915.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1001459 by mansona:

Changing the name of the GeoParser isValidDocumentElement for more readable 
API and also adding some documentation. 


 M  +3 -3      GeoDataParser.cpp  
 M  +2 -2      GeoDataParser.h  
 M  +1 -1      GeoOnfParser.cpp  
 M  +1 -1      GeoOnfParser.h  
 M  +4 -4      GeoParser.cpp  
 M  +10 -3     GeoParser.h  
 M  +3 -3      GeoSceneParser.cpp  
 M  +2 -2      GeoSceneParser.h  


--- trunk/KDE/kdeedu/marble/src/lib/geodata/parser/GeoDataParser.cpp #1001458:1001459
@@ -53,7 +53,7 @@
 {
 }
 
-bool GeoDataParser::isValidDocumentElement() const
+bool GeoDataParser::isValidRootElement() const
 {
     switch ((GeoDataSourceType) m_source) {
     // TODO: case GeoData_GeoRSS:
@@ -70,7 +70,7 @@
     }
 }
 
-void GeoDataParser::raiseDocumentElementError()
+void GeoDataParser::raiseRootElementError()
 {
     switch ((GeoDataSourceType) m_source) {
     // TODO: case GeoData_GeoRSS:
@@ -81,7 +81,7 @@
         raiseError(QObject::tr("The file is not a valid KML 2.0 / 2.1 / 2.2 file"));
         break;
     default:
-        GeoParser::raiseDocumentElementError();
+        GeoParser::raiseRootElementError();
         break;
     }
 }
--- trunk/KDE/kdeedu/marble/src/lib/geodata/parser/GeoDataParser.h #1001458:1001459
@@ -45,8 +45,8 @@
 
 private:
     virtual bool isValidElement(const QString& tagName) const;
-    virtual bool isValidDocumentElement() const;
-    virtual void raiseDocumentElementError();
+    virtual bool isValidRootElement() const;
+    virtual void raiseRootElementError();
 
     virtual GeoDocument* createDocument() const;
 };
--- trunk/KDE/kdeedu/marble/src/lib/geodata/parser/GeoOnfParser.cpp #1001458:1001459
@@ -33,7 +33,7 @@
     setNamespaceProcessing( false );
 }
 
-bool GeoOnfParser::isValidDocumentElement() const
+bool GeoOnfParser::isValidRootElement() const
 {
     return isValidElement( OsmNamefinder::tag_searchresults );
 }
--- trunk/KDE/kdeedu/marble/src/lib/geodata/parser/GeoOnfParser.h #1001458:1001459
@@ -34,7 +34,7 @@
     GeoOnfParser();
 
 private:
-    bool isValidDocumentElement() const;
+    bool isValidRootElement() const;
     GeoDocument* createDocument() const;
     bool isValidElement(const QString& tagName) const;
 };
--- trunk/KDE/kdeedu/marble/src/lib/geodata/parser/GeoParser.cpp #1001458:1001459
@@ -86,7 +86,7 @@
         readNext();
 
         if ( isStartElement() ) {
-            if ( isValidDocumentElement() ) {
+            if ( isValidRootElement() ) {
 #if DUMP_PARENT_STACK > 0
                 dumpParentStack( name().toString(), m_nodeStack.size(), false );
 #endif
@@ -98,7 +98,7 @@
                         QObject::tr("Parsing failed. Still %n unclosed tag(s) after document end.", "",
                         m_nodeStack.size() ) + errorString());
             } else
-                raiseDocumentElementError();
+                raiseRootElementError();
         }
     }
 
@@ -141,7 +141,7 @@
             raiseWarning( QString( "%1: %2" ).arg( error() ).arg( errorString() ) );
 
         if ( isEndElement() ) {
-            if ( !isValidDocumentElement() )
+            if ( !isValidRootElement() )
                 m_nodeStack.pop();
 
 #if DUMP_PARENT_STACK > 0
@@ -190,7 +190,7 @@
     }
 }
 
-void GeoParser::raiseDocumentElementError()
+void GeoParser::raiseRootElementError()
 {
     raiseError( QObject::tr( "File format unrecognized" ));
 }
--- trunk/KDE/kdeedu/marble/src/lib/geodata/parser/GeoParser.h #1001458:1001459
@@ -67,10 +67,17 @@
     QString attribute( const char* attributeName ) const;
 
 protected:
-    // To be implemented by GeoDataParser/GeoSceneParser
-    virtual bool isValidDocumentElement() const = 0;
-    virtual void raiseDocumentElementError();
+    /**
+     * This method is intended to check if the current element being served by
+     * the GeoParser is a valid Document Root element. This method is to be
+     * implemented by GeoDataParser/GeoSceneParser and must check based on the
+     * current XML Document type, e.g. KML, GPX etc.
+     * @return @c true if the element is a valid document root.
+     */
+    virtual bool isValidRootElement() const = 0;
 
+    virtual void raiseRootElementError();
+
     virtual GeoDocument* createDocument() const = 0;
 
 protected:
--- trunk/KDE/kdeedu/marble/src/lib/geodata/parser/GeoSceneParser.cpp #1001458:1001459
@@ -46,7 +46,7 @@
 {
 }
 
-bool GeoSceneParser::isValidDocumentElement() const
+bool GeoSceneParser::isValidRootElement() const
 {
     switch ((GeoSceneSourceType) m_source) {
     case GeoScene_DGML:
@@ -57,13 +57,13 @@
     }
 }
 
-void GeoSceneParser::raiseDocumentElementError()
+void GeoSceneParser::raiseRootElementError()
 {
     switch ((GeoSceneSourceType) m_source) {
     case GeoScene_DGML:
         raiseError(QObject::tr("The file is not a valid DGML 2.0 file"));
     default:
-        GeoParser::raiseDocumentElementError();
+        GeoParser::raiseRootElementError();
         break;
     }
 }
--- trunk/KDE/kdeedu/marble/src/lib/geodata/parser/GeoSceneParser.h #1001458:1001459
@@ -42,8 +42,8 @@
 
 private:
     virtual bool isValidElement(const QString& tagName) const;
-    virtual bool isValidDocumentElement() const;
-    virtual void raiseDocumentElementError();
+    virtual bool isValidRootElement() const;
+    virtual void raiseRootElementError();
 
     virtual GeoDocument* createDocument() const;
 };
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic