author | zecke <zecke> | 2002-10-01 14:27:17 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-01 14:27:17 (UTC) |
commit | bba0335bbea81519beafb7fec1979a0abbd8a7ea (patch) (unidiff) | |
tree | ee334cf518c59582a36a3dd24238a05dfc3535a2 /x11/ipc/common/ocoppacket.cpp | |
parent | ef8d0a15d706b0e230f052efcb1eab6f905a8737 (diff) | |
download | opie-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
-rw-r--r-- | x11/ipc/common/ocoppacket.cpp | 59 |
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 | |||
6 | OCOPPacket::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 | } | ||
14 | OCOPHead 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 | }; | ||
26 | QByteArray 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 | } | ||
36 | int OCOPPacket::type()const { | ||
37 | return m_type; | ||
38 | } | ||
39 | QCString OCOPPacket::channel()const { | ||
40 | return m_channel; | ||
41 | } | ||
42 | QCString OCOPPacket::header()const { | ||
43 | return m_header; | ||
44 | } | ||
45 | QByteArray OCOPPacket::content()const { | ||
46 | return m_content; | ||
47 | } | ||
48 | void OCOPPacket::setType( int type ) { | ||
49 | m_type = type; | ||
50 | } | ||
51 | void OCOPPacket::setChannel( const QCString& chan ) { | ||
52 | m_channel = chan; | ||
53 | } | ||
54 | void OCOPPacket::setHeader( const QCString& head ) { | ||
55 | m_header = head; | ||
56 | } | ||
57 | void OCOPPacket::setContent( const QByteArray& arra ) { | ||
58 | m_content = arra; | ||
59 | } | ||