本文整理汇总了C++中InfoMap::end方法的典型用法代码示例。如果您正苦于以下问题:C++ InfoMap::end方法的具体用法?C++ InfoMap::end怎么用?C++ InfoMap::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InfoMap
的用法示例。
在下文中一共展示了InfoMap::end方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: infoPredicate
mitk::PropertyPersistence::InfoResultType mitk::PropertyPersistence::GetInfo(const std::string &propertyName,
const MimeTypeNameType &mime,
bool allowMimeWildCard,
bool allowNameRegEx) const
{
SelectFunctionType select = [propertyName, mime](const InfoMap::value_type &x) {
return infoPredicate(x, propertyName, mime);
};
InfoMap selection = SelectInfo(m_InfoMap, select);
if (allowNameRegEx)
{
select = [propertyName, mime](const InfoMap::value_type &x) { return infoPredicateRegEx(x, propertyName, mime); };
InfoMap regExSelection = SelectInfo(m_InfoMap, select);
selection.insert(regExSelection.begin(), regExSelection.end());
}
if (selection.empty() && allowMimeWildCard)
{ // no perfect match => second run through with "any mime type"
select = [propertyName](const InfoMap::value_type &x) {
return infoPredicate(x, propertyName, PropertyPersistenceInfo::ANY_MIMETYPE_NAME());
};
selection = SelectInfo(m_InfoMap, select);
if (allowNameRegEx)
{
select = [propertyName](const InfoMap::value_type &x) {
return infoPredicateRegEx(x, propertyName, PropertyPersistenceInfo::ANY_MIMETYPE_NAME());
};
InfoMap regExSelection = SelectInfo(m_InfoMap, select);
selection.insert(regExSelection.begin(), regExSelection.end());
}
}
InfoResultType result;
for (const auto &pos : selection)
{
result.push_back(pos.second->UnRegExByName(propertyName).GetPointer());
}
return result;
}
示例2: str
inline static QString toString(const InfoMap &infoMap, const QString sep="\n")
{
QString str("");
InfoMap::const_iterator it = infoMap.begin();
for (; it != infoMap.end() ; ++it)
str += QString("[%1]:%2%3").arg(it.key()).arg(*it).arg(sep);
return str;
}
示例3: updateUserInfo
inline
int UserInfoCache::updateUserInfo(int userId, UserInfo *userInfo)
{
int ret = 1;
//..
// Although we intend to update the information, we first acquire a *read*
// *lock* to locate the item. This allows other threads to read the list while
// we find the item. If we do not locate the item we can simply release the
// *read* *lock* and return an error without causing any other *reading* thread
// to block. (Again, other writers *will* block until this *read* *lock* is
// released.)
//..
d_lock.lockRead();
InfoMap::iterator it = d_infoMap.find(userId);
if (d_infoMap.end() != it) {
//..
// Since 'it != end()', we found the item. Now we need to upgrade to a *write*
// *lock*. If we can't do this atomically, then we need to locate the item
// again. This is because another thread may have changed 'd_infoMap' during
// the time between our *read* and *write* locks.
//..
if (d_lock.upgradeToWriteLock()) {
it = d_infoMap.find(userId);
}
//..
// This is a little more costly, but since we don't expect many concurrent
// writes, it should not happen often. In the (likely) event that we do
// upgrade to a *write* *lock* atomically, then the second lookup above is not
// performed. In any case, we can now update the information and release the
// lock, since we already have a pointer to the item and we know that the list
// could not have been changed by anyone else.
//..
if (d_infoMap.end() != it) {
it->second = *userInfo;
ret = 0;
}
d_lock.unlock();
}
else {
d_lock.unlock();
}
return ret;
}
示例4: SetTextFromMap
void MythGenericTree::SetTextFromMap(const InfoMap &infoMap,
const QString &state)
{
InfoMap::const_iterator map_it = infoMap.begin();
while (map_it != infoMap.end())
{
TextProperties textprop;
textprop.text = (*map_it);
textprop.state = state;
m_strings[map_it.key()] = textprop;
++map_it;
}
}
示例5: getUserInfo
inline
int UserInfoCache::getUserInfo(int userId, UserInfo *userInfo)
{
int ret = 1;
//..
// Getting the user info does not require any write access. We do, however,
// need read access to 'd_infoMap', which is controlled by 'd_lock'. (Note
// that writers *will* block until this *read* *lock* is released, but
// concurrent reads are allowed.) The user info is copied into the
// caller-owned location 'userInfo'.
//..
d_lock.lockRead();
InfoMap::iterator it = d_infoMap.find(userId);
if (d_infoMap.end() != it) {
*userInfo = it->second;
ret = 0;
}
d_lock.unlock();
return ret;
}