[geos-commits] r2999 - in trunk: src/io tests/unit/io

svn_geos at osgeo.org svn_geos at osgeo.org
Tue Jun 1 11:15:04 EDT 2010


Author: warmerdam
Date: 2010-06-01 11:15:03 -0400 (Tue, 01 Jun 2010)
New Revision: 2999

Modified:
   trunk/src/io/WKTReader.cpp
   trunk/tests/unit/io/WKTReaderTest.cpp
Log:
make WKTReader keywords case insensitive

Modified: trunk/src/io/WKTReader.cpp
===================================================================
--- trunk/src/io/WKTReader.cpp	2010-05-31 16:25:57 UTC (rev 2998)
+++ trunk/src/io/WKTReader.cpp	2010-06-01 15:15:03 UTC (rev 2999)
@@ -199,7 +199,16 @@
 		case StringTokenizer::TT_NUMBER:
 			throw  ParseException("Expected word but encountered number", tokenizer->getNVal());
 		case StringTokenizer::TT_WORD:
-			return tokenizer->getSVal();
+        {
+            string word = tokenizer->getSVal();
+            int i = word.size();
+
+            while( --i >= 0 )
+            {
+                word[i] = toupper(word[i]);
+            }
+			return word;
+        }
 		case '(':
 			return "(";
 		case ')':

Modified: trunk/tests/unit/io/WKTReaderTest.cpp
===================================================================
--- trunk/tests/unit/io/WKTReaderTest.cpp	2010-05-31 16:25:57 UTC (rev 2998)
+++ trunk/tests/unit/io/WKTReaderTest.cpp	2010-06-01 15:15:03 UTC (rev 2999)
@@ -109,6 +109,16 @@
             delete coords;
     }
 
+	// 5 - Check support for mixed case keywords (and old style 3D)
+	template<>
+	template<>
+	void object::test<5>()
+	{         
+            GeomPtr geom(wktreader.read("LineString (-117 33 2, -116 34 4)"));
+            ensure_equals( wktwriter.write(geom.get()), 
+                           std::string("LINESTRING Z (-117.0 33.0 2.0, -116.0 34.0 4.0)") );
+    }
+
 } // namespace tut
 
 



More information about the geos-commits mailing list