// DO NOT EDIT: this file is automagically generated by FILL.
//
// The SIP interface definition for %(ARRAY)s.
//
// Copyright (C) 2001-2005 Gerard Vermeulen
// Copyright (C) 2000 Mark Colclough
//
// This file is part of PyQwt.
//
// -- LICENSE --
//
// PyQwt is free software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option) any later
// version.
//
// PyQwt 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 PyQwt; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
//
// In addition, as a special exception, Gerard Vermeulen gives permission to
// link PyQwt dynamically with commercial, non-commercial or educational
// versions of Qt, PyQt and sip, and distribute PyQwt in this form, provided
// that equally powerful versions of Qt, PyQt and sip have been released under
// the terms of the GNU General Public License.
//
// If PyQwt is dynamically linked with commercial, non-commercial or
// educational versions of Qt, PyQt and sip, PyQwt3D becomes a free plug-in for
// a non-free program.
//
// -- LICENSE --


class %(ARRAY)s
{

%%TypeHeaderCode%(HEAD)s
%%End // %%TypeHeaderCode

public:
    %(ARRAY)s();
    %(ARRAY)s(int);
    %(ARRAY)s(const %(ARRAY)s &);
    %(ARRAY)s(SIP_PYOBJECT); 
%%MethodCode
    QwtArray<%(ITEM)s> array;
    // Numeric is not thread-safe
    if (-1 == try_PyObject_to_QwtArray(a0, array))
        return 0;

    sipCpp = new %(ARRAY)s(array);
%%End
    ~%(ARRAY)s(); 
    // not possible: QwtArray<type> &operator=(const QArray<type> &); 
    // not Pythonic: type *data() const;
    // not Pythonic: uint nrefs() const; 
    uint size() const;
    uint count() const;
    bool isEmpty() const;
    bool isNull() const;
    bool resize(uint);
    bool truncate(uint);
    bool fill(const %(ITEM)s, int = -1);
    void detach();
    %(ARRAY)s copy() const;
    %(ARRAY)s & assign(const %(ARRAY)s &);
    // not Pythonic: QwtArray<type> & assign(const type *, uint); 
    %(ARRAY)s & duplicate(const %(ARRAY)s &);
    // not Pythonic: QwtArray<type> & duplicate(const type *, uint); 
    // not Pythonic: QwtArray<type> & setRawData(const type *, uint);
    // not Pythonic: void resetRawData(const type *, uint);
    int find(const %(ITEM)s &, uint = 0) const;
    int contains(const %(ITEM)s &) const;
    void sort();
    int bsearch(const %(ITEM)s &) const;
    // see __getitem__: type & operator[](int) const;
    %(ITEM)s /* & */ at(uint) const;
    // pulls in unwanted operators: bool operator==(const %(ARRAY)s &) const;
    // pulls in unwanted operators: bool operator!=(const %(ARRAY)s &) const;
    // FIXME: Iterator begin();
    // FIXME: Iterator end();
    // FIXME: ConstIterator begin() const;
    // FIXME: ConstIterator end() const;

    %(ITEM)s __getitem__(int);
%%MethodCode
    int len = sipCpp -> size();
    
    if (0 > (a0 = sipConvertFromSequenceIndex(a0, len)))
        sipIsErr = 1;
    else
        sipRes = (*sipCpp)[a0];
%%End

    int __len__() const;
%%MethodCode
    sipRes = sipCpp -> size();
%%End

    void __setitem__(int, %(ITEM)s);
%%MethodCode
    int len = sipCpp -> size();

    if (0 > (a0 = sipConvertFromSequenceIndex(a0, len)))
        sipIsErr = 1;
    else
        (*sipCpp)[a0] = a1;
%%End

    void __setitem__(SIP_PYSLICE, const %(ARRAY)s &);
%%MethodCode
    int len = sipCpp -> size();
    int start, stop, step, slicelength;

    if (0 > sipConvertFromSliceObject(a0, len,
                                      &start, &stop, &step, &slicelength))
        sipIsErr = 1;
    else {
        int vlen = a1 -> size();

        if (vlen != slicelength) {
            sipBadLengthForSlice(vlen, slicelength);
            sipIsErr = 1;
        } else {
            %(ARRAY)s::ConstIterator it = a1 -> begin();

            for (int i = 0; i < slicelength; ++i) {
                (*sipCpp)[start] = *it;
                start += step;
                ++it;
            }
        }
    }
%%End

}; // class %(ARRAY)s


// Local Variables:
// mode: C++
// c-file-style: "stroustrup"
// indent-tabs-mode: nil
// End:
