Example #1
0
bool MultiKeyTagFilter::p_cached_match(const IPrimitive& primitive)
{
	if (m_KeySet.empty())
	{
		return false;
	}

	if (m_PBI->isNull())
	{
		return false;
	}
	
	if (!m_IdSet.size())
	{
		return false;
	}
	
	for(int i(0), s(primitive.tagsSize()); i < s; ++i)
	{
		if (m_IdSet.count( primitive.keyId(i) ))
		{
			return true;
		}
	}
	return false;
}
Example #2
0
File: filter.cpp Project: 8enny/OSM
bool RegexKeyTagFilter::p_matches(const IPrimitive& primitive)
{
	if (m_dirty || !m_PBI)
	{
		for(int i(0), s(primitive.tagsSize()); i < s; ++i)
		{
			if (std::regex_match(primitive.key(i), m_regex, m_matchFlags))
			{
				return true;
			}
		}
		return false;
	}
	else
	{
		for(int i(0), s(primitive.tagsSize()); i < s; ++i)
		{
			if (m_IdSet.count(primitive.keyId(i)))
			{
				return true;
			}
		}
		return false;
	}
}
Example #3
0
bool RegexKeyTagFilter::p_uncached_match(const IPrimitive& primitive)
{
	for(int i(0), s(primitive.tagsSize()); i < s; ++i)
	{
		if (m_IdSet.count(primitive.keyId(i)))
		{
			return true;
		}
	}
	return false;
}
Example #4
0
File: filter.cpp Project: 8enny/OSM
bool KeyMultiValueTagFilter::p_matches(const IPrimitive & primitive)
{
	if (m_Key.empty())
		return false;

	m_LatestMatch = -1;

	if (m_PBI)
	{
		if (m_PBI->isNull())
			return false;

		checkKeyIdCache();

		if (!m_KeyId || m_IdSet.empty())
			return false;

		for (int i = 0; i < primitive.tagsSize(); i++)
		{
			if (primitive.keyId(i) == m_KeyId && m_IdSet.count(primitive.valueId(i)))
			{
				m_LatestMatch = -1;
				return true;
			}
		}

		return false;
	}
	else
	{
		for (int i = 0; i < primitive.tagsSize(); i++)
		{
			if (primitive.key(i) == m_Key && m_ValueSet.count(primitive.value(i)))
			{
				m_LatestMatch = -1;
				return true;
			}
		}

		return false;
	}
}