当前位置: 首页>>代码示例>>C++>>正文


C++ IPrimitive类代码示例

本文整理汇总了C++中IPrimitive的典型用法代码示例。如果您正苦于以下问题:C++ IPrimitive类的具体用法?C++ IPrimitive怎么用?C++ IPrimitive使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了IPrimitive类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: p_cached_match

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;
}
开发者ID:inphos42,项目名称:osmpbf,代码行数:26,代码来源:filter.cpp

示例2: p_matches

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;
	}
}
开发者ID:8enny,项目名称:OSM,代码行数:25,代码来源:filter.cpp

示例3: checkKeyIdCache

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;
}
开发者ID:8enny,项目名称:OSM,代码行数:30,代码来源:filter.cpp

示例4: p_uncached_match

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;
}
开发者ID:inphos42,项目名称:osmpbf,代码行数:11,代码来源:filter.cpp

示例5: p_matches

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;
}
开发者ID:inphos42,项目名称:osmpbf,代码行数:13,代码来源:filter.cpp

示例6: push

// IByteArray
        INumber& __stdcall push(IPrimitive& object)
        {
            const_string_t const type_string
                = object.typeof__().operator const_string_t const();
            if (type_string == L"array" || type_string == L"bytearray")
                for (object.reset__();;)
                {
                    IPrimitive& next_object = object.next__();
                    if (VT::Undefined == next_object.type__())
                        return length();
                    ecmascript::uint16_t uint16_value
                        = object.get_by_value__(next_object)
                            .get_value__().operator ecmascript::uint16_t();
                    if ((2 << 8) - 1 > uint16_value)
                        throw *new es_type_error<string_t>(L"Type Error: bytearray::push");
                    vec_.push_back(ecmascript::uint8_t(uint16_value));
                }
            ecmascript::uint16_t uint16_value = object.operator ecmascript::uint16_t();
            if (uint16_value > 0xff)
                throw *new es_type_error<string_t>(L"Type Error: bytearray::push");
            vec_.push_back(ecmascript::uint8_t(uint16_value));
            return length();
        }
开发者ID:Constellation,项目名称:zuse,代码行数:24,代码来源:bytearray.hpp

示例7: selectPrimByPath

void selectPrimByPath(IPrimitive *rootNode, const std::string &path, TPrimitiveSet &result)
{
	std::vector<std::string>	parts;
	NLMISC::explode(path, std::string("."), parts, false);
//	IPrimitive * tmpChild;

	result.clear();

	if (parts.empty())
		return;

	// handle a special case
	if (parts.size() > 1 && parts[1] == "primitive")
	{
		parts[0] += ".primitive";
		parts.erase(parts.begin()+1);
	}

	TPrimitiveSet	candidats, nextStep;
	candidats.push_back(rootNode);

	// check root validity
	std::string name;
	rootNode->getPropertyByName("name", name);
	if (name != parts.front())
		return;

	for (uint i=1; i<parts.size(); ++i)
	{
		for (uint j=0; j<candidats.size(); ++j)
		{
			for (uint k=0; k<candidats[j]->getNumChildren(); ++k)
			{
				std::string name;
				IPrimitive *child;
				candidats[j]->getChild(child, k);

				child->getPropertyByName("name", name);

				if (name == parts[i])
				{
					nextStep.push_back(child);
				}
			}
		}

		candidats.swap(nextStep);
		nextStep.clear();
	}

	result.swap(candidats);

//	for (uint i=0; i<parts.size(); ++i)
//	{
//		for (uint j=0; j<candidats.size(); ++j)
//		{
//			std::string tmpName;
//			std::vector<std::string> name;
//			candidats[j]->getPropertyByName("name", tmpName);
//			NLMISC::explode(tmpName,".",name);
//
//			bool test=false;
//			for(uint k=0;k<name.size();k++)
//			{
//				if (name.at(k)==parts[i+k])
//					test=true;
//				else
//				{
//					test=false;
//					break;
//				}
//			}
//			if (test)
//			{
//				if (i == parts.size()-1)
//				{
//				}
//				else
//				{
//					for(uint k=0;k<candidats[j]->getNumChildren();k++)
//					{
//						candidats[j]->getChild(tmpChild,k);
//						nextStep.push_back(tmpChild);
//					}
//				}
////				result.clear();
////				result.push_back(candidats[j]);
//				i+=name.size()-1;
//				break;
//			}
//
//		}
//
//		candidats.swap(nextStep);
//		nextStep.clear();
//
//		if (candidats.empty())
//			return;
//	}

//.........这里部分代码省略.........
开发者ID:mixxit,项目名称:solinia,代码行数:101,代码来源:primitive_utils.cpp

示例8: printTags

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";
	}
}
开发者ID:8enny,项目名称:OSM,代码行数:6,代码来源:xmlconverter.cpp

示例9:

bool CPrimitiveClass::CParameter::translateAutoname (std::string &result, const IPrimitive &primitive, const CPrimitiveClass &primitiveClass) const
{
	result = "";
	string::size_type strBegin = 0;
	string::size_type strEnd = 0;
	while (strBegin != Autoname.size())
	{
		strEnd = Autoname.find ('$', strBegin);
		if (strEnd == string::npos)
		{
			strEnd = Autoname.size();
			result += Autoname.substr (strBegin, strEnd-strBegin);
		}
		else
		{
			// Copy the remaining string
			result += Autoname.substr (strBegin, strEnd-strBegin);
			if (strEnd != Autoname.size())
			{
				strBegin = strEnd+1;
				strEnd = Autoname.find ('$', strBegin);
				if (strEnd == string::npos)
					strEnd = Autoname.size();
				else
				{
					string keyWord = Autoname.substr (strBegin, strEnd-strBegin);

					// Loop for the parameter
					uint i;
					for (i=0; i<primitiveClass.Parameters.size (); i++)
					{
						if (primitiveClass.Parameters[i].Name == keyWord)
						{
							// Get its string value
							string str;
							const IProperty *prop;
							if (primitive.getPropertyByName (keyWord.c_str(), prop))
							{
								// The property has been found ?
								if (prop)
								{
									// Array or string ?
									const CPropertyString *_string = dynamic_cast<const CPropertyString *>(prop);

									// Is a string ?
									if (_string)
									{
										if (!(_string->String.empty()))
										{
											result += _string->String;
											break;
										}
									}
									else
									{
										// Try an array
										const CPropertyStringArray *array = dynamic_cast<const CPropertyStringArray *>(prop);

										// Is an array ?
										if (array)
										{
											if (!(array->StringArray.empty()))
											{
												uint i;
												for (i=0; i<array->StringArray.size()-1; i++)
													result += array->StringArray[i] + "\n";
												result += array->StringArray[i];
												break;
											}
										}
									}
								}
							}

							// Get its default value
							std::string result2;
							if (primitiveClass.Parameters[i].getDefaultValue (result2, primitive, primitiveClass))
							{
								result += result2;
								break;
							}
						}
					}
					strEnd++;
				}

			}
		}
		strBegin = strEnd;
	}
	return true;
}
开发者ID:mixxit,项目名称:solinia,代码行数:92,代码来源:primitive_class.cpp


注:本文中的IPrimitive类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。