[QGIS Commit] r14154 - trunk/qgis/src/core

svn_qgis at osgeo.org svn_qgis at osgeo.org
Fri Aug 27 07:37:20 EDT 2010


Author: jef
Date: 2010-08-27 11:37:20 +0000 (Fri, 27 Aug 2010)
New Revision: 14154

Modified:
   trunk/qgis/src/core/qgssearchstringlexer.ll
   trunk/qgis/src/core/qgssearchtreenode.cpp
   trunk/qgis/src/core/qgssearchtreenode.h
Log:
add lower/upper support to search string (fixes #2970)

Modified: trunk/qgis/src/core/qgssearchstringlexer.ll
===================================================================
--- trunk/qgis/src/core/qgssearchstringlexer.ll	2010-08-26 20:02:27 UTC (rev 14153)
+++ trunk/qgis/src/core/qgssearchstringlexer.ll	2010-08-27 11:37:20 UTC (rev 14154)
@@ -91,6 +91,8 @@
 "to int" { yylval.op = QgsSearchTreeNode::opTOINT; return FUNCTION;}
 "to real" { yylval.op = QgsSearchTreeNode::opTOREAL; return FUNCTION;}
 "to string" { yylval.op = QgsSearchTreeNode::opTOSTRING; return FUNCTION;}
+"lower" { yylval.op = QgsSearchTreeNode::opLOWER; return FUNCTION;}
+"upper" { yylval.op = QgsSearchTreeNode::opUPPER; return FUNCTION;}
 
 "||"   { return CONCAT; }
 

Modified: trunk/qgis/src/core/qgssearchtreenode.cpp
===================================================================
--- trunk/qgis/src/core/qgssearchtreenode.cpp	2010-08-26 20:02:27 UTC (rev 14153)
+++ trunk/qgis/src/core/qgssearchtreenode.cpp	2010-08-27 11:37:20 UTC (rev 14154)
@@ -192,7 +192,8 @@
   {
     if ( mOp == opSQRT || mOp == opSIN || mOp == opCOS || mOp == opTAN ||
          mOp == opASIN || mOp == opACOS || mOp == opATAN ||
-         mOp == opTOINT || mOp == opTOREAL || mOp == opTOSTRING )
+         mOp == opTOINT || mOp == opTOREAL || mOp == opTOSTRING ||
+         mOp == opLOWER || mOp == opUPPER )
     {
       // functions
       switch ( mOp )
@@ -207,6 +208,8 @@
         case opTOINT: str += "to int"; break;
         case opTOREAL: str += "to real"; break;
         case opTOSTRING: str += "to string"; break;
+        case opLOWER: str += "lower"; break;
+        case opUPPER: str += "upper"; break;
         default: str += "?";
       }
       // currently all functions take one parameter
@@ -672,6 +675,10 @@
           return QgsSearchTreeValue( val1 );
         case opTOSTRING:
           return QgsSearchTreeValue( QString::number( val1 ) );
+        case opLOWER:
+          return QgsSearchTreeValue( value1.string().toLower() );
+        case opUPPER:
+          return QgsSearchTreeValue( value1.string().toUpper() );
       }
     }
 

Modified: trunk/qgis/src/core/qgssearchtreenode.h
===================================================================
--- trunk/qgis/src/core/qgssearchtreenode.h	2010-08-26 20:02:27 UTC (rev 14153)
+++ trunk/qgis/src/core/qgssearchtreenode.h	2010-08-27 11:37:20 UTC (rev 14154)
@@ -96,6 +96,8 @@
 
       // string handling
       opCONCAT,
+      opLOWER,
+      opUPPER,
 
       opROWNUM
     };



More information about the QGIS-commit mailing list