当前位置: 首页>>代码示例>>C++>>正文


C++ QMultiHash::isEmpty方法代码示例

本文整理汇总了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");
}
开发者ID:MariaLitvinova,项目名称:csc-informationRetrieval,代码行数:33,代码来源:main.cpp

示例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;
}
开发者ID:Olti,项目名称:mythtv,代码行数:86,代码来源:mythiowrapper.cpp


注:本文中的QMultiHash::isEmpty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。