Qt 4.4: QScriptString Class Reference

|  | Home · All Classes · Main Classes · Grouped Classes · Modules · Functions |

# QScriptString Class Reference
[QtScript module]

The QScriptString class acts as a handle to "interned" strings in a QScriptEngine. More...

     #include <QScriptString>

This class was introduced in Qt 4.4.

- List of all members, including inherited members

### Public Functions

- QScriptString ()
- QScriptString ( const QScriptString & other )
- ~QScriptString ()
- bool isValid () const
- QString toString () const
- operator QString () const
- bool operator!= ( const QScriptString & other ) const
- QScriptString & operator= ( const QScriptString & other )
- bool operator== ( const QScriptString & other ) const

## Detailed Description

The QScriptString class acts as a handle to "interned" strings in a QScriptEngine.

QScriptString can be used to achieve faster (repeated) property getting/setting, and comparison of property names, of script objects.

To get a QScriptString representation of a string, pass the string to QScriptEngine::toStringHandle(). The typical usage pattern is to register one or more pre-defined strings when setting up your script environment, then subsequently use the relevant QScriptString as argument to e.g. QScriptValue::property().

Call the toString() function to obtain the string that a QScriptString represents.

## Member Function Documentation

### QScriptString::QScriptString ()

Constructs an invalid QScriptString.

### QScriptString::QScriptString ( const QScriptString & other )

Constructs a new QScriptString that is a copy of other.

### QScriptString::~QScriptString ()

Destroys this QScriptString.

### bool QScriptString::isValid () const

Returns true if this QScriptString is valid; otherwise returns false.

### QString QScriptString::toString () const

Returns the string that this QScriptString represents, or a null string if this QScriptString is not valid.

See also isValid().

### QScriptString::operator QString () const

Returns the string that this QScriptString represents, or a null string if this QScriptString is not valid.

See also toString().

### bool QScriptString::operator!= ( const QScriptString & other ) const

Returns true if this QScriptString is not equal to other; otherwise returns false.

### QScriptString & QScriptString::operator= ( const QScriptString & other )

Assigns the other value to this QScriptString.

### bool QScriptString::operator== ( const QScriptString & other ) const

Returns true if this QScriptString is equal to other; otherwise returns false.