wvuing/Utils/RCAPointerArray.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 18 Jan 2010 20:12:18 +0200
changeset 1 9018c32e7116
parent 0 094583676ce7
permissions -rw-r--r--
Revision: 201001 Kit: 201003

/*
* Copyright (c) 2002-2005 Nokia Corporation and/or its subsidiary(-ies). 
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  Wrapper for RPointerArray that destructs it's contents automatically
*
*/


#ifndef RCAPOINTERARRAY_H
#define RCAPOINTERARRAY_H

//  INCLUDES
#include <e32cmn.h>

// CLASS DECLARATION

/**
 *  Wrapper for RPointerArray.
 *	Destructs it's contents automatically.
 *
 *  @lib none
 *  @since Series 60 3.0
 */
template <class T>
class RCAPointerArray : public RPointerArray<T>
    {
    public:		// Constructors and destructor

        /**
         * C++ default constructor.
         */
        inline RCAPointerArray( TBool aOwnsItems = EFalse )
                : iOwnsItems( aOwnsItems ) {};

        /**
         * Destructor.
         */
        inline virtual ~RCAPointerArray()
            {
            iOwnsItems ? RPointerArray<T>::ResetAndDestroy() : RPointerArray<T>::Close();
            }

    public: 	// new function

        /**
         * Set item ownership
         */
        inline void SetItemOwnership( TBool aOwnsItems )
            {
            iOwnsItems = aOwnsItems;
            }

    private:	// data

        TBool iOwnsItems;

    };

#endif      // RCAPOINTERARRAY_H

// End of File