sl@0: /* sl@0: * Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: /** sl@0: @file sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: sl@0: #ifndef __RMPOINTERARRAY_H__ sl@0: #define __RMPOINTERARRAY_H__ sl@0: sl@0: sl@0: /** sl@0: * An array of pointers to objects, that adds close type behaviour. sl@0: * sl@0: * For use with M class pointers, which have a release method and are owned by sl@0: * the array. When the array is closed, the objects will be released. sl@0: * sl@0: * @see RMPointerArray sl@0: * @since v7.0 sl@0: */ sl@0: template class RMPointerArray : public RPointerArray sl@0: { sl@0: public: sl@0: /** Constructor */ sl@0: inline RMPointerArray(); sl@0: /** Frees all resources, calling Release() on the contents of the array */ sl@0: inline void Close(); sl@0: }; sl@0: sl@0: /** Default constructor. */ sl@0: template sl@0: inline RMPointerArray::RMPointerArray() sl@0: { sl@0: } sl@0: sl@0: /** sl@0: * Closes the array and frees all resources; this includes deleting the objects sl@0: * whose pointers are held by the array. sl@0: */ sl@0: template sl@0: inline void RMPointerArray::Close() sl@0: { sl@0: TInt count = this->Count(); sl@0: for (TInt ii = 0; ii < count; ii++) sl@0: (*this)[ii]->Release(); sl@0: this->Reset(); sl@0: } sl@0: sl@0: #endif