本文整理汇总了C++中Tags::end方法的典型用法代码示例。如果您正苦于以下问题:C++ Tags::end方法的具体用法?C++ Tags::end怎么用?C++ Tags::end使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tags
的用法示例。
在下文中一共展示了Tags::end方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _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++);
}
}
}
示例2: _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;
}
}
}
示例3: _overwriteUnrecognizedTags
void TagComparator::_overwriteUnrecognizedTags(Tags& t1, Tags& t2, Tags& result)
{
OsmSchema& schema = OsmSchema::getInstance();
const Tags t1Copy = t1;
for (Tags::ConstIterator it1 = t1Copy.begin(); it1 != t1Copy.end(); ++it1)
{
// if this is an unknown type
if (schema.getTagVertex(it1.key() + "=" + it1.value()).isEmpty() &&
schema.getTagVertex(it1.key()).isEmpty())
{
// if this is also in t2.
if (t2.contains(it1.key()))
{
result[it1.key()] = it1.value();
t1.remove(it1.key());
t2.remove(it1.key());
}
}
}
// go through any remaining tags in t2
const Tags t2Copy = t2;
for (Tags::ConstIterator it2 = t2Copy.begin(); it2 != t2Copy.end(); ++it2)
{
// if this is an unknown type
if (schema.getTagVertex(it2.key() + "=" + it2.value()).isEmpty())
{
// we know it isn't in t1, or it would have been handled in the above loop so just deal with
// t2
t2.remove(it2.key());
result[it2.key()] = it2.value();
}
}
}
示例4: _mergeText
void TagComparator::_mergeText(Tags& t1, Tags& t2, Tags& result)
{
OsmSchema& schema = OsmSchema::getInstance();
const Tags t1Copy = t1;
for (Tags::ConstIterator it1 = t1Copy.begin(); it1 != t1Copy.end(); ++it1)
{
const SchemaVertex& tv = schema.getTagVertex(it1.key());
// if this is a text field and it exists in both tag sets.
if (tv.valueType == Text && t2.contains(it1.key()))
{
// only keep the unique text fields
QStringList values = t1.getList(it1.key());
values.append(t2.getList(it1.key()));
// append all unique values in the existing order.
for (int i = 0; i < values.size(); i++)
{
if (values[i].isEmpty() == false)
{
result.appendValueIfUnique(it1.key(), values[i]);
}
}
t1.remove(it1.key());
t2.remove(it1.key());
}
}
}
示例5: Error
//------------------------------------------------------------------------------------------------------------------------------------
// Helper for ErrorMessenger.
//------------------------------------------------------------------------------------------------------------------------------------
LogMgr::ErrorDialogResult LogMgr::Error(const std::string& errorMessage, bool isFatal, const char* funcName, const char* sourceFile, unsigned int lineNum)
{
string tag = ((isFatal) ? ("FATAL") : ("ERROR"));
// buffer for our final output string
string buffer;
GetOutputBuffer(buffer, tag, errorMessage, funcName, sourceFile, lineNum);
// write the final buffer to all the various logs
m_tagCriticalSection.Lock();
Tags::iterator findIt = m_tags.find(tag);
if (findIt != m_tags.end())
OutputFinalBufferToLogs(buffer, findIt->second);
m_tagCriticalSection.Unlock();
// show the dialog box
int result = ::MessageBoxA(NULL, buffer.c_str(), tag.c_str(), MB_ABORTRETRYIGNORE|MB_ICONERROR|MB_DEFBUTTON3);
// act upon the choice
switch (result)
{
case IDIGNORE : return LogMgr::LOGMGR_ERROR_IGNORE;
case IDABORT : __debugbreak(); return LogMgr::LOGMGR_ERROR_RETRY; // assembly language instruction to break into the debugger
case IDRETRY : return LogMgr::LOGMGR_ERROR_RETRY;
default : return LogMgr::LOGMGR_ERROR_RETRY;
}
}
示例6: _mergeUnrecognizedTags
void TagComparator::_mergeUnrecognizedTags(Tags& t1, Tags& t2, Tags& result)
{
OsmSchema& schema = OsmSchema::getInstance();
const Tags t1Copy = t1;
for (Tags::ConstIterator it1 = t1Copy.begin(); it1 != t1Copy.end(); ++it1)
{
// if this is an unknown type
if (schema.getTagVertex(it1.key() + "=" + it1.value()).isEmpty() &&
schema.getTagVertex(it1.key()).isEmpty())
{
// if this is also in t2.
if (t2.contains(it1.key()))
{
// get the set of all values.
QSet<QString> values = _toSet(t1, it1.key());
values.unite(_toSet(t2, it1.key()));
QList<QString> sortEm = values.toList();
qSort(sortEm);
// remove it from the inputs
t1.remove(it1.key());
t2.remove(it1.key());
// set the united set in the output
result.set(it1.key(), sortEm.begin(), sortEm.end());
}
else
{
result[it1.key()] = it1.value();
}
}
}
// go through any remaining tags in t2
const Tags t2Copy = t2;
for (Tags::ConstIterator it2 = t2Copy.begin(); it2 != t2Copy.end(); ++it2)
{
// if this is an unknown type
if (schema.getTagVertex(it2.key() + "=" + it2.value()).isEmpty())
{
// we know it isn't in t1, or it would have been handled in the above loop so just deal with
// t2
t2.remove(it2.key());
result[it2.key()] = it2.value();
}
}
}
示例7: nonNameTagsExactlyMatch
bool TagComparator::nonNameTagsExactlyMatch(const Tags& t1, const Tags& t2)
{
const Qt::CaseSensitivity caseSensitivity =
_caseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive;
Tags t1Filtered;
for (Tags::const_iterator it1 = t1.begin(); it1 != t1.end(); it1++)
{
QString key = it1.key();
QString value = it1.value();
if (!Tags::getNameKeys().contains(key, caseSensitivity) &&
//Metadata keys are controlled by hoot and, therefore, should always be lower case, so no
//case check needed.
!OsmSchema::getInstance().isMetaData(key, value))
{
if (!_caseSensitive)
{
key = key.toUpper();
value = value.toUpper();
}
t1Filtered.insert(key, value);
}
}
Tags t2Filtered;
for (Tags::const_iterator it2 = t2.begin(); it2 != t2.end(); it2++)
{
QString key = it2.key();
QString value = it2.value();
if (!Tags::getNameKeys().contains(key, caseSensitivity) &&
!OsmSchema::getInstance().isMetaData(key, value))
{
if (!_caseSensitive)
{
key = key.toUpper();
value = value.toUpper();
}
t2Filtered.insert(key, value);
}
}
return t1Filtered == t2Filtered;
}
示例8: Log
void LogManager::Log(const std::string& tag, const std::string& msg, const char* funcName, const char* fileName, unsigned int lineNum)
{
m_CritSection.Lock();
Tags::iterator findIt = m_Tags.find(tag);
if (findIt != m_Tags.end())
{
std::string buffer;
GetOutputBuffer(buffer, tag, msg, funcName, fileName, lineNum);
OutputBufferToLogs(buffer, findIt->second);
}
m_CritSection.Unlock();
}
示例9: sort_operations_recursive
/* topological (depth-first) sorting of operations */
static void sort_operations_recursive(NodeOperationBuilder::Operations &sorted, Tags &visited, NodeOperation *op)
{
if (visited.find(op) != visited.end())
return;
visited.insert(op);
for (int i = 0; i < op->getNumberOfInputSockets(); ++i) {
NodeOperationInput *input = op->getInputSocket(i);
if (input->isConnected())
sort_operations_recursive(sorted, visited, &input->getLink()->getOperation());
}
sorted.push_back(op);
}
示例10: 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();
}
示例11: add_group_operations_recursive
static void add_group_operations_recursive(Tags &visited, NodeOperation *op, ExecutionGroup *group)
{
if (visited.find(op) != visited.end())
return;
visited.insert(op);
if (!group->addOperation(op))
return;
/* add all eligible input ops to the group */
for (int i = 0; i < op->getNumberOfInputSockets(); ++i) {
NodeOperationInput *input = op->getInputSocket(i);
if (input->isConnected())
add_group_operations_recursive(visited, &input->getLink()->getOperation(), group);
}
}
示例12: 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();
}
示例13: Log
///////////////////////////////////////////////////////////////////////////////////////////////////////
// this function builds up the log string and outputs it to various places based on display flags
///////////////////////////////////////////////////////////////////////////////////////////////////////
void LogMgr::Log(const string& tag, const string& message, const char* func, const char* source, unsigned int line)
{
_tag_critical_section.Lock();
Tags::iterator it = _tags.find(tag);
if(it != _tags.end())
{
_tag_critical_section.Unlock();
string buffer;
GetOutputBuffer(buffer, tag, message, func, source, line);
OutputFinalBufferToLogs(buffer, it->second);
}
else
{
//critical section is exited in the if above, so need to do it here if above wasnt executed
_tag_critical_section.Unlock();
}
}
示例14: 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();
}
示例15: log
void LogMgr::log(const std::string& tag, const std::string& message, const char* funcName, const char* sourceFile, unsigned int lineNum)
{
m_TagCriticalSection.lock();
Tags::iterator findIt = m_Tags.find(tag);
if (findIt != m_Tags.end())
{
m_TagCriticalSection.unlock();
std::string buffer;
getOutputBuffer(buffer, tag, message, funcName, sourceFile, lineNum);
outputFinalBufferToLogs(buffer, tag, findIt->second);
}
else
{
m_TagCriticalSection.unlock();
}
}