diff --git a/python/core/qgssearchstring.sip b/python/core/qgssearchstring.sip index ef98df24e51..7f131f39751 100644 --- a/python/core/qgssearchstring.sip +++ b/python/core/qgssearchstring.sip @@ -9,6 +9,10 @@ class QgsSearchString //! 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 ); diff --git a/src/core/qgssearchstring.cpp b/src/core/qgssearchstring.cpp index 2393b815293..473c423b133 100644 --- a/src/core/qgssearchstring.cpp +++ b/src/core/qgssearchstring.cpp @@ -30,6 +30,11 @@ QgsSearchString::QgsSearchString() mTree = NULL; } +QgsSearchString::QgsSearchString( const QString & str ) +{ + mTree = NULL; + setString( str ); +} QgsSearchString::QgsSearchString( const QgsSearchString& str ) { @@ -62,8 +67,10 @@ QgsSearchString::~QgsSearchString() bool QgsSearchString::setString( QString str ) { + mParserErrorMsg.clear(); + // empty string - if ( str == "" ) + if ( str.isEmpty() ) { clear(); return true; @@ -107,5 +114,5 @@ void QgsSearchString::clear() { delete mTree; mTree = NULL; - mString = ""; + mString.clear(); } diff --git a/src/core/qgssearchstring.h b/src/core/qgssearchstring.h index 5a14c39a328..b32d9f9d91a 100644 --- a/src/core/qgssearchstring.h +++ b/src/core/qgssearchstring.h @@ -35,9 +35,13 @@ class QgsSearchTreeNode; 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 );