Ejemplo n.º 1
0
QDBusDataList &QDBusDataList::operator=(const QValueList< QDBusData > &other)
{
    d->list.clear();
    d->type = QDBusData::Invalid;
    d->containerItem = QDBusData();

    if(other.isEmpty())
        return *this;

    QValueList< QDBusData >::const_iterator it = other.begin();
    QValueList< QDBusData >::const_iterator endIt = other.end();

    d->type = (*it).type();

    QCString elementSignature;
    if(hasContainerItemType())
    {
        d->containerItem = other[0]; // would be nice to get an empty one

        elementSignature = d->containerItem.buildDBusSignature();
    }

    for(++it; it != endIt; ++it)
    {
        if(d->type != (*it).type())
        {
            d->type = QDBusData::Invalid;
            d->containerItem = QDBusData();

            return *this;
        }
        else if(hasContainerItemType())
        {
            if((*it).buildDBusSignature() != elementSignature)
            {
                d->type = QDBusData::Invalid;
                d->containerItem = QDBusData();

                return *this;
            }
        }
    }

    d->list = other;

    return *this;
}
Ejemplo n.º 2
0
QDBusDataList &QDBusDataList::operator<<(const QDBusData &data)
{
    if(data.type() == QDBusData::Invalid)
        return *this;

    if(d->type == QDBusData::Invalid)
    {
        d->type = data.type();

        // check if we are now have container items
        if(hasContainerItemType())
            d->containerItem = data;

        d->list << data;
    }
    else if(d->type != data.type())
    {
        qWarning("QDBusDataList: trying to add data of type %s to list of type %s", data.typeName(), QDBusData::typeName(d->type));
    }
    else if(hasContainerItemType())
    {
        QCString ourSignature = d->containerItem.buildDBusSignature();
        QCString dataSignature = data.buildDBusSignature();

        if(ourSignature != dataSignature)
        {
            qWarning(
                "QDBusDataList: trying to add data with signature %s "
                "to list with item signature %s",
                dataSignature.data(), ourSignature.data());
        }
        else
            d->list << data;
    }
    else
        d->list << data;

    return *this;
}
Ejemplo n.º 3
0
bool QDBusDataList::operator!=(const QDBusDataList& other) const
{
    if (&other == this) return false;
    if (d == other.d) return false;

    bool containerEqual = true;
    if (hasContainerItemType())
    {
        if (other.hasContainerItemType())
        {
            containerEqual = d->containerItem.buildDBusSignature() ==
                             other.d->containerItem.buildDBusSignature();
        }
        else
            containerEqual = false;
    }
    else if (other.hasContainerItemType())
        containerEqual = false;

    return d->type != other.d->type || !containerEqual || d->list != other.d->list;
}