]>
git.saurik.com Git - wxWidgets.git/blob - samples/ipc/connection.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: DDE sample: MyConnection class
4 // Author: Vadim Zeitlin
5 // Created: 2008-02-11 (extracted from client.cpp)
6 // Copyright: (c) 1999 Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_SAMPLE_IPC_CONNECTION_H_
12 #define _WX_SAMPLE_IPC_CONNECTION_H_
14 // This simple connection class adds logging of all operations
15 class MyConnectionBase
: public wxConnection
18 void Log(const wxString
& command
,
19 const wxString
& topic
,
26 if (topic
.IsEmpty() && item
.IsEmpty())
27 s
.Printf("%s(", command
.c_str());
28 else if (topic
.IsEmpty())
29 s
.Printf("%s(item=\"%s\",", command
.c_str(), item
.c_str());
30 else if (item
.IsEmpty())
31 s
.Printf("%s(topic=\"%s\",", command
.c_str(), topic
.c_str());
33 s
.Printf("%s(topic=\"%s\",item=\"%s\",", command
.c_str(), topic
.c_str(), item
.c_str());
38 s
+= wxString(static_cast<const char *>(data
), size
);
42 case wxIPC_UNICODETEXT
:
43 s
+= wxString(static_cast<const wchar_t *>(data
), size
);
45 #endif // wxUSE_UNICODE
48 s
+= wxString::FromUTF8(static_cast<const char *>(data
), size
);
54 const char *bytes
= static_cast<const char *>(data
);
55 s
<< '"' << bytes
[0] << bytes
[1] << bytes
[2] << '"';
64 s
+= "[invalid data]";
68 s
+= "[unknown data]";
72 wxLogMessage("%s,%d)", s
, size
);
76 #endif // _WX_SAMPLE_IPC_CONNECTION_H_