]>
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)
7 // Copyright: (c) 1999 Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_SAMPLE_IPC_CONNECTION_H_
13 #define _WX_SAMPLE_IPC_CONNECTION_H_
15 // This simple connection class adds logging of all operations
16 class MyConnectionBase
: public wxConnection
19 void Log(const wxString
& command
,
20 const wxString
& topic
,
27 if (topic
.IsEmpty() && item
.IsEmpty())
28 s
.Printf("%s(", command
.c_str());
29 else if (topic
.IsEmpty())
30 s
.Printf("%s(item=\"%s\",", command
.c_str(), item
.c_str());
31 else if (item
.IsEmpty())
32 s
.Printf("%s(topic=\"%s\",", command
.c_str(), topic
.c_str());
34 s
.Printf("%s(topic=\"%s\",item=\"%s\",", command
.c_str(), topic
.c_str(), item
.c_str());
39 s
+= wxString(wx_static_cast(const char *, data
), size
);
43 case wxIPC_UNICODETEXT
:
44 s
+= wxString(wx_static_cast(const wchar_t *, data
), size
);
46 #endif // wxUSE_UNICODE
49 s
+= wxString::FromUTF8(wx_static_cast(const char *, data
), size
);
55 const char *bytes
= wx_static_cast(const char *, data
);
56 s
<< '"' << bytes
[0] << bytes
[1] << bytes
[2] << '"';
65 s
+= "[invalid data]";
69 s
+= "[unknown data]";
73 wxLogMessage("%s,%d)", s
, size
);
77 #endif // _WX_SAMPLE_IPC_CONNECTION_H_