Add a convenience constructor from QString to QgsSearchString

git-svn-id: http://svn.osgeo.org/qgis/trunk@13944 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
wonder 2010-07-20 13:21:04 +00:00
parent 50734ac052
commit e9828f8ef3
3 changed files with 18 additions and 3 deletions

View File

@ -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 );

View File

@ -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();
}

View File

@ -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 );