]>
git.saurik.com Git - wxWidgets.git/blob - src/common/ipcbase.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: IPC base classes
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "ipcbase.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
27 #include "wx/ipcbase.h"
29 IMPLEMENT_CLASS(wxServerBase
, wxObject
)
30 IMPLEMENT_CLASS(wxClientBase
, wxObject
)
31 IMPLEMENT_CLASS(wxConnectionBase
, wxObject
)
33 wxConnectionBase::wxConnectionBase(wxChar
*buffer
, int size
)
37 m_deletebufferwhendone(FALSE
)
39 if ( buffer
== (wxChar
*)NULL
)
40 { // behave like next constructor
42 m_deletebufferwhendone
= TRUE
;
46 wxConnectionBase::wxConnectionBase()
50 m_deletebufferwhendone(TRUE
)
54 wxConnectionBase::wxConnectionBase(wxConnectionBase
& copy
)
55 : m_connected(copy
.m_connected
),
56 m_buffer(copy
.m_buffer
),
57 m_buffersize(copy
.m_buffersize
),
58 m_deletebufferwhendone(FALSE
)
61 // copy constructor would require ref-counted pointer to buffer
62 wxFAIL_MSG( _T("Copy constructor of wxConnectionBase not implemented") );
66 wxConnectionBase::~wxConnectionBase(void)
68 if ( m_deletebufferwhendone
&& m_buffer
)
72 wxChar
*wxConnectionBase::GetBufferAtLeast( size_t bytes
)
74 if ( m_buffersize
>= bytes
)
77 { // need to resize buffer
78 if ( m_deletebufferwhendone
)
79 { // we're in charge of buffer, increase it
82 m_buffer
= new wxChar
[bytes
];
85 } // user-supplied buffer, fail