mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-09 21:40:34 +01:00
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@73416 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
40 lines
1.3 KiB
Plaintext
40 lines
1.3 KiB
Plaintext
//--------------------------------------------------------------------------
|
|
// Name: arrayholder.sip
|
|
// Purpose:
|
|
//
|
|
// Author: Robin Dunn
|
|
//
|
|
// Created: 14-March-2012
|
|
// Copyright: (c) 2013 by Total Control Software
|
|
// Licence: wxWindows license
|
|
//--------------------------------------------------------------------------
|
|
|
|
// Sometimes we need to hold on to a C array and keep it alive, but typical
|
|
// SIP code will treat it as a temporary and delete it as soon as the ctor or
|
|
// method call is done. This class can hold a pointer to the array and will
|
|
// delete the array in its dtor, and by making this class be wrappable we can
|
|
// make a PyObject for it that is then owned by some other object, and
|
|
// Python's GC will take care of the delaying the cleanup until it's no longer
|
|
// needed.
|
|
template <Type>
|
|
class wxCArrayHolder
|
|
{
|
|
%TypeHeaderCode
|
|
#include "arrayholder.h"
|
|
%End
|
|
|
|
public:
|
|
wxCArrayHolder();
|
|
~wxCArrayHolder();
|
|
|
|
private:
|
|
wxCArrayHolder(const wxCArrayHolder<Type>&); // no copies
|
|
wxCArrayHolder& operator=(wxCArrayHolder<Type>); // no assignment
|
|
};
|
|
|
|
typedef wxCArrayHolder<int> wxIntCArrayHolder;
|
|
typedef wxCArrayHolder<wxString> wxStringCArrayHolder;
|
|
typedef wxCArrayHolder<wxDash> wxDashCArrayHolder;
|
|
|
|
//--------------------------------------------------------------------------
|