Skip to content

Commit

Permalink
Add a convenience constructor from QString to QgsSearchString
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13944 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Jul 20, 2010
1 parent ac8383e commit fef94ad
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
4 changes: 4 additions & 0 deletions python/core/qgssearchstring.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down
11 changes: 9 additions & 2 deletions src/core/qgssearchstring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ QgsSearchString::QgsSearchString()
mTree = NULL;
}

QgsSearchString::QgsSearchString( const QString & str )
{
mTree = NULL;
setString( str );
}

QgsSearchString::QgsSearchString( const QgsSearchString& str )
{
Expand Down Expand Up @@ -62,8 +67,10 @@ QgsSearchString::~QgsSearchString()

bool QgsSearchString::setString( QString str )
{
mParserErrorMsg.clear();

// empty string
if ( str == "" )
if ( str.isEmpty() )
{
clear();
return true;
Expand Down Expand Up @@ -107,5 +114,5 @@ void QgsSearchString::clear()
{
delete mTree;
mTree = NULL;
mString = "";
mString.clear();
}
6 changes: 5 additions & 1 deletion src/core/qgssearchstring.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down

0 comments on commit fef94ad

Please sign in to comment.