//
//     Copyright 2008 Simon Edwards <simon@simonzone.com>

//                 Generated by twine

// This file is part of PyKDE4.

// PyKDE4 is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of
// the License, or (at your option) any later version.

// PyKDE4 is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

uint                    qHash (const Akonadi::Entity&);
namespace Akonadi
{

class Entity
{
%TypeHeaderCode
#include <akonadi/entity.h>
%End


public:
    typedef qint64 Id;

    Id                      id () const;
    void                    setRemoteId (const QString& id);
    QString                 remoteId () const;
    bool                    isValid () const;
    bool                    operator == (const Akonadi::Entity& other) const;
    bool                    operator != (const Akonadi::Entity& other) const;
    void                    addAttribute (Akonadi::Attribute* attribute);
    void                    removeAttribute (const QByteArray& name);
    bool                    hasAttribute (const QByteArray& name) const;
    Akonadi::Attribute::List  attributes () const;
    void                    clearAttributes ();
    Akonadi::Attribute*     attribute (const QByteArray& name) const;

    enum CreateOption
    {
        AddIfMissing
    };


protected:
                            Entity (const Akonadi::Entity& other);
//ig                            Entity (EntityPrivate* dd);
    ~Entity ();
public:
    void                    setId (Akonadi::Entity::Id identifier);
    Akonadi::Collection     parentCollection () const;
//ig    Akonadi::Collection&    parentCollection ();
    void                    setParentCollection (const Akonadi::Collection& parent);
    void                    setRemoteRevision (const QString& revision);
    QString                 remoteRevision () const;
    bool                    operator < (const Akonadi::Entity& other) const;
};
// Entity

};
// Akonadi



%MappedType QList<Akonadi::Entity::Id>
{
%TypeHeaderCode
#include <qlist.h>
%End

%ConvertFromTypeCode
    // Create the list.
    PyObject *l;

    if ((l = PyList_New(sipCpp->size())) == NULL)
        return NULL;

    // Set the list elements.
    for (int i = 0; i < sipCpp->size(); ++i)
    {
        PyObject *pobj;

        if ((pobj = PyLong_FromLongLong (sipCpp->value(i))) == NULL)
        {
            Py_DECREF(l);

            return NULL;
        }

        PyList_SET_ITEM(l, i, pobj);
    }

    return l;
%End

%ConvertToTypeCode
    // Check the type if that is all that is required.
    if (sipIsErr == NULL)
        return PyList_Check(sipPy);

    QList<Akonadi::Entity::Id> *ql = new QList<Akonadi::Entity::Id>;
 
    for (int i = 0; i < PyList_GET_SIZE(sipPy); ++i)
        ql->append((Akonadi::Entity::Id)PyLong_AsLongLong(PyList_GET_ITEM(sipPy, i)));
 
    *sipCppPtr = ql;
 
    return sipGetState(sipTransferObj);
%End
};

%MappedType QVector<Akonadi::Entity::Id>
{
%TypeHeaderCode
#include <qvector.h>
%End

%ConvertFromTypeCode
    // Create the list.
    PyObject *l;

    if ((l = PyList_New(sipCpp->size())) == NULL)
        return NULL;

    // Set the list elements.
    for (int i = 0; i < sipCpp->size(); ++i)
    {
        PyObject *pobj;

        if ((pobj = PyLong_FromLongLong (sipCpp->value(i))) == NULL)
        {
            Py_DECREF(l);

            return NULL;
        }

        PyList_SET_ITEM(l, i, pobj);
    }

    return l;
%End

%ConvertToTypeCode
    // Check the type if that is all that is required.
    if (sipIsErr == NULL)
        return PyList_Check(sipPy);

    QVector<Akonadi::Entity::Id> *ql = new QVector<Akonadi::Entity::Id>;
 
    for (int i = 0; i < PyList_GET_SIZE(sipPy); ++i)
        ql->append((Akonadi::Entity::Id)PyLong_AsLongLong(PyList_GET_ITEM(sipPy, i)));
 
    *sipCppPtr = ql;
 
    return sipGetState(sipTransferObj);
%End
};

