本文整理汇总了C++中NameSet::contains方法的典型用法代码示例。如果您正苦于以下问题:C++ NameSet::contains方法的具体用法?C++ NameSet::contains怎么用?C++ NameSet::contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NameSet
的用法示例。
在下文中一共展示了NameSet::contains方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: recordDeletingDatabase
void DatabaseTracker::recordDeletingDatabase(SecurityOrigin *origin, const String& name)
{
ASSERT(!m_databaseGuard.tryLock());
ASSERT(canDeleteDatabase(origin, name));
NameSet* nameSet = m_beingDeleted.get(origin);
if (!nameSet) {
nameSet = new NameSet();
m_beingDeleted.set(origin->isolatedCopy(), nameSet);
}
ASSERT(!nameSet->contains(name));
nameSet->add(name.isolatedCopy());
}
示例2: doneDeletingDatabase
void DatabaseTracker::doneDeletingDatabase(SecurityOrigin *origin, const String& name)
{
ASSERT(!m_databaseGuard.tryLock());
NameSet* nameSet = m_beingDeleted.get(origin);
ASSERT(nameSet);
if (!nameSet)
return;
ASSERT(nameSet->contains(name));
nameSet->remove(name);
if (nameSet->isEmpty()) {
m_beingDeleted.remove(origin);
delete nameSet;
}
}
示例3: loadPlugins
void WidgetDataBase::loadPlugins()
{
typedef QMap<QString, int> NameIndexMap;
typedef QList<QDesignerWidgetDataBaseItemInterface*> ItemList;
typedef QMap<QString, QDesignerWidgetDataBaseItemInterface*> NameItemMap;
typedef QSet<QString> NameSet;
// 1) create a map of existing custom classes
NameIndexMap existingCustomClasses;
NameSet nonCustomClasses;
const int count = m_items.size();
for (int i = 0; i < count; i++) {
const QDesignerWidgetDataBaseItemInterface* item = m_items[i];
if (item->isCustom() && !item->isPromoted())
existingCustomClasses.insert(item->name(), i);
else
nonCustomClasses.insert(item->name());
}
// 2) create a list plugins
ItemList pluginList;
const QDesignerPluginManager *pm = m_core->pluginManager();
foreach(QDesignerCustomWidgetInterface* c, pm->registeredCustomWidgets())
pluginList += createCustomWidgetItem(c, pm->customWidgetData(c));
// 3) replace custom classes or add new ones, remove them from existingCustomClasses,
// leaving behind deleted items
unsigned replacedPlugins = 0;
unsigned addedPlugins = 0;
unsigned removedPlugins = 0;
if (!pluginList.empty()) {
ItemList::const_iterator cend = pluginList.constEnd();
for (ItemList::const_iterator it = pluginList.constBegin();it != cend; ++it ) {
QDesignerWidgetDataBaseItemInterface* pluginItem = *it;
const QString pluginName = pluginItem->name();
NameIndexMap::iterator existingIt = existingCustomClasses.find(pluginName);
if (existingIt == existingCustomClasses.end()) {
// Add new class.
if (nonCustomClasses.contains(pluginName)) {
designerWarning(tr("A custom widget plugin whose class name (%1) matches that of an existing class has been found.").arg(pluginName));
} else {
append(pluginItem);
addedPlugins++;
}
} else {
// replace existing info
const int existingIndex = existingIt.value();
delete m_items[existingIndex];
m_items[existingIndex] = pluginItem;
existingCustomClasses.erase(existingIt);
replacedPlugins++;
}
}
}
// 4) remove classes that have not been matched. The stored indexes become invalid while deleting.
if (!existingCustomClasses.empty()) {
NameIndexMap::const_iterator cend = existingCustomClasses.constEnd();
for (NameIndexMap::const_iterator it = existingCustomClasses.constBegin();it != cend; ++it ) {
const int index = indexOfClassName(it.key());
if (index != -1) {
remove(index);
removedPlugins++;
}
}
}
if (debugWidgetDataBase)
qDebug() << "WidgetDataBase::loadPlugins(): " << addedPlugins << " added, " << replacedPlugins << " replaced, " << removedPlugins << "deleted.";
}
示例4: isDeletingDatabase
bool DatabaseTracker::isDeletingDatabase(SecurityOrigin *origin, const String& name)
{
ASSERT(!m_databaseGuard.tryLock());
NameSet* nameSet = m_beingDeleted.get(origin);
return nameSet && nameSet->contains(name);
}