1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
|
/***************************************************************************
xsldbgevent.h - event to notify app of
data from xsldbg
-------------------
begin : Fri Feb 1 2001
copyright : (C) 2001 by Keith Isdale
email : [email protected]
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef XSLDBGEVENT_H
#define XSLDBGEVENT_H
#if defined WIN32
#include <libxsldbg/xsldbgwin32config.h>
#endif
#include <tqevent.h>
#include <tqptrlist.h>
#include "xsldbgmsg.h"
/* how many columns do we have */
#define XSLDBGEVENT_COLUMNS 4
class XsldbgDebuggerBase;
class XsldbgEventData;
class XsldbgEventDataList : public TQGList
{
public:
XsldbgEventDataList(void) {}
XsldbgEventDataList( const XsldbgEventDataList &l ) : TQGList(l) {}
~XsldbgEventDataList(void) { clear(); }
XsldbgEventDataList &operator=(const XsldbgEventDataList &l)
{ return (XsldbgEventDataList&)TQGList::operator=(l); }
bool operator==( const XsldbgEventDataList &list ) const
{ return TQGList::operator==( list ); }
uint count(void) const { return TQGList::count(); }
bool isEmpty(void) const { return TQGList::count() == 0; }
bool insert( uint i, const XsldbgEventData *d){ return TQGList::insertAt(i,(TQPtrCollection::Item)d); }
void inSort( const XsldbgEventData *d ) { TQGList::inSort((TQPtrCollection::Item)d); }
void prepend( const XsldbgEventData *d ) { TQGList::insertAt(0,(TQPtrCollection::Item)d); }
void append( const XsldbgEventData *d ) { TQGList::append((TQPtrCollection::Item)d); }
bool remove( uint i ) { return TQGList::removeAt(i); }
bool remove(void) { return TQGList::remove((TQPtrCollection::Item)0); }
bool remove( const XsldbgEventData *d ) { return TQGList::remove((TQPtrCollection::Item)d); }
bool removeRef( const XsldbgEventData *d ) { return TQGList::removeRef((TQPtrCollection::Item)d); }
void removeNode( TQLNode *n ) { TQGList::removeNode(n); }
bool removeFirst(void) { return TQGList::removeFirst(); }
bool removeLast(void) { return TQGList::removeLast(); }
XsldbgEventData *take( uint i ) { return (XsldbgEventData *)TQGList::takeAt(i); }
XsldbgEventData *take(void) { return (XsldbgEventData *)TQGList::take(); }
XsldbgEventData *takeNode( TQLNode *n ) { return (XsldbgEventData *)TQGList::takeNode(n); }
void clear(void) { TQGList::clear(); }
void sort(void) { TQGList::sort(); }
int tqfind( const XsldbgEventData *d ) { return TQGList::tqfind((TQPtrCollection::Item)d); }
int findNext( const XsldbgEventData *d ) { return TQGList::tqfind((TQPtrCollection::Item)d,FALSE); }
int tqfindRef( const XsldbgEventData *d ) { return TQGList::tqfindRef((TQPtrCollection::Item)d); }
int findNextRef( const XsldbgEventData *d ){ return TQGList::tqfindRef((TQPtrCollection::Item)d,FALSE);}
uint tqcontains( const XsldbgEventData *d ) const { return TQGList::tqcontains((TQPtrCollection::Item)d); }
uint containsRef( const XsldbgEventData *d ) const
{ return TQGList::tqcontainsRef((TQPtrCollection::Item)d); }
XsldbgEventData *at( uint i ) { return (XsldbgEventData *)TQGList::at(i); }
int at(void) const { return TQGList::at(); }
XsldbgEventData *current(void) const { return (XsldbgEventData *)TQGList::get(); }
TQLNode *currentNode(void) const { return TQGList::currentNode(); }
XsldbgEventData *getFirst(void) const { return (XsldbgEventData *)TQGList::cfirst(); }
XsldbgEventData *getLast(void) const { return (XsldbgEventData *)TQGList::clast(); }
XsldbgEventData *first(void) { return (XsldbgEventData *)TQGList::first(); }
XsldbgEventData *last(void) { return (XsldbgEventData *)TQGList::last(); }
XsldbgEventData *next(void) { return (XsldbgEventData *)TQGList::next(); }
XsldbgEventData *prev(void) { return (XsldbgEventData *)TQGList::prev(); }
void toVector( TQGVector *vec )const{ TQGList::toVector(vec); }
private:
void deleteItem( TQPtrCollection::Item d );
};
/**
* This class is used to convert a message from xsldbg into a simple data type
*
* @short convertor of xsldbg message to a data class
*
* @author Keith Isdale <[email protected]>
*/
class XsldbgEventData {
public:
XsldbgEventData(void);
~XsldbgEventData(void);
/**
* Set the text for the column specified
*
* @param column 0 =< @p column < XSLDBGEVENT_COLUMNS
* @param text The text value to store in column indicated
*/
void setText(int column, TQString text);
/**
* Get the text from the column specified
*
* @returns TQString() if invalid column number
*
* @param column 0 =< @p column < XSLDBGEVENT_COLUMNS
*
*/
TQString getText(int column);
/**
* Set the integer value for the column specified
*
* @param column 0 =< @p column < XSLDBGEVENT_COLUMNS
* @param value The value to store in column indicated
*/
void setInt(int column, int value);
/**
* Get the integer value from the column specified
*
* @returns -1 if invalid column number
*
* @param column 0 =< @p column < XSLDBGEVENT_COLUMNS
*
*/
int getInt(int column);
private:
/** Below are the messages that this class will support
Values are mapped left to right ie the first TQString value maps
to textValues[0], the second mapps to textValues[1]
the third maps to textValues[2] etc.. */
TQString textValues[XSLDBGEVENT_COLUMNS];
/**
Both int and bool values are mapped to intValues in the same manner as
stated above */
int intValues[XSLDBGEVENT_COLUMNS];
/** - - - - - - The message/signal types supported - - - - - - */
// /** line number and/or file name changed */
// void lineNoChanged(TQString /* fileName */, int /* lineNumber */, bool /* breakpoint */);
// These data items are mapped to attributes of this class with the same name
// /** Show a message in debugger window */
// void showMessage(TQString /* msg*/);
// These data item is mapped to the text attribute
// /** Add breakpoint to view, First parameter is TQString()
// to indicate start of breakpoint list notfication */
// void breakpointItem(TQString /* fileName*/, int /* lineNumber */, TQString /*templateName*/,
// bool /* enabled */, int /* id */);
// These data items are mapped to attributes of this class with the same name
// /** Add global variable to view, First parameter is TQString()
// to indicate start of global variable list notfication */
// void globalVariableItem(TQString /* name */, TQString /* fileName */, int /* lineNumber */);
// These data items are mapped to attributes of this class with the same name
// /** Add local variable to view, First parameter is TQString()
// to indicate start of local variable list notfication */
// void localVariableItem(TQString /*name */, TQString /* templateContext*/,
// TQString /* fileName */, int /*lineNumber */);
// These data items are mapped to attributes of this class with the same name
// /** Add template to view, First parameter is TQString()
// to indicate start of template list notfication */
// void templateItem(TQString /* name*/, TQString /*mode*/, TQString /* fileName */, int /* lineNumber */);
// /** Add source to view, First parameter is TQString()
// to indicate start of source list notfication */
// void sourceItem(TQString /* fileName */, TQString /* tqparentFileName */, int /*lineNumber */);
// /** Add parameter to view, First parameter is TQString()
// to indicate start of parameter list notfication */
// void parameterItem(TQString /* name*/, TQString /* value */);
// /** Add callStack to view, First parameter is TQString()
// to indicate start of callstack list notfication */
// void callStackItem(TQString /* tempalteName*/, TQString /* fileName */, int /* lineNumber */);
// /** Add entity to view, First parameter is TQString()
// to indicate start of entity list notfication */
// void entityItem(TQString /*SystemID*/, TQString /*PublicID*/);
// /* Show the URI for SystemID or PublicID requested */
// void resolveItem(TQString /*URI*/);
// /* Display a integer option value First parameter is TQString()
// to indicate start of option list notification */
// void intOptionItem(TQString /* name*/, int /* value */);
// /* Display a string option value. First parameter is TQString()
// to indicate start of option list notification */
// void stringOptionItem(TQString /* name*/, TQString /* value */);
};
/**
* This class is posted to the applications event queue. When the application
* has time to process the event this class then aids in emitting
* the relavant signals for the event.
*
* @short Emit signals to QT application via debugger base class
*
* @author Keith Isdale <[email protected]>
*/
class XsldbgEvent : public TQEvent {
public:
XsldbgEvent(XsldbgMessageEnum type, const void *data);
~XsldbgEvent(void);
/** Main control for emitting messages, use this from the application
inside its event processing function */
void emitMessage(XsldbgDebuggerBase *debugger);
/** Emit a single message. It uses handleXXX to do the actual emitting
of signal from debugger */
void emitMessage(XsldbgEventData *eventData);
private:
/** Create the XsldbgEventData for this message. Is used by our constructor
it uses handleXXX function to fill in the approriate values in
the XsldbgEventData provided */
XsldbgEventData * createEventData(XsldbgMessageEnum type, const void *msgData);
/** The following functions are directly related to the eventual signals that
will be emitted ie the signal
lineNoChanged(TQString, int bool)
is mapped to
handleLineNoChanged(XsldbgEventData *, void *)
*/
void handleLineNoChanged(XsldbgEventData *eventData, const void *msgData);
void handleShowMessage(XsldbgEventData *eventData, const void *msgData);
void handleBreakpointItem(XsldbgEventData *eventData, const void *msgData);
void handleGlobalVariableItem(XsldbgEventData *eventData, const void *msgData);
void handleLocalVariableItem(XsldbgEventData *eventData, const void *msgData);
void handleTemplateItem(XsldbgEventData *eventData, const void *msgData);
void handleSourceItem(XsldbgEventData *eventData, const void *msgData);
void handleIncludedSourceItem(XsldbgEventData *eventData, const void *msgData);
void handleParameterItem(XsldbgEventData *eventData, const void *msgData);
void handleCallStackItem(XsldbgEventData *eventData, const void *msgData);
void handleEntityItem(XsldbgEventData *eventData, const void *msgData);
void handleResolveItem(XsldbgEventData *eventData, const void *msgData);
void handleIntOptionItem(XsldbgEventData *eventData, const void *msgData);
void handleStringOptionItem(XsldbgEventData *eventData, const void *msgData);
private:
/** What type is the items in list */
XsldbgMessageEnum itemType;
/** A flag that gets set once the list has been filled with approriate
XsldbgEventData */
bool beenCreated;
/** This is a volitile value that is only valid for the duration
of the constuctor. It will be set to 0L immediately after */
const void *data;
/** This is a volitile value only valid for duration of emitMessage
function. It will be set to 0L imedediately after */
XsldbgDebuggerBase *debugger;
/** This is the data associated with this event
each data item in the list will be of the type required
by the "type" this event
*/
class XsldbgEventDataList list;
};
#endif
|