本文整理汇总了C++中Tags::erase方法的典型用法代码示例。如果您正苦于以下问题:C++ Tags::erase方法的具体用法?C++ Tags::erase怎么用?C++ Tags::erase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tags
的用法示例。
在下文中一共展示了Tags::erase方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _promoteToCommonAncestor
void TagComparator::_promoteToCommonAncestor(Tags& t1, Tags& t2, Tags& result)
{
OsmSchema& schema = OsmSchema::getInstance();
// we're deleting as we iterate so be careful making changes.
for (Tags::iterator it1 = t1.begin(); it1 != t1.end(); )
{
for (Tags::iterator it2 = t2.begin(); it2 != t2.end(); )
{
const SchemaVertex& ancestor = schema.getFirstCommonAncestor(it1.key() + "=" + it1.value(),
it2.key() + "=" + it2.value());
if (ancestor.isEmpty() == false)
{
// erase from the iterators in a safe way
t1.erase(it1++);
t2.erase(it2++);
if (ancestor.value.isEmpty() == false)
{
result[ancestor.key] = ancestor.value;
}
}
else
{
// if we didn't erase anything then increment the iterators.
++it2;
}
}
if (it1 != t1.end())
{
++it1;
}
}
}
示例2: _addNonConflictingTags
void TagComparator::_addNonConflictingTags(Tags& t1, const Tags& t2, Tags& result)
{
OsmSchema& schema = OsmSchema::getInstance();
// we're deleting as we iterate so be careful making changes.
for (Tags::iterator it1 = t1.begin(); it1 != t1.end(); )
{
QString kvp1 = it1.key() + "=" + it1.value();
bool conflict = false;
for (Tags::const_iterator it2 = t2.begin(); it2 != t2.end(); ++it2)
{
QString kvp2 = it2.key() + "=" + it2.value();
if (schema.score(kvp1, kvp2) > 0.0)
{
conflict = true;
break;
}
}
if (conflict)
{
++it1;
}
else
{
result[it1.key()] = it1.value();
t1.erase(it1++);
}
}
}
示例3: SetDisplayFlags
void LogManager::SetDisplayFlags(const std::string& tag, unsigned char flag)
{
m_CritSection.Lock();
if (flag != 0)
{
Tags::iterator findIt = m_Tags.find(tag);
if (findIt == m_Tags.end())
m_Tags.insert(std::make_pair(tag, flag));
else
findIt->second = flag;
}
else
m_Tags.erase(tag);
m_CritSection.Unlock();
}
示例4: setDisplayFLags
void LogMgr::setDisplayFLags(const std::string& tag, unsigned char flags)
{
m_TagCriticalSection.lock();
if (flags != 0)
{
Tags::iterator findIt = m_Tags.find(tag);
if (findIt == m_Tags.end())
m_Tags.insert(std::make_pair(tag, flags));
else
findIt->second = flags;
}
else
{
m_Tags.erase(tag);
}
m_TagCriticalSection.unlock();
}
示例5: SetDisplayFlags
///////////////////////////////////////////////////////////////////////////////////////
// sets one or more display flags
///////////////////////////////////////////////////////////////////////////////////////
void LogMgr::SetDisplayFlags(const std::string& tag, unsigned char flags)
{
_tag_critical_section.Lock();
if(flags != 0)
{
Tags::iterator it = _tags.find(tag);
if(it == _tags.end())
_tags.insert(std::make_pair(tag, flags));
else
it->second = flags;
}
else
{
_tags.erase(tag);
}
_tag_critical_section.Unlock();
}