本文整理汇总了C++中QMap::erase方法的典型用法代码示例。如果您正苦于以下问题:C++ QMap::erase方法的具体用法?C++ QMap::erase怎么用?C++ QMap::erase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMap
的用法示例。
在下文中一共展示了QMap::erase方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: remove
/*!
Removes the mapping from application \a app to its process id.
\internal
*/
void OomPrivate::remove(const QString& app)
{
if (app.isEmpty())
return;
int pid = 0;
QMap<QString,int>::iterator i;
i = important_procs_.find(app);
if (i != important_procs_.end()) {
pid = i.value();
important_procs_.erase(i);
qLog(OOM) << "Removed important proc:" << app << pid;
return;
}
i = critical_procs_.find(app);
if (i != critical_procs_.end()) {
pid = i.value();
critical_procs_.erase(i);
qLog(OOM) << "Removed critical proc:" << app << pid;
return;
}
i = expendable_procs_.find(app);
if (i != expendable_procs_.end()) {
pid = i.value();
expendable_procs_.erase(i);
qLog(OOM) << "Removed expendable proc:" << app << pid;
return;
}
}
示例2:
ConfCertDialog::~ConfCertDialog()
{
QMap<RsPeerId, ConfCertDialog*>::iterator it = instances_ssl.find(peerId);
if (it != instances_ssl.end())
instances_ssl.erase(it);
QMap<RsPgpId, ConfCertDialog*>::iterator it2 = instances_pgp.find(pgpId);
if (it2 != instances_pgp.end())
instances_pgp.erase(it2);
}
示例3:
ConfCertDialog::~ConfCertDialog()
{
// if(peerId.isNull())
{
QMap<RsPeerId, ConfCertDialog*>::iterator it = instances_ssl.find(peerId);
if (it != instances_ssl.end())
instances_ssl.erase(it);
}
// else
{
QMap<RsPgpId, ConfCertDialog*>::iterator it = instances_pgp.find(pgpId);
if (it != instances_pgp.end())
instances_pgp.erase(it);
}
}
示例4: prepareScreens
void ConfigurationScreens::prepareScreens(QMap<int, OutputScreen *> & screens) {
BackendConfiguration * config = BackendConfigurations::self()->activeBackendConfiguration();
if (! config) {
return;
}
if (config->name() == "external") {
screens.clear();
return;
}
QMap<int, QRect> layout = config->realLayout();
for (QMap<int, QRect>::const_iterator i = layout.constBegin(); i != layout.constEnd(); ++i) {
if (screens.contains(i.key())) {
screens[i.key()]->_setGeom(i.value());
} else {
OutputScreen * screen = new OutputScreen(this);
screen->_setId(i.key());
screen->_setGeom(i.value());
screens.insert(screen->id(), screen);
}
}
for (QMap<int, OutputScreen *>::iterator i = screens.begin(); i != screens.end();) {
if (! layout.contains(i.key())) {
i = screens.erase(i);
} else {
++i;
}
}
}
示例5:
ConfCertDialog::~ConfCertDialog()
{
QMap<std::string, ConfCertDialog*>::iterator it = instances.find(mId);
if (it != instances.end()) {
instances.erase(it);
}
}
示例6: fileUnlock
/*!
Convenience function that attempts to unlock the file with identifier \a id that was locked by \c QMail::fileLock.
Returns \c true for success or \c false otherwise.
\sa QMail::fileLock()
*/
bool QMail::fileUnlock(int id)
{
#ifdef Q_OS_WIN
QMap<int, HANDLE>::iterator it = lockedFiles.find(id);
if (it != lockedFiles.end()) {
if (::UnlockFile(it.value(), 0, 0, 1, 0) == FALSE) {
qWarning() << "Unable to unlock file:" << lastSystemErrorMessage();
} else {
if (::CloseHandle(it.value()) == FALSE) {
qWarning() << "Unable to close handle:" << lastSystemErrorMessage();
}
lockedFiles.erase(it);
return true;
}
}
return false;
#else
int result = -1;
result = ::close(id);
if (result == -1)
return false;
return true;
#endif
}
示例7:
extern "C" void qtns_destroy(QtNPInstance *This)
{
QMap<QtNPInstance *, QX11EmbedWidget *>::iterator it = clients.find(This);
if (it == clients.end())
return;
delete it.value();
clients.erase(it);
}
示例8: addTranslator
bool Injector::addTranslator(QString fn) {
if (_repMap.contains(fn))
_repMap.erase(_repMap.find(fn));
if (!_newTrans.contains(fn))
_newTrans[fn] = (new QTranslator());
return Injector::instance().Wrapper->Call_QTranslator_load(_newTrans[fn], fn, QString(), QString(), QString());
}
示例9: removeCustomField
void removeCustomField(const QString &name)
{
QMap<QString, QString>::iterator it = _customFields.find(name);
if (it != _customFields.end()) {
_customFields.erase(it);
_customFieldsModified = true;
}
}
示例10: clear
static void clear(QMap<int, T*> &temp) {
QMap<int, T*> clearMap = temp;
typename QMap<int, T*>::iterator it;
for(it = clearMap.begin(); it != clearMap.end(); )
{
SAFE_DELETE(it.value());
clearMap.erase(it++);
}
clearMap.clear();
}
示例11: locker
ReferenceCounter::~ReferenceCounter(void)
{
if (m_referenceCount.fetchAndAddRelaxed(0) > 1)
{
LOG(VB_GENERAL, LOG_ERR,
"Object deleted with non-zero or one reference count!");
}
#ifdef LEAK_DEBUG
QWriteLocker locker(&leakLock);
leakMap.erase(leakMap.find(this));
#endif
}
示例12: foldNode
static void foldNode(QDomElement &docElem, QDomElement &e, QMap<QString,QDomElement> &dupeList, QString s=QString()) //krazy:exclude=passbyvalue
{
if (s.isEmpty())
s = e.text();
QMap<QString,QDomElement>::iterator it = dupeList.find(s);
if (it != dupeList.end())
{
kDebug(7021) << e.tagName() << "and" << s << "requires combining!";
docElem.removeChild(*it);
dupeList.erase(it);
}
dupeList.insert(s, e);
}
示例13: removeDamageWatch
void FdoSelectionManager::removeDamageWatch(QWidget *container)
{
#if defined(HAVE_XFIXES) && defined(HAVE_XDAMAGE) && defined(HAVE_XCOMPOSITE)
for (QMap<WId, DamageWatch*>::Iterator it = damageWatches.begin(); it != damageWatches.end(); ++it)
{
DamageWatch *damage = *(it);
if (damage->container == container) {
XDamageDestroy(QX11Info::display(), damage->damage);
damageWatches.erase(it);
delete damage;
break;
}
}
#endif
}
示例14: main
int main ()
{
QMap<char,int> myQMap;
myQMap['a']=10;
myQMap['b']=20;
myQMap['c']=30;
while (!myQMap.empty())
{
cout << myQMap.begin().key() << " => ";
cout << myQMap.begin().value() << endl;
myQMap.erase(myQMap.begin());
}
assert(!myQMap.empty());
return 0;
}
示例15: fileUnlock
/*!
Convenience function that attempts to unlock the file with identifier \a id that was locked by \c QMail::fileLock.
Returns \c true for success or \c false otherwise.
\sa QMail::fileLock()
*/
bool QMail::fileUnlock(int id)
{
#ifdef Q_OS_WIN
QMap<int, HANDLE>::iterator it = lockedFiles.find(id);
if (it != lockedFiles.end()) {
if (::UnlockFile(it.value(), 0, 0, 1, 0) == FALSE) {
qWarning() << "Unable to unlock file:" << lastSystemErrorMessage();
} else {
if (::CloseHandle(it.value()) == FALSE) {
qWarning() << "Unable to close handle:" << lastSystemErrorMessage();
}
lockedFiles.erase(it);
return true;
}
}
return false;
#else
struct flock fl;
fl.l_type = F_UNLCK;
fl.l_whence = SEEK_SET;
fl.l_start = 0;
fl.l_len = 0;
int result = -1;
if((result = ::fcntl(id,F_SETLK, &fl)) == -1)
return false;
if((result = ::close(id)) == -1)
return false;
return true;
#endif
}