Пример #1
0
void vCard::addProperty(const vCardProperty& property)
{
    int count = m_properties.count();
    for (int i = 0; i < count; i++)
    {
        vCardProperty current = m_properties.at(i);
        if (current.name() == property.name() && current.params() == property.params())
        {
            m_properties[i] = property;
            return;
        }
    }

    m_properties.append(property);

}
Пример #2
0
bool vCard::addProperty(const vCardProperty& prop)
{
	for (vCardPropertyList::iterator it = m_properties.begin(); it != m_properties.end(); ++it)
    {
        vCardProperty current = *it;
        if (current == prop)
		{
			return false;
		}
		else if (current.name() == prop.name() && current.params() == prop.params())
		{
			if( vCardProperty::isUniqueProperty( current.name() ) )
			{
				*it = prop;
				return true;
			}
        }
    }

    m_properties.push_back(prop);

	return true;
}
Пример #3
0
vCardProperty vCard::property(const Cactus::GString& name, const vCardParamList& params, bool strict) const
{
	for (vCardPropertyList::const_iterator it = m_properties.begin(); it != m_properties.end(); ++it)
	{
		const vCardProperty current = *it;
        if (current.name() == name)
        {
            vCardParamList current_params = current.params();

            if (strict)
            {
                if (params != current_params)
                    continue;
            }
            else
            {
                M_Foreach_Const (vCardParam, param, vCardParamList, params)
					if (std::find(current_params.begin(), current_params.end(), param) == current_params.end())
                        continue;
            }

            return current;
        }
    }