Debugger: Fixing coding style issues
[profile/ivi/qtdeclarative.git] / src / declarative / debugger / qdeclarativeenginedebug_p.h
1 /****************************************************************************
2 **
3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
6 **
7 ** This file is part of the QtDeclarative module of the Qt Toolkit.
8 **
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser General Public
12 ** License version 2.1 as published by the Free Software Foundation and
13 ** appearing in the file LICENSE.LGPL included in the packaging of this
14 ** file. Please review the following information to ensure the GNU Lesser
15 ** General Public License version 2.1 requirements will be met:
16 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
17 **
18 ** In addition, as a special exception, Nokia gives you certain additional
19 ** rights. These rights are described in the Nokia Qt LGPL Exception
20 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
21 **
22 ** GNU General Public License Usage
23 ** Alternatively, this file may be used under the terms of the GNU General
24 ** Public License version 3.0 as published by the Free Software Foundation
25 ** and appearing in the file LICENSE.GPL included in the packaging of this
26 ** file. Please review the following information to ensure the GNU General
27 ** Public License version 3.0 requirements will be met:
28 ** http://www.gnu.org/copyleft/gpl.html.
29 **
30 ** Other Usage
31 ** Alternatively, this file may be used in accordance with the terms and
32 ** conditions contained in a signed written agreement between you and Nokia.
33 **
34 **
35 **
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41
42 #ifndef QDECLARATIVEENGINEDEBUG_H
43 #define QDECLARATIVEENGINEDEBUG_H
44
45 //
46 //  W A R N I N G
47 //  -------------
48 //
49 // This file is not part of the Qt API.  It exists purely as an
50 // implementation detail.  This header file may change from version to
51 // version without notice, or even be removed.
52 //
53 // We mean it.
54 //
55
56 #include <QtCore/qobject.h>
57 #include <QtCore/qurl.h>
58 #include <QtCore/qvariant.h>
59
60 #include <private/qdeclarativeglobal_p.h>
61
62 QT_BEGIN_HEADER
63
64 QT_BEGIN_NAMESPACE
65
66 QT_MODULE(Declarative)
67
68 class QDeclarativeDebugConnection;
69 class QDeclarativeDebugWatch;
70 class QDeclarativeDebugPropertyWatch;
71 class QDeclarativeDebugObjectExpressionWatch;
72 class QDeclarativeDebugEnginesQuery;
73 class QDeclarativeDebugRootContextQuery;
74 class QDeclarativeDebugObjectQuery;
75 class QDeclarativeDebugExpressionQuery;
76 class QDeclarativeDebugPropertyReference;
77 class QDeclarativeDebugContextReference;
78 class QDeclarativeDebugObjectReference;
79 class QDeclarativeDebugFileReference;
80 class QDeclarativeDebugEngineReference;
81 class QDeclarativeEngineDebugPrivate;
82 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeEngineDebug : public QObject
83 {
84     Q_OBJECT
85 public:
86     enum Status { NotConnected, Unavailable, Enabled };
87
88     explicit QDeclarativeEngineDebug(QDeclarativeDebugConnection *, QObject * = 0);
89     ~QDeclarativeEngineDebug();
90
91     Status status() const;
92
93     QDeclarativeDebugPropertyWatch *addWatch(const QDeclarativeDebugPropertyReference &,
94                                              QObject *parent = 0);
95     QDeclarativeDebugWatch *addWatch(const QDeclarativeDebugContextReference &, const QString &,
96                                      QObject *parent = 0);
97     QDeclarativeDebugObjectExpressionWatch *addWatch(const QDeclarativeDebugObjectReference &, const QString &,
98                                                      QObject *parent = 0);
99     QDeclarativeDebugWatch *addWatch(const QDeclarativeDebugObjectReference &,
100                                      QObject *parent = 0);
101     QDeclarativeDebugWatch *addWatch(const QDeclarativeDebugFileReference &,
102                                      QObject *parent = 0);
103
104     void removeWatch(QDeclarativeDebugWatch *watch);
105
106     QDeclarativeDebugEnginesQuery *queryAvailableEngines(QObject *parent = 0);
107     QDeclarativeDebugRootContextQuery *queryRootContexts(const QDeclarativeDebugEngineReference &,
108                                                          QObject *parent = 0);
109     QDeclarativeDebugObjectQuery *queryObject(const QDeclarativeDebugObjectReference &,
110                                               QObject *parent = 0);
111     QDeclarativeDebugObjectQuery *queryObjectRecursive(const QDeclarativeDebugObjectReference &,
112                                                        QObject *parent = 0);
113     QDeclarativeDebugExpressionQuery *queryExpressionResult(int objectDebugId,
114                                                             const QString &expr,
115                                                             QObject *parent = 0);
116     bool setBindingForObject(int objectDebugId, const QString &propertyName,
117                              const QVariant &bindingExpression, bool isLiteralValue,
118                              QString source = QString(), int line = -1);
119     bool resetBindingForObject(int objectDebugId, const QString &propertyName);
120     bool setMethodBody(int objectDebugId, const QString &methodName, const QString &methodBody);
121
122 Q_SIGNALS:
123     void newObjects();
124     void statusChanged(Status status);
125
126 private:
127     Q_DECLARE_PRIVATE(QDeclarativeEngineDebug)
128 };
129
130 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugWatch : public QObject
131 {
132     Q_OBJECT
133 public:
134     enum State { Waiting, Active, Inactive, Dead };
135
136     QDeclarativeDebugWatch(QObject *);
137     ~QDeclarativeDebugWatch();
138
139     int queryId() const;
140     int objectDebugId() const;
141     State state() const;
142
143 Q_SIGNALS:
144     void stateChanged(QDeclarativeDebugWatch::State);
145     //void objectChanged(int, const QDeclarativeDebugObjectReference &);
146     //void valueChanged(int, const QVariant &);
147
148     // Server sends value as string if it is a user-type variant
149     void valueChanged(const QByteArray &name, const QVariant &value);
150
151 private:
152     friend class QDeclarativeEngineDebug;
153     friend class QDeclarativeEngineDebugPrivate;
154     void setState(State);
155     State m_state;
156     int m_queryId;
157     QDeclarativeEngineDebug *m_client;
158     int m_objectDebugId;
159 };
160
161 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugPropertyWatch : public QDeclarativeDebugWatch
162 {
163     Q_OBJECT
164 public:
165     QDeclarativeDebugPropertyWatch(QObject *parent);
166
167     QString name() const;
168
169 private:
170     friend class QDeclarativeEngineDebug;
171     QString m_name;
172 };
173
174 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugObjectExpressionWatch : public QDeclarativeDebugWatch
175 {
176     Q_OBJECT
177 public:
178     QDeclarativeDebugObjectExpressionWatch(QObject *parent);
179
180     QString expression() const;
181
182 private:
183     friend class QDeclarativeEngineDebug;
184     QString m_expr;
185     int m_debugId;
186 };
187
188
189 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugQuery : public QObject
190 {
191     Q_OBJECT
192 public:
193     enum State { Waiting, Error, Completed };
194
195     State state() const;
196     bool isWaiting() const;
197
198 Q_SIGNALS:
199     void stateChanged(QDeclarativeDebugQuery::State);
200
201 protected:
202     QDeclarativeDebugQuery(QObject *);
203
204 private:
205     friend class QDeclarativeEngineDebug;
206     friend class QDeclarativeEngineDebugPrivate;
207     void setState(State);
208     State m_state;
209 };
210
211 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugFileReference 
212 {
213 public:
214     QDeclarativeDebugFileReference();
215     QDeclarativeDebugFileReference(const QDeclarativeDebugFileReference &);
216     QDeclarativeDebugFileReference &operator=(const QDeclarativeDebugFileReference &);
217
218     QUrl url() const;
219     void setUrl(const QUrl &);
220     int lineNumber() const;
221     void setLineNumber(int);
222     int columnNumber() const;
223     void setColumnNumber(int);
224
225 private:
226     friend class QDeclarativeEngineDebugPrivate;
227     QUrl m_url;
228     int m_lineNumber;
229     int m_columnNumber;
230 };
231
232 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugEngineReference
233 {
234 public:
235     QDeclarativeDebugEngineReference();
236     QDeclarativeDebugEngineReference(int);
237     QDeclarativeDebugEngineReference(const QDeclarativeDebugEngineReference &);
238     QDeclarativeDebugEngineReference &operator=(const QDeclarativeDebugEngineReference &);
239
240     int debugId() const;
241     QString name() const;
242
243 private:
244     friend class QDeclarativeEngineDebugPrivate;
245     int m_debugId;
246     QString m_name;
247 };
248
249 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugObjectReference
250 {
251 public:
252     QDeclarativeDebugObjectReference();
253     QDeclarativeDebugObjectReference(int);
254     QDeclarativeDebugObjectReference(const QDeclarativeDebugObjectReference &);
255     QDeclarativeDebugObjectReference &operator=(const QDeclarativeDebugObjectReference &);
256
257     int debugId() const;
258     QString className() const;
259     QString idString() const;
260     QString name() const;
261
262     QDeclarativeDebugFileReference source() const;
263     int contextDebugId() const;
264
265     QList<QDeclarativeDebugPropertyReference> properties() const;
266     QList<QDeclarativeDebugObjectReference> children() const;
267
268 private:
269     friend class QDeclarativeEngineDebugPrivate;
270     int m_debugId;
271     QString m_class;
272     QString m_idString;
273     QString m_name;
274     QDeclarativeDebugFileReference m_source;
275     int m_contextDebugId;
276     QList<QDeclarativeDebugPropertyReference> m_properties;
277     QList<QDeclarativeDebugObjectReference> m_children;
278 };
279
280 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugContextReference
281 {
282 public:
283     QDeclarativeDebugContextReference();
284     QDeclarativeDebugContextReference(const QDeclarativeDebugContextReference &);
285     QDeclarativeDebugContextReference &operator=(const QDeclarativeDebugContextReference &);
286
287     int debugId() const;
288     QString name() const;
289
290     QList<QDeclarativeDebugObjectReference> objects() const;
291     QList<QDeclarativeDebugContextReference> contexts() const;
292
293 private:
294     friend class QDeclarativeEngineDebugPrivate;
295     int m_debugId;
296     QString m_name;
297     QList<QDeclarativeDebugObjectReference> m_objects;
298     QList<QDeclarativeDebugContextReference> m_contexts;
299 };
300
301 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugPropertyReference
302 {
303 public:
304     QDeclarativeDebugPropertyReference();
305     QDeclarativeDebugPropertyReference(const QDeclarativeDebugPropertyReference &);
306     QDeclarativeDebugPropertyReference &operator=(const QDeclarativeDebugPropertyReference &);
307
308     int objectDebugId() const;
309     QString name() const;
310     QVariant value() const;
311     QString valueTypeName() const;
312     QString binding() const;
313     bool hasNotifySignal() const;
314
315 private:
316     friend class QDeclarativeEngineDebugPrivate;
317     int m_objectDebugId;
318     QString m_name;
319     QVariant m_value;
320     QString m_valueTypeName;
321     QString m_binding;
322     bool m_hasNotifySignal;
323 };
324
325
326 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugEnginesQuery : public QDeclarativeDebugQuery
327 {
328     Q_OBJECT
329 public:
330     virtual ~QDeclarativeDebugEnginesQuery();
331     QList<QDeclarativeDebugEngineReference> engines() const;
332 private:
333     friend class QDeclarativeEngineDebug;
334     friend class QDeclarativeEngineDebugPrivate;
335     QDeclarativeDebugEnginesQuery(QObject *);
336     QDeclarativeEngineDebug *m_client;
337     int m_queryId;
338     QList<QDeclarativeDebugEngineReference> m_engines;
339 };
340
341 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugRootContextQuery : public QDeclarativeDebugQuery
342 {
343     Q_OBJECT
344 public:
345     virtual ~QDeclarativeDebugRootContextQuery();
346     QDeclarativeDebugContextReference rootContext() const;
347 private:
348     friend class QDeclarativeEngineDebug;
349     friend class QDeclarativeEngineDebugPrivate;
350     QDeclarativeDebugRootContextQuery(QObject *);
351     QDeclarativeEngineDebug *m_client;
352     int m_queryId;
353     QDeclarativeDebugContextReference m_context;
354 };
355
356 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugObjectQuery : public QDeclarativeDebugQuery
357 {
358     Q_OBJECT
359 public:
360     virtual ~QDeclarativeDebugObjectQuery();
361     QDeclarativeDebugObjectReference object() const;
362 private:
363     friend class QDeclarativeEngineDebug;
364     friend class QDeclarativeEngineDebugPrivate;
365     QDeclarativeDebugObjectQuery(QObject *);
366     QDeclarativeEngineDebug *m_client;
367     int m_queryId;
368     QDeclarativeDebugObjectReference m_object;
369
370 };
371
372 class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeDebugExpressionQuery : public QDeclarativeDebugQuery
373 {
374     Q_OBJECT
375 public:
376     virtual ~QDeclarativeDebugExpressionQuery();
377     QVariant expression() const;
378     QVariant result() const;
379 private:
380     friend class QDeclarativeEngineDebug;
381     friend class QDeclarativeEngineDebugPrivate;
382     QDeclarativeDebugExpressionQuery(QObject *);
383     QDeclarativeEngineDebug *m_client;
384     int m_queryId;
385     QVariant m_expr;
386     QVariant m_result;
387 };
388
389 QT_END_NAMESPACE
390
391 Q_DECLARE_METATYPE(QDeclarativeDebugEngineReference)
392 Q_DECLARE_METATYPE(QDeclarativeDebugObjectReference)
393 Q_DECLARE_METATYPE(QDeclarativeDebugContextReference)
394 Q_DECLARE_METATYPE(QDeclarativeDebugPropertyReference)
395
396 QT_END_HEADER
397
398 #endif // QDECLARATIVEENGINEDEBUG_H