TelepathyIM / telepathy-qt

Telepathy Qt bindings
https://telepathy.freedesktop.org
GNU Lesser General Public License v2.1
25 stars 14 forks source link

Add initializer_list constructors to all generated list types #22

Closed Kaffeine closed 5 years ago

Kaffeine commented 7 years ago

We need to adjust generator (qt-types-gen.py:302, qt-types-gen.py:563) to add std::initializer_list<T> args, where T is array_of.

Expected diff in generated files:

struct TP_QT_EXPORT UIntList : public QList<uint>
{
    UIntList() : QList<uint>() {}
    UIntList(const QList<uint>& a) : QList<uint>(a) {}
+   UIntList(std::initializer_list<uint> args) : QList<uint>(args) { }

    UIntList& operator=(const QList<uint>& a)
    {
        *(static_cast<QList<uint>*>(this)) = a;
        return *this;
    }
};
gkiagia commented 7 years ago

+1, feel free to do it. It can't break anything, I believe.

Kaffeine commented 5 years ago

https://github.com/TelepathyIM/telepathy-qt/commit/c5fad064883a53800159aec845815f91b3ea8459