本文整理汇总了C++中QMultiHash::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ QMultiHash::isEmpty方法的具体用法?C++ QMultiHash::isEmpty怎么用?C++ QMultiHash::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMultiHash
的用法示例。
在下文中一共展示了QMultiHash::isEmpty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: searchInCoordinateIndex
void searchInCoordinateIndex(QString const &pathToIndex, QString const &pathToCoordinateIndex)
{
IndexLoader loader(pathToIndex);
QMultiHash<QString, QString> hashTable = loader.loadedIndex();
if (hashTable.isEmpty()) {
qDebug() << "Index is not loaded";
}
CoordinateIndexLoader coordinateLoader(pathToCoordinateIndex);
QHash<QString, QMultiHash<QString, QString>> coordinateHashTable = coordinateLoader.loadedIndex();
if (coordinateHashTable.isEmpty()) {
qDebug() << "Coordinate index is not loaded";
}
qDebug() << "Requests: \n";
QString line = "";
Searcher search(hashTable);
CoordinateIndexSearcher coordinateSearch(coordinateHashTable);
QTextStream in(stdin);
in.setCodec(QTextCodec::codecForName("IBM 866"));
do {
line = in.readLine();
if (line != ":q") {
QStringList result = search.processRequest(line);
coordinateSearch.processRequest(result, line);
}
} while (line != ":q");
}
示例2: mythfile_open
int mythfile_open(const char *pathname, int flags)
{
LOG(VB_FILE, LOG_DEBUG, QString("mythfile_open('%1', %2)")
.arg(pathname).arg(flags));
struct stat fileinfo;
if (mythfile_stat(pathname, &fileinfo))
return -1;
if (S_ISDIR( fileinfo.st_mode )) // libmythdvdnav tries to open() a dir
return errno = EISDIR, -1;
int fileID = -1;
if (strncmp(pathname, "myth://", 7))
{
int lfd = open(pathname, flags);
if (lfd < 0)
return -1;
m_fileWrapperLock.lockForWrite();
fileID = getNextFileID();
m_localfiles[fileID] = lfd;
m_filenames[fileID] = pathname;
m_fileWrapperLock.unlock();
}
else
{
RingBuffer *rb = NULL;
RemoteFile *rf = NULL;
if ((fileinfo.st_size < 512) &&
(fileinfo.st_mtime < (time(NULL) - 300)))
{
if (flags & O_WRONLY)
rf = new RemoteFile(pathname, true, false); // Writeable
else
rf = new RemoteFile(pathname, false, true); // Read-Only
if (!rf)
return -1;
}
else
{
if (flags & O_WRONLY)
rb = RingBuffer::Create(
pathname, true, false,
RingBuffer::kDefaultOpenTimeout, true); // Writeable
else
rb = RingBuffer::Create(
pathname, false, true,
RingBuffer::kDefaultOpenTimeout, true); // Read-Only
if (!rb)
return -1;
rb->Start();
}
m_fileWrapperLock.lockForWrite();
fileID = getNextFileID();
if (rf)
m_remotefiles[fileID] = rf;
else if (rb)
m_ringbuffers[fileID] = rb;
m_filenames[fileID] = pathname;
m_fileWrapperLock.unlock();
}
m_callbackLock.lock();
if (!m_fileOpenCallbacks.isEmpty())
{
QString path(pathname);
QHashIterator<QString,Callback> it(m_fileOpenCallbacks);
while (it.hasNext())
{
it.next();
if (path.startsWith(it.key()))
it.value().m_callback(it.value().m_object);
}
}
m_callbackLock.unlock();
return fileID;
}