1//-------------------------------------------------------------------------- 2// Name: arrayholder.sip 3// Purpose: 4// 5// Author: Robin Dunn 6// 7// Created: 14-March-2012 8// Copyright: (c) 2012-2018 by Total Control Software 9// Licence: wxWindows license 10//-------------------------------------------------------------------------- 11 12// Sometimes we need to hold on to a C array and keep it alive, but typical 13// SIP code will treat it as a temporary and delete it as soon as the ctor or 14// method call is done. This class can hold a pointer to the array and will 15// delete the array in its dtor, and by making this class be wrappable we can 16// make a PyObject for it that is then owned by some other object, and 17// Python's GC will take care of the delaying the cleanup until it's no longer 18// needed. 19template <Type> 20class wxCArrayHolder 21{ 22%TypeHeaderCode 23#include "arrayholder.h" 24%End 25 26public: 27 wxCArrayHolder(); 28 ~wxCArrayHolder(); 29 30private: 31 wxCArrayHolder(const wxCArrayHolder<Type>&); // no copies 32 wxCArrayHolder& operator=(wxCArrayHolder<Type>); // no assignment 33}; 34 35typedef wxCArrayHolder<int> wxIntCArrayHolder; 36typedef wxCArrayHolder<wxString> wxStringCArrayHolder; 37typedef wxCArrayHolder<wxDash> wxDashCArrayHolder; 38 39//-------------------------------------------------------------------------- 40