]>
git.saurik.com Git - wxWidgets.git/blob - samples/ipc/connection.h
bf01ab5d3e5fe387350e85d914bb2ceb58f33db4
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(static_cast<const char *>(data
), size
);
43 case wxIPC_UNICODETEXT
:
44 s
+= wxString(static_cast<const wchar_t *>(data
), size
);
46 #endif // wxUSE_UNICODE
49 s
+= wxString::FromUTF8(static_cast<const char *>(data
), size
);
55 const char *bytes
= 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_