Skip to content

Commit fef94ad

Browse files
author
wonder
committed
Add a convenience constructor from QString to QgsSearchString
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13944 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent ac8383e commit fef94ad

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

python/core/qgssearchstring.sip

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ class QgsSearchString
99
//! constructor
1010
QgsSearchString();
1111

12+
//! construct and parse a string
13+
//! @note added in v1.6
14+
QgsSearchString( const QString & str );
15+
1216
//! copy constructor - makes also copy of search tree
1317
QgsSearchString( const QgsSearchString& str );
1418

src/core/qgssearchstring.cpp

+9-2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ QgsSearchString::QgsSearchString()
3030
mTree = NULL;
3131
}
3232

33+
QgsSearchString::QgsSearchString( const QString & str )
34+
{
35+
mTree = NULL;
36+
setString( str );
37+
}
3338

3439
QgsSearchString::QgsSearchString( const QgsSearchString& str )
3540
{
@@ -62,8 +67,10 @@ QgsSearchString::~QgsSearchString()
6267

6368
bool QgsSearchString::setString( QString str )
6469
{
70+
mParserErrorMsg.clear();
71+
6572
// empty string
66-
if ( str == "" )
73+
if ( str.isEmpty() )
6774
{
6875
clear();
6976
return true;
@@ -107,5 +114,5 @@ void QgsSearchString::clear()
107114
{
108115
delete mTree;
109116
mTree = NULL;
110-
mString = "";
117+
mString.clear();
111118
}

src/core/qgssearchstring.h

+5-1
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,13 @@ class QgsSearchTreeNode;
3535
class CORE_EXPORT QgsSearchString
3636
{
3737
public:
38-
//! constructor
38+
//! construct an empty string
3939
QgsSearchString();
4040

41+
//! construct and parse a string
42+
//! @note added in v1.6
43+
QgsSearchString( const QString & str );
44+
4145
//! copy constructor - makes also copy of search tree
4246
QgsSearchString( const QgsSearchString& str );
4347

0 commit comments

Comments
 (0)