1 /****************************************************************************
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
7 ** This file is part of the QtSCriptTools module of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** No Commercial Usage
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
16 ** GNU Lesser General Public License Usage
17 ** Alternatively, this file may be used under the terms of the GNU Lesser
18 ** General Public License version 2.1 as published by the Free Software
19 ** Foundation and appearing in the file LICENSE.LGPL included in the
20 ** packaging of this file. Please review the following information to
21 ** ensure the GNU Lesser General Public License version 2.1 requirements
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 ** In addition, as a special exception, Nokia gives you certain additional
25 ** rights. These rights are described in the Nokia Qt LGPL Exception
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
40 ****************************************************************************/
42 #include "qscriptdebuggervalueproperty_p.h"
43 #include "qscriptdebuggervalue_p.h"
45 #include <QtCore/qatomic.h>
46 #include <QtCore/qdatastream.h>
47 #include <QtCore/qstring.h>
53 \class QScriptDebuggerValueProperty
56 class QScriptDebuggerValuePropertyPrivate
59 QScriptDebuggerValuePropertyPrivate();
60 ~QScriptDebuggerValuePropertyPrivate();
63 QScriptDebuggerValue value
;
64 QString valueAsString
;
65 QScriptValue::PropertyFlags flags
;
70 QScriptDebuggerValuePropertyPrivate::QScriptDebuggerValuePropertyPrivate()
75 QScriptDebuggerValuePropertyPrivate::~QScriptDebuggerValuePropertyPrivate()
80 Constructs an invalid QScriptDebuggerValueProperty.
82 QScriptDebuggerValueProperty::QScriptDebuggerValueProperty()
88 Constructs a QScriptDebuggerValueProperty with the given \a name,
89 \a value and \a flags.
91 QScriptDebuggerValueProperty::QScriptDebuggerValueProperty(const QString
&name
,
92 const QScriptDebuggerValue
&value
,
93 const QString
&valueAsString
,
94 QScriptValue::PropertyFlags flags
)
95 : d_ptr(new QScriptDebuggerValuePropertyPrivate
)
99 d_ptr
->valueAsString
= valueAsString
;
100 d_ptr
->flags
= flags
;
105 Constructs a QScriptDebuggerValueProperty that is a copy of the \a other property.
107 QScriptDebuggerValueProperty::QScriptDebuggerValueProperty(const QScriptDebuggerValueProperty
&other
)
115 Destroys this QScriptDebuggerValueProperty.
117 QScriptDebuggerValueProperty::~QScriptDebuggerValueProperty()
119 if (d_ptr
&& !d_ptr
->ref
.deref()) {
126 Assigns the \a other property to this QScriptDebuggerValueProperty.
128 QScriptDebuggerValueProperty
&QScriptDebuggerValueProperty::operator=(const QScriptDebuggerValueProperty
&other
)
130 if (d_ptr
== other
.d_ptr
)
132 if (d_ptr
&& !d_ptr
->ref
.deref())
141 Returns the name of this QScriptDebuggerValueProperty.
143 QString
QScriptDebuggerValueProperty::name() const
145 Q_D(const QScriptDebuggerValueProperty
);
152 Returns the value of this QScriptDebuggerValueProperty.
154 QScriptDebuggerValue
QScriptDebuggerValueProperty::value() const
156 Q_D(const QScriptDebuggerValueProperty
);
158 return QScriptDebuggerValue();
162 QString
QScriptDebuggerValueProperty::valueAsString() const
164 Q_D(const QScriptDebuggerValueProperty
);
167 return d
->valueAsString
;
171 Returns the flags of this QScriptDebuggerValueProperty.
173 QScriptValue::PropertyFlags
QScriptDebuggerValueProperty::flags() const
175 Q_D(const QScriptDebuggerValueProperty
);
182 Returns true if this QScriptDebuggerValueProperty is valid, otherwise
185 bool QScriptDebuggerValueProperty::isValid() const
187 Q_D(const QScriptDebuggerValueProperty
);
192 \fn QDataStream &operator<<(QDataStream &stream, const QScriptDebuggerValueProperty &property)
193 \relates QScriptDebuggerValueProperty
195 Writes the given \a property to the specified \a stream.
197 QDataStream
&operator<<(QDataStream
&out
, const QScriptDebuggerValueProperty
&property
)
199 out
<< property
.name();
200 out
<< property
.value();
201 out
<< property
.valueAsString();
202 out
<< (quint32
)property
.flags();
207 \fn QDataStream &operator>>(QDataStream &stream, QScriptDebuggerValueProperty &property)
208 \relates QScriptDebuggerValueProperty
210 Reads a QScriptDebuggerValueProperty from the specified \a stream into the
213 QDataStream
&operator>>(QDataStream
&in
, QScriptDebuggerValueProperty
&property
)
216 QScriptDebuggerValue value
;
217 QString valueAsString
;
223 property
= QScriptDebuggerValueProperty(
224 name
, value
, valueAsString
, QScriptValue::PropertyFlags(flags
));