[QGIS Commit] r13944 - in trunk/qgis: python/core src/core

svn_qgis at osgeo.org svn_qgis at osgeo.org
Tue Jul 20 09:21:04 EDT 2010


Author: wonder
Date: 2010-07-20 13:21:04 +0000 (Tue, 20 Jul 2010)
New Revision: 13944

Modified:
   trunk/qgis/python/core/qgssearchstring.sip
   trunk/qgis/src/core/qgssearchstring.cpp
   trunk/qgis/src/core/qgssearchstring.h
Log:
Add a convenience constructor from QString to QgsSearchString


Modified: trunk/qgis/python/core/qgssearchstring.sip
===================================================================
--- trunk/qgis/python/core/qgssearchstring.sip	2010-07-20 13:06:49 UTC (rev 13943)
+++ trunk/qgis/python/core/qgssearchstring.sip	2010-07-20 13:21:04 UTC (rev 13944)
@@ -9,6 +9,10 @@
     //! constructor
     QgsSearchString();
 
+    //! construct and parse a string
+    //! @note added in v1.6
+    QgsSearchString( const QString & str );
+
     //! copy constructor - makes also copy of search tree
     QgsSearchString( const QgsSearchString& str );
 

Modified: trunk/qgis/src/core/qgssearchstring.cpp
===================================================================
--- trunk/qgis/src/core/qgssearchstring.cpp	2010-07-20 13:06:49 UTC (rev 13943)
+++ trunk/qgis/src/core/qgssearchstring.cpp	2010-07-20 13:21:04 UTC (rev 13944)
@@ -30,6 +30,11 @@
   mTree = NULL;
 }
 
+QgsSearchString::QgsSearchString( const QString & str )
+{
+  mTree = NULL;
+  setString( str );
+}
 
 QgsSearchString::QgsSearchString( const QgsSearchString& str )
 {
@@ -62,8 +67,10 @@
 
 bool QgsSearchString::setString( QString str )
 {
+  mParserErrorMsg.clear();
+
   // empty string
-  if ( str == "" )
+  if ( str.isEmpty() )
   {
     clear();
     return true;
@@ -107,5 +114,5 @@
 {
   delete mTree;
   mTree = NULL;
-  mString = "";
+  mString.clear();
 }

Modified: trunk/qgis/src/core/qgssearchstring.h
===================================================================
--- trunk/qgis/src/core/qgssearchstring.h	2010-07-20 13:06:49 UTC (rev 13943)
+++ trunk/qgis/src/core/qgssearchstring.h	2010-07-20 13:21:04 UTC (rev 13944)
@@ -35,9 +35,13 @@
 class CORE_EXPORT QgsSearchString
 {
   public:
-    //! constructor
+    //! construct an empty string
     QgsSearchString();
 
+    //! construct and parse a string
+    //! @note added in v1.6
+    QgsSearchString( const QString & str );
+
     //! copy constructor - makes also copy of search tree
     QgsSearchString( const QgsSearchString& str );
 



More information about the QGIS-commit mailing list