Пример #1
0
Property *CDSObject::AddProperty( Property *pProp )
{
    if (pProp)
    {
        // If this property is allowed multiple times in an object
        // e.g. Different sizes of artwork, then just insert it
        // Otherwise remove all existing instances of this property first
        // NOTE: This requires ALL instances of a property which can exist
        //       more than once to have m_bAllowMulti set to true.
        if (pProp->m_bMultiValue)
            m_properties.insertMulti(pProp->m_sName, pProp);
        else
        {
            Properties::iterator it = m_properties.find(pProp->m_sName);
            while (it != m_properties.end() && it.key() == pProp->m_sName)
            {
                delete *it;
                it = m_properties.erase(it);
            }
            m_properties[pProp->m_sName] = pProp;
        }
    }

    return pProp;
}
Пример #2
0
QList<Property*> CDSObject::GetProperties( const QString &sName )
{
    QList<Property*> props;
    Properties::iterator it = m_properties.find(sName);
    while (it != m_properties.end() && it.key() == sName)
    {
        if (*it)
            props.append(*it);
        ++it;
    }

    return props;
}