]> git.saurik.com Git - wxWidgets.git/blame - include/wx/ipcbase.h
more long/double to int conversion warnings from HP-UX logs fixed
[wxWidgets.git] / include / wx / ipcbase.h
CommitLineData
c801d85f
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: ipcbase.h
3// Purpose: Base classes for IPC
4// Author: Julian Smart
5// Modified by:
6// Created: 4/1/98
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart and Markus Holzem
9// Licence: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
11
34138703
JS
12#ifndef _WX_IPCBASEH__
13#define _WX_IPCBASEH__
c801d85f 14
0d3820b3
JS
15#ifdef __GNUG__
16#pragma interface "ipcbase.h"
17#endif
18
c801d85f
KB
19#include "wx/defs.h"
20#include "wx/object.h"
21#include "wx/string.h"
22
0d2a2b60
RR
23enum wxIPCFormat
24{
25 wxIPC_INVALID = 0,
26 wxIPC_TEXT = 1, /* CF_TEXT */
27 wxIPC_BITMAP = 2, /* CF_BITMAP */
28 wxIPC_METAFILE = 3, /* CF_METAFILEPICT */
29 wxIPC_SYLK = 4,
30 wxIPC_DIF = 5,
31 wxIPC_TIFF = 6,
32 wxIPC_OEMTEXT = 7, /* CF_OEMTEXT */
33 wxIPC_DIB = 8, /* CF_DIB */
34 wxIPC_PALETTE = 9,
35 wxIPC_PENDATA = 10,
36 wxIPC_RIFF = 11,
37 wxIPC_WAVE = 12,
38 wxIPC_UNICODETEXT = 13,
39 wxIPC_ENHMETAFILE = 14,
40 wxIPC_FILENAME = 15, /* CF_HDROP */
41 wxIPC_LOCALE = 16,
42 wxIPC_PRIVATE = 20
43};
44
07e829dc
GRG
45class WXDLLEXPORT wxServerBase;
46class WXDLLEXPORT wxClientBase;
c801d85f
KB
47
48class WXDLLEXPORT wxConnectionBase: public wxObject
49{
50 DECLARE_CLASS(wxConnectionBase)
51 public:
52 inline wxConnectionBase(void) {}
53 inline ~wxConnectionBase(void) {}
54
55 // Calls that CLIENT can make
e90c1d2a
VZ
56 virtual bool Execute(const wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT ) = 0;
57 virtual bool Execute(const wxString& str) { return Execute(str, -1, wxIPC_TEXT); }
0d2a2b60 58 virtual char *Request(const wxString& item, int *size = (int *) NULL, wxIPCFormat format = wxIPC_TEXT) = 0;
9d2f3c71 59 virtual bool Poke(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT) = 0;
c801d85f
KB
60 virtual bool StartAdvise(const wxString& item) = 0;
61 virtual bool StopAdvise(const wxString& item) = 0;
62
63 // Calls that SERVER can make
9d2f3c71 64 virtual bool Advise(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT) = 0;
c801d85f
KB
65
66 // Calls that both can make
67 virtual bool Disconnect(void) = 0;
68
69 // Callbacks to SERVER - override at will
85ac091e
GRG
70 virtual bool OnExecute ( const wxString& WXUNUSED(topic),
71 char *WXUNUSED(data),
72 int WXUNUSED(size),
73 wxIPCFormat WXUNUSED(format) )
74 { return FALSE; };
75
76 virtual char *OnRequest ( const wxString& WXUNUSED(topic),
77 const wxString& WXUNUSED(item),
78 int *WXUNUSED(size),
79 wxIPCFormat WXUNUSED(format) )
80 { return (char *) NULL; };
81
82 virtual bool OnPoke ( const wxString& WXUNUSED(topic),
83 const wxString& WXUNUSED(item),
84 wxChar *WXUNUSED(data),
85 int WXUNUSED(size),
86 wxIPCFormat WXUNUSED(format) )
87 { return FALSE; };
88
89 virtual bool OnStartAdvise ( const wxString& WXUNUSED(topic),
90 const wxString& WXUNUSED(item) )
91 { return FALSE; };
92
93 virtual bool OnStopAdvise ( const wxString& WXUNUSED(topic),
94 const wxString& WXUNUSED(item) )
c801d85f
KB
95 { return FALSE; };
96
97 // Callbacks to CLIENT - override at will
85ac091e
GRG
98 virtual bool OnAdvise ( const wxString& WXUNUSED(topic),
99 const wxString& WXUNUSED(item),
100 char *WXUNUSED(data),
101 int WXUNUSED(size),
102 wxIPCFormat WXUNUSED(format) )
103 { return FALSE; };
c801d85f
KB
104
105 // Callbacks to BOTH
106
107 // Default behaviour is to delete connection and return TRUE
108 virtual bool OnDisconnect(void) = 0;
109};
110
111class WXDLLEXPORT wxServerBase: public wxObject
112{
113 DECLARE_CLASS(wxServerBase)
114 public:
115
116 inline wxServerBase(void) {}
117 inline ~wxServerBase(void) {};
118 virtual bool Create(const wxString& serverName) = 0; // Returns FALSE if can't create server (e.g. port
119 // number is already in use)
120 virtual wxConnectionBase *OnAcceptConnection(const wxString& topic) = 0;
121
122};
123
124class WXDLLEXPORT wxClientBase: public wxObject
125{
126 DECLARE_CLASS(wxClientBase)
127 public:
128 inline wxClientBase(void) {};
129 inline ~wxClientBase(void) {};
130 virtual bool ValidHost(const wxString& host) = 0;
131 virtual wxConnectionBase *MakeConnection(const wxString& host, const wxString& server, const wxString& topic) = 0;
132 // Call this to make a connection.
133 // Returns NULL if cannot.
134 virtual wxConnectionBase *OnMakeConnection(void) = 0; // Tailor this to return own connection.
135
136};
137
138#endif
34138703 139 // _WX_IPCBASEH__