Beispiel #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);

}
Beispiel #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;
}
Beispiel #3
0
bool vCard::removeProperty( const Cactus::GString& name )
{
	bool bFound = false;

	vCardPropertyList::iterator it = m_properties.begin();
	while ( it != m_properties.end() )
	{
		const vCardProperty current = *it;
		if (current.name() == name)
		{
			it = m_properties.erase(it);
			if(!bFound)
				bFound = true;
		}
		else
			++it;
	}

	if( bFound )
		updateReversion();

	return bFound;
}
Beispiel #4
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;
        }
    }
bool vCardProperty::operator== (const vCardProperty& prop) const
{
    return ((m_name == prop.name()) && (m_values == prop.values()));
}
bool vCardProperty::operator!= (const vCardProperty& prop) const
{
    return ((m_name != prop.name()) || (m_values != prop.values()));
}