summaryrefslogtreecommitdiff
path: root/x11/ipc/common/ocoppacket.cpp
authorzecke <zecke>2002-10-01 14:27:17 (UTC)
committer zecke <zecke>2002-10-01 14:27:17 (UTC)
commitbba0335bbea81519beafb7fec1979a0abbd8a7ea (patch) (unidiff)
treeee334cf518c59582a36a3dd24238a05dfc3535a2 /x11/ipc/common/ocoppacket.cpp
parentef8d0a15d706b0e230f052efcb1eab6f905a8737 (diff)
downloadopie-bba0335bbea81519beafb7fec1979a0abbd8a7ea.zip
opie-bba0335bbea81519beafb7fec1979a0abbd8a7ea.tar.gz
opie-bba0335bbea81519beafb7fec1979a0abbd8a7ea.tar.bz2
5th try
initial checkin of X11 Opie stuff it features an IPC Server the client is todo this will become the OPIE X11 department including alternative QPEApplication, QCOP replacement
Diffstat (limited to 'x11/ipc/common/ocoppacket.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--x11/ipc/common/ocoppacket.cpp59
1 files changed, 59 insertions, 0 deletions
diff --git a/x11/ipc/common/ocoppacket.cpp b/x11/ipc/common/ocoppacket.cpp
new file mode 100644
index 0000000..0d8ae84
--- a/dev/null
+++ b/x11/ipc/common/ocoppacket.cpp
@@ -0,0 +1,59 @@
1
2#include <qdatastream.h>
3
4#include "ocoppacket.h"
5
6OCOPPacket::OCOPPacket( int type,
7 const QCString& channel,
8 const QCString& header,
9 const QByteArray& array )
10 : m_type( type ), m_channel( channel ),
11 m_header( header ), m_content( array )
12{
13}
14OCOPHead OCOPPacket::head()const {
15 OCOPHead head;
16 memset(&head, 0, sizeof(head) );
17
18 head.magic = 47;
19 head.type = m_type;
20 head.chlen = m_channel.size();
21 head.funclen = m_header.size();
22 head.datalen = m_content.size();
23
24 return head;
25};
26QByteArray OCOPPacket::toByteArray()const {
27 QByteArray array;
28 QDataStream stream(array, IO_WriteOnly );
29 stream << m_type;
30 stream << m_channel;
31 stream << m_header;
32 stream << m_content;
33
34 return array;
35}
36int OCOPPacket::type()const {
37 return m_type;
38}
39QCString OCOPPacket::channel()const {
40 return m_channel;
41}
42QCString OCOPPacket::header()const {
43 return m_header;
44}
45QByteArray OCOPPacket::content()const {
46 return m_content;
47}
48void OCOPPacket::setType( int type ) {
49 m_type = type;
50}
51void OCOPPacket::setChannel( const QCString& chan ) {
52 m_channel = chan;
53}
54void OCOPPacket::setHeader( const QCString& head ) {
55 m_header = head;
56}
57void OCOPPacket::setContent( const QByteArray& arra ) {
58 m_content = arra;
59}