]>
git.saurik.com Git - apple/javascriptcore.git/blob - qt/api/qscriptstring.cpp
2 Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
22 #include "qscriptstring.h"
24 #include "qscriptstring_p.h"
25 #include <QtCore/qhash.h>
28 Constructs an invalid QScriptString.
30 QScriptString::QScriptString()
31 : d_ptr(new QScriptStringPrivate())
35 Constructs an QScriptString from internal representation
38 QScriptString::QScriptString(QScriptStringPrivate
* d
)
44 Constructs a new QScriptString that is a copy of \a other.
46 QScriptString::QScriptString(const QScriptString
& other
)
52 Destroys this QScriptString.
54 QScriptString::~QScriptString()
59 Assigns the \a other value to this QScriptString.
61 QScriptString
& QScriptString::operator=(const QScriptString
& other
)
68 Returns true if this QScriptString is valid; otherwise
71 bool QScriptString::isValid() const
73 return d_ptr
->isValid();
77 Returns true if this QScriptString is equal to \a other;
78 otherwise returns false.
80 bool QScriptString::operator==(const QScriptString
& other
) const
82 return d_ptr
== other
.d_ptr
|| *d_ptr
== *(other
.d_ptr
);
86 Returns true if this QScriptString is not equal to \a other;
87 otherwise returns false.
89 bool QScriptString::operator!=(const QScriptString
& other
) const
91 return d_ptr
!= other
.d_ptr
|| *d_ptr
!= *(other
.d_ptr
);
95 Attempts to convert this QScriptString to a QtScript array index,
96 and returns the result.
98 If a conversion error occurs, *\a{ok} is set to false; otherwise
99 *\a{ok} is set to true.
101 quint32
QScriptString::toArrayIndex(bool* ok
) const
103 return d_ptr
->toArrayIndex(ok
);
107 Returns the string that this QScriptString represents, or a
108 null string if this QScriptString is not valid.
112 QString
QScriptString::toString() const
114 return d_ptr
->toString();
118 Returns the string that this QScriptString represents, or a
119 null string if this QScriptString is not valid.
123 QScriptString::operator QString() const
125 return d_ptr
->toString();
128 uint
qHash(const QScriptString
& key
)
130 return qHash(QScriptStringPrivate::get(key
)->id());