File: UmlCom.h

package info (click to toggle)
bouml 2.19.2-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 42,364 kB
  • ctags: 33,402
  • sloc: cpp: 169,092; makefile: 135
file content (206 lines) | stat: -rw-r--r-- 5,920 bytes parent folder | download | duplicates (3)
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
#ifndef _UMLCOM_H
#define _UMLCOM_H


#include <qsocketdevice.h>
#include "CmdFamily.h"
#include "OnInstanceCmd.h"
#include "anItemKind.h"
#include "aRelationKind.h"
#include "UmlClass.h"
#include <qcstring.h>

#include <qvector.h>
#include <qstring.h>

class UmlItem;
class UmlTypeSpec;

class QSocketDevice;
class UmlItem;
class UmlTypeSpec;
class UmlClass;
// This class manages the communications
//
// This class may be defined as a 'singleton', but I prefer to use static 
// members allowing to just write 'UmlCom::member' rather than
// 'UmlCom::instance()->member' or other long sentence like this.
//
// The operation you can use yourself are :
//
// - connect()
//
// - targetItem()
//
// - trace()
//
// - message()
//
// - bye()
//
// - close()
// 
// you must NOT call the others
class UmlCom {
  public:
    // does the connexion
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    static bool connect(unsigned int port);
    //  returns the item on which the tool is applied
    static UmlItem * targetItem();

    // to write messages in the tool window,
    // use Qt rich text : allows HTML like formatting
    static void trace(const char * s);
    // to write a message in the status bar line
    // does not use Qt rich text
    static void message(const char * s);
    // must be called just before the disconnexion
    static void bye();
    // disconnexion
    static void close();

  private:
    static QSocketDevice * sock;

    static char * buffer_in;

    static unsigned int buffer_in_size;

    static char * p_buffer_in;

    static char * buffer_in_end;

    static char * buffer_out;

    static char * p_buffer_out;

    static unsigned int buffer_out_size;


  protected:
    //internal, do NOT use it
    
    static void check_size_out(unsigned int len);
    //internal, do NOT use it
    
    static void read_if_needed();
    //internal, do NOT use it
    
    static void read_buffer(unsigned int len);
    //internal, do NOT use it
    
    static void write_bool(bool b);
    //internal, do NOT use it
    
    static void write_char(char c);
    //internal, do NOT use it
    
    static void write_unsigned(unsigned int u);
    //internal, do NOT use it
    
    static void write_id(const void * id);
    //internal, do NOT use it
    
    static void write_string(const char * p);

  public:
    // internal, do NOT use it
    
    static void send_cmd(CmdFamily f, unsigned int cmd);
    //internal, do NOT use it
    
    static void send_cmd(CmdFamily f, unsigned int cmd, char arg);
    //internal, do NOT use it
    
    static void send_cmd(CmdFamily f, unsigned int cmd, void * id);
    //internal, do NOT use it
    
    static void send_cmd(CmdFamily f, unsigned int cmd, const char * s);
    //internal, do NOT use it
    
    static void send_cmd(CmdFamily f, unsigned int cmd, void * id, const char * n);
    //internal, do NOT use it
    
    static void send_cmd(CmdFamily f, unsigned int cmd, const char * s, const char * v);

    //internal, do NOT use it
    
    static void send_cmd(CmdFamily f, unsigned int cmd, bool b, const char * s, const char * v);

    //internal, do NOT use it
    
    static void send_cmd(const void * id, OnInstanceCmd cmd);
    //internal, do NOT use it
    
    static void send_cmd(const void * id, OnInstanceCmd cmd, const char * arg);
    //internal, do NOT use it
    
    static void send_cmd(const void * id, OnInstanceCmd cmd, char arg);
    //internal, do NOT use it
    
    static void send_cmd(const void * id, OnInstanceCmd cmd, unsigned int arg);
    //internal, do NOT use it
    
    static void send_cmd(const void * id, OnInstanceCmd cmd, const UmlTypeSpec & arg);
    //internal, do NOT use it
    
    static void send_cmd(const void * id, OnInstanceCmd cmd, const char * arg1, const char * arg2);
    //internal, do NOT use it
    
    static void send_cmd(const void * id, OnInstanceCmd cmd, anItemKind arg1, const char * arg2);
    //internal, do NOT use it
    
    static void send_cmd(const void * id, OnInstanceCmd cmd, anItemKind arg1, aRelationKind arg2, const void * id2);
    //internal, do NOT use it
    
    static void send_cmd(const void * id, OnInstanceCmd cmd, const void * id1);
    //internal, do NOT use it
    
    static void send_cmd(const void * id, OnInstanceCmd cmd, const void * id1, const char * arg2);
    //internal, do NOT use it
    
    static void send_cmd(const void * id, OnInstanceCmd cmd, unsigned int arg1, const UmlTypeSpec & arg2);
    //internal, do NOT use it
    
    static void send_cmd(const void * id, OnInstanceCmd cmd, unsigned int arg1, const char * arg2, const char * arg3, const UmlTypeSpec & arg4, const UmlTypeSpec & arg5);
    //internal, do NOT use it
    
    static void send_cmd(const void * id, OnInstanceCmd cmd, unsigned int arg1, char arg2, const char * arg3, const char * arg4, const UmlTypeSpec & arg5);
    //internal, do NOT use it
    
    static void send_cmd(const void * id, OnInstanceCmd cmd, const QVector<UmlClass> & l);
    static void send_cmd(const void * id, OnInstanceCmd cmd, const QVector<UmlClass> & l1, const QVector<UmlClass> & l2, const QVector<UmlClass> & l3);

    //internal, do NOT use it
    
    static void send_cmd(const void * id, OnInstanceCmd cmd, anItemKind arg, const void * id2);

    //internal, do NOT use it
    
    static void * read_id();
    //internal, do NOT use it
    
    static const char * read_string();
    //internal, do NOT use it
    
    static bool read_bool();
    //internal, do NOT use it
    
    static char read_char();
    //internal, do NOT use it
    
    static unsigned int read_unsigned();
    // internal, do NOT use it
    
    static void read_item_list(QVector<UmlItem> & v);
    //internal, do NOT use it
    
    static void fatal_error(const QCString & msg);
    //internal, do NOT use it
    
    static void flush();
};

#endif