本文整理汇总了C++中ice::StringSeq::erase方法的典型用法代码示例。如果您正苦于以下问题:C++ StringSeq::erase方法的具体用法?C++ StringSeq::erase怎么用?C++ StringSeq::erase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ice::StringSeq
的用法示例。
在下文中一共展示了StringSeq::erase方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lock
void
LibraryI::remove(const BookDescription& description)
{
IceUtil::Mutex::Lock lock(*this);
//
// Note: no need to catch and retry on deadlock since all access to
// _authors is serialized.
//
try
{
StringIsbnSeqDict::iterator p = _authors.find(description.authors);
assert(p != _authors.end());
//
// Remove the isbn number from the sequence.
//
Ice::StringSeq isbnSeq = p->second;
isbnSeq.erase(remove_if(isbnSeq.begin(), isbnSeq.end(), bind2nd(equal_to<string>(), description.isbn)),
isbnSeq.end());
if(isbnSeq.empty())
{
//
// If there are no further associated isbn numbers then remove
// the record.
//
_authors.erase(p);
}
else
{
//
// Otherwise, write back the new record.
//
p.set(isbnSeq);
}
//
// This can throw EvictorDeactivatedException (which indicates
// an internal error). The exception is currently ignored.
//
_evictor->remove(createBookIdentity(description.isbn));
}
catch(const Freeze::DatabaseException& ex)
{
DatabaseException e;
e.message = ex.message;
throw e;
}
}
示例2: readDirectory
bool
NodeI::canRemoveServerDirectory(const string& name)
{
//
// Check if there's files which we didn't create.
//
Ice::StringSeq c = readDirectory(_serversDir + "/" + name);
set<string> contents(c.begin(), c.end());
contents.erase("dbs");
contents.erase("config");
contents.erase("distrib");
contents.erase("revision");
contents.erase("data");
Ice::StringSeq serviceDataDirs;
for(set<string>::const_iterator p = contents.begin(); p != contents.end(); ++p)
{
if(p->find("data_") != 0)
{
return false;
}
serviceDataDirs.push_back(*p);
}
if(!contents.empty())
{
return false;
}
c = readDirectory(_serversDir + "/" + name + "/config");
for(Ice::StringSeq::const_iterator p = c.begin() ; p != c.end(); ++p)
{
if(p->find("config") != 0)
{
return false;
}
}
if(IceUtilInternal::directoryExists(_serversDir + "/" + name + "/dbs"))
{
c = readDirectory(_serversDir + "/" + name + "/dbs");
for(Ice::StringSeq::const_iterator p = c.begin() ; p != c.end(); ++p)
{
try
{
Ice::StringSeq files = readDirectory(_serversDir + "/" + name + "/dbs/" + *p);
files.erase(remove(files.begin(), files.end(), "DB_CONFIG"), files.end());
files.erase(remove(files.begin(), files.end(), "__Freeze"), files.end());
if(!files.empty())
{
return false;
}
}
catch(const string&)
{
return false;
}
}
}
if(IceUtilInternal::directoryExists(_serversDir + "/" + name + "/data"))
{
if(!readDirectory(_serversDir + "/" + name + "/data").empty())
{
return false;
}
}
for(Ice::StringSeq::const_iterator p = serviceDataDirs.begin(); p != serviceDataDirs.end(); ++p)
{
try
{
if(!readDirectory(_serversDir + "/" + name + "/" + *p).empty())
{
return false;
}
}
catch(const string&)
{
return false;
}
}
return true;
}