Пример #1
0
bool CDSObject::FilterContains(const FilterMap &filter, const QString& name) const
{
    // ContentDirectory Service, 2013 UPnP Forum
    // 2.3.18 A_ARG_TYPE_Filter

    // Exact match
    if (filter.contains(name, Qt::CaseInsensitive))
        return true;

    // # signfies that this property and all it's children must be returned
    // This is presently implemented higher up to save time

    // If an attribute is required then it's parent must also be returned
    QString dependentAttribute = QString("%1@").arg(name);
    QStringList matches = filter.filter(name, Qt::CaseInsensitive);
    QStringList::iterator it;
    for (it = matches.begin(); it != matches.end(); ++it)
    {
        if ((*it).startsWith(dependentAttribute))
            return true;
    }

    return false;
}