Beispiel #1
0
bool KeyValueTagFilter::p_matches(const IPrimitive & primitive)
{
	if (m_Key.empty())
		return false;

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

		checkKeyIdCache();
		checkValueIdCache();

		m_LatestMatch = findTag<IPrimitive>(primitive, m_KeyId, m_ValueId);
		return m_LatestMatch > -1;
	}

	m_LatestMatch = -1;

	for (int i = 0; i < primitive.tagsSize(); ++i)
	{
		if ((primitive.key(i) == m_Key) && primitive.value(i) == m_Value)
		{
			m_LatestMatch = i;
			return true;
		}
	}

	return false;
}
Beispiel #2
0
bool MultiKeyMultiValueTagFilter::p_matches(const IPrimitive& primitive)
{
	for(int i(0), s(primitive.tagsSize()); i < s; ++i)
	{
		ValueMap::const_iterator it( m_ValueMap.find(primitive.key(i)) );
		if ( it != m_ValueMap.end() && it->second.count(primitive.value(i)) )
		{
			return true;
		}
	
	}
	return false;
}
Beispiel #3
0
bool KeyMultiValueTagFilter::p_uncached_match(const IPrimitive & primitive)
{
	if (m_Key.empty())
		return false;

	m_LatestMatch = -1;

	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;
}
Beispiel #4
0
bool KeyValueTagFilter::p_uncached_match(const IPrimitive & primitive)
{
	if (m_Key.empty())
		return false;

	m_LatestMatch = -1;

	for (int i = 0; i < primitive.tagsSize(); ++i)
	{
		if ((primitive.key(i) == m_Key) && primitive.value(i) == m_Value)
		{
			m_LatestMatch = i;
			return true;
		}
	}

	return false;
}
Beispiel #5
0
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;
	}
}
Beispiel #6
0
bool IntTagFilter::p_uncached_match(const IPrimitive & primitive)
{
	if (m_Key.empty())
		return false;

	m_LatestMatch = -1;

	for (int i = 0; i < primitive.tagsSize(); ++i)
	{
		if (primitive.key(i) == m_Key)
		{
			char * endptr;
			auto intTagValue = strtol(primitive.value(i).c_str(), &endptr, 10);

			if ((*endptr == '\0') && (intTagValue == m_Value))
			{
				m_LatestMatch = i;
				return true;
			}
		}
	}
	return false;
}
Beispiel #7
0
bool IntTagFilter::p_matches(const IPrimitive & primitive)
{
	if (m_Key.empty())
		return false;

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

		checkKeyIdCache();
		checkValueIdCache();

		m_LatestMatch = findTag<IPrimitive>(primitive, m_KeyId, m_ValueId);
		return m_LatestMatch > -1;
	}

	m_LatestMatch = -1;

	for (int i = 0; i < primitive.tagsSize(); ++i)
	{
		if (primitive.key(i) == m_Key)
		{
			char * endptr;
			int intTagValue = strtol(primitive.value(i).c_str(), &endptr, 10);

			if ((*endptr == '\0') && (intTagValue == m_Value))
			{
				m_LatestMatch = i;
				return true;
			}
		}
	}

	return false;
}
Beispiel #8
0
void printTags(std::ostream & out, const IPrimitive & prim, const std::string & prefix)
{
	for(uint32_t i = 0, s = prim.tagsSize();  i < s; ++i) {
		out << prefix << "<tag k=" << prim.key(i) << " v=" << prim.value(i) << ">\n";
	}
}