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
|
#ifndef MTYPES_H
#define MTYPES_H
#include <tqstring.h>
#include <tqbuffer.h>
#include <tqvaluelist.h>
#include "miscui.h"
/** Internal class : used for client identification. */
class cId
{
public:
cId() {}
cId(const TQString &gameName, const TQString &gameId);
enum State { Accepted, LibIdClash, GameNameClash, GameIdClash };
void check(const cId &id);
bool accepted() const { return state==Accepted; }
TQString errorMessage(const cId &id) const;
friend TQDataStream &operator << (TQDataStream &s, const cId &id);
friend TQDataStream &operator >> (TQDataStream &s, cId &id);
private:
TQString libId, gameName, gameId;
State state;
};
TQDataStream &operator << (TQDataStream &s, const cId &id);
TQDataStream &operator >> (TQDataStream &s, cId &id);
/** Flags used for the netmeeting. */
enum MeetingMsgFlag
{ IdFlag = 0, EndFlag, NewFlag, DelFlag, Mod_TextFlag, Mod_TypeFlag, Mod_OptFlag, PlayFlag };
TQDataStream &operator << (TQDataStream &s, const MeetingMsgFlag &f);
TQDataStream &operator >> (TQDataStream &s, MeetingMsgFlag &f);
/** Internal class : used in netmeeting to transport text line. */
class TextInfo
{
public:
TextInfo() {}
uint i;
TQString text;
};
TQDataStream &operator << (TQDataStream &s, const TextInfo &ti);
TQDataStream &operator >> (TQDataStream &s, TextInfo &ti);
/** Internal class : used in netmeeting to transport readiness status. */
typedef struct {
uint i;
MeetingCheckBox::Type type;
} TypeInfo;
TQDataStream &operator << (TQDataStream &s, const MeetingCheckBox::Type &t);
TQDataStream &operator >> (TQDataStream &s, MeetingCheckBox::Type &t);
TQDataStream &operator << (TQDataStream &s, const TypeInfo &ti);
TQDataStream &operator >> (TQDataStream &s, TypeInfo &ti);
/* Internal class : store game data. */
class BoardData
{
public:
BoardData() {}
TQString name;
PlayerComboBox::Type type;
};
TQDataStream &operator <<(TQDataStream &, const BoardData &);
TQDataStream &operator >>(TQDataStream &, BoardData &);
/* Internal class : store extended game data (used in netmeeting). */
class ExtData
{
public:
ExtData() {}
ExtData(const TQValueList<BoardData> &_bds, const TQString &_text,
MeetingCheckBox::Type _type)
: bds(_bds), text(_text), type(_type) {}
TQValueList<BoardData> bds;
TQString text;
MeetingCheckBox::Type type;
};
TQDataStream &operator << (TQDataStream &s, const ExtData &ed);
TQDataStream &operator >> (TQDataStream &s, ExtData &ed);
/* Internal class : store meeting line data (in netmeeting). */
class MeetingLineData
{
public:
MeetingLineData() {}
ExtData ed;
bool own;
};
TQDataStream &operator << (TQDataStream &s, const MeetingLineData &pld);
TQDataStream &operator >> (TQDataStream &s, MeetingLineData &pld);
/* Internal class : store remote host data. */
class Socket;
class RemoteHostData
{
public:
RemoteHostData() : socket(0) {}
Socket *socket;
TQValueList<BoardData> bds;
};
/* Internal class : store connection data (used by config. wizard). */
class ConnectionData
{
public:
ConnectionData() {}
bool network, server;
RemoteHostData rhd;
};
/** Flags used for network communication. */
enum MetaFlag { MF_Ask = 0, MF_Data };
TQDataStream &operator << (TQDataStream &s, const MetaFlag &f);
TQDataStream &operator >> (TQDataStream &s, MetaFlag &f);
/** Internal class : encapsulate read/write TQBuffer. */
class Stream : public TQDataStream
{
public:
Stream(int mode);
void clear();
void setArray(TQByteArray a);
TQByteArray buffer() /*const*/ { return buf.buffer(); }
uint size() /*const*/ { return buf.buffer().size(); }
protected:
TQBuffer buf;
private:
int mode;
};
/** Internal class : encapsulate write TQBuffer. */
class WritingStream : public Stream
{
public:
WritingStream() : Stream(IO_WriteOnly) {}
};
/** Internal class : encapsulate read TQBuffer. */
class ReadingStream : public Stream
{
public:
ReadingStream() : Stream(IO_ReadOnly) {}
bool readOk();
void clearRead();
};
/** Internal class : include a @ref ReadingStream and a @ref WritingStream. */
class IOBuffer
{
public:
IOBuffer() {}
void writingToReading();
ReadingStream reading;
WritingStream writing;
};
/** Internal class : array of @ref IOBuffer. */
class BufferArray
{
public:
BufferArray() {}
BufferArray(uint nb) { resize(nb); }
~BufferArray();
void resize(uint nb);
uint size() const { return a.size(); }
IOBuffer *operator [](uint i) const { return a[i]; }
private:
TQMemArray<IOBuffer *> a;
void clear(uint nb);
};
TQDataStream &operator <<(TQDataStream &s, const BufferArray &b);
TQDataStream &operator >>(TQDataStream &s, BufferArray &b);
#endif // MTYPES_H
|