/****************************************************************************
**
** Copyright (C) 1992-2004 Trolltech AS. All rights reserved.
**
** This file is part of the compatibility classes of the Qt Toolkit.
**
** Licensees holding valid Qt Preview licenses may use this file in
** accordance with the Qt Preview License Agreement provided with the
** Software.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
****************************************************************************/

#ifndef QPTRCOLLECTION_H
#define QPTRCOLLECTION_H

#include "qglobal.h"


class QGVector;
class QGList;
class QGDict;


class Q_COMPAT_EXPORT QPtrCollection                        // inherited by all collections
{
public:
    bool autoDelete()        const               { return del_item; }
    void setAutoDelete(bool enable)  { del_item = enable; }

    virtual uint  count() const = 0;
    virtual void  clear() = 0;                        // delete all objects

    typedef void *Item;                                // generic collection item

protected:
    QPtrCollection() { del_item = false; }                // no deletion of objects
    QPtrCollection(const QPtrCollection &) { del_item = false; }
    virtual ~QPtrCollection() {}

    bool del_item;                                // default false

    virtual Item     newItem(Item);                // create object
    virtual void     deleteItem(Item) = 0;        // delete object
};

#endif // QPTRCOLLECTION_H
