Qt 4.8
|
The QScriptString class acts as a handle to "interned" strings in a QScriptEngine. More...
#include <qscriptstring.h>
Public Functions | |
bool | isValid () const |
Returns true if this QScriptString is valid; otherwise returns false. More... | |
operator QString () const | |
Returns the string that this QScriptString represents, or a null string if this QScriptString is not valid. More... | |
bool | operator!= (const QScriptString &other) const |
Returns true if this QScriptString is not equal to other; otherwise returns false. More... | |
QScriptString & | operator= (const QScriptString &other) |
Assigns the other value to this QScriptString. More... | |
bool | operator== (const QScriptString &other) const |
Returns true if this QScriptString is equal to other; otherwise returns false. More... | |
QScriptString () | |
Constructs an invalid QScriptString. More... | |
QScriptString (const QScriptString &other) | |
Constructs a new QScriptString that is a copy of other. More... | |
quint32 | toArrayIndex (bool *ok=0) const |
QString | toString () const |
Returns the string that this QScriptString represents, or a null string if this QScriptString is not valid. More... | |
~QScriptString () | |
Destroys this QScriptString. More... | |
Properties | |
QExplicitlySharedDataPointer< QScriptStringPrivate > | d_ptr |
Friends | |
class | QScriptValue |
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.
Call the toArrayIndex() function to convert a QScriptString to an array index. This is useful when using QScriptClass to implement array-like objects.
Definition at line 38 of file qscriptstring.h.
QScriptString::QScriptString | ( | ) |
Constructs an invalid QScriptString.
Definition at line 65 of file qscriptstring.cpp.
QScriptString::QScriptString | ( | const QScriptString & | other | ) |
Constructs a new QScriptString that is a copy of other.
Definition at line 73 of file qscriptstring.cpp.
QScriptString::~QScriptString | ( | ) |
Destroys this QScriptString.
Definition at line 88 of file qscriptstring.cpp.
bool QScriptString::isValid | ( | ) | const |
Returns true if this QScriptString is valid; otherwise returns false.
Definition at line 133 of file qscriptstring.cpp.
QScriptString::operator QString | ( | ) | const |
Returns the string that this QScriptString represents, or a null string if this QScriptString is not valid.
Definition at line 204 of file qscriptstring.cpp.
bool QScriptString::operator!= | ( | const QScriptString & | other | ) | const |
Returns true if this QScriptString is not equal to other; otherwise returns false.
Definition at line 154 of file qscriptstring.cpp.
QScriptString & QScriptString::operator= | ( | const QScriptString & | other | ) |
Assigns the other value to this QScriptString.
Definition at line 112 of file qscriptstring.cpp.
bool QScriptString::operator== | ( | const QScriptString & | other | ) | const |
Returns true if this QScriptString is equal to other; otherwise returns false.
Definition at line 142 of file qscriptstring.cpp.
Referenced by operator!=().
quint32 QScriptString::toArrayIndex | ( | bool * | ok = 0 | ) | const |
Attempts to convert this QScriptString to a QtScript array index, and returns the result.
If a conversion error occurs, *{ok} is set to false; otherwise {ok} is set to true.
Definition at line 168 of file qscriptstring.cpp.
QString QScriptString::toString | ( | ) | const |
Returns the string that this QScriptString represents, or a null string if this QScriptString is not valid.
Definition at line 190 of file qscriptstring.cpp.
Referenced by QScript::ClassObjectDelegate::getOwnPropertyNames(), operator QString(), NamedNodeMapClass::queryProperty(), NodeListClass::queryProperty(), QDeclarativeGlobalScriptClass::setProperty(), and QScriptValue::setProperty().
|
friend |
Definition at line 59 of file qscriptstring.h.
|
private |
Definition at line 58 of file qscriptstring.h.
Referenced by QScriptStringPrivate::init(), QScriptStringPrivate::isValid(), operator=(), QScriptValue::property(), QScriptValue::propertyFlags(), QScriptString(), and QScriptValue::setProperty().