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


C++ Q_INT64_C函数代码示例

本文整理汇总了C++中Q_INT64_C函数的典型用法代码示例。如果您正苦于以下问题:C++ Q_INT64_C函数的具体用法?C++ Q_INT64_C怎么用?C++ Q_INT64_C使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Q_INT64_C函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: while

bool QMutexPrivate::wait(int timeout)
{
    struct timespec ts, *pts = 0;
    QElapsedTimer timer;
    if (timeout >= 0) {
        ts.tv_nsec = ((timeout % 1000) * 1000) * 1000;
        ts.tv_sec = (timeout / 1000);
        pts = &ts;
        timer.start();
    }
    while (contenders.fetchAndStoreAcquire(2) > 0) {
        int r = _q_futex(&contenders._q_value, FUTEX_WAIT, 2, pts, 0, 0);
        if (r != 0 && errno == ETIMEDOUT)
            return false;

        if (pts) {
            // recalculate the timeout
            qint64 xtimeout = timeout * 1000 * 1000;
            xtimeout -= timer.nsecsElapsed();
            if (xtimeout < 0) {
                // timer expired after we returned
                return false;
            }

            ts.tv_sec = xtimeout / Q_INT64_C(1000) / 1000 / 1000;
            ts.tv_nsec = xtimeout % (Q_INT64_C(1000) * 1000 * 1000);
        }
    }
    return true;
}
开发者ID:phen89,项目名称:rtqt,代码行数:30,代码来源:qmutex_unix.cpp

示例2: switch

void MWToolsOrientation::shortAction()
{
    ++m_currentstate;

    switch (m_currentstate)
    {
    case 1:
        m_value = "top";
        m_timestamp = Q_INT64_C(-1);
        setIcon(1);
        break;
    case 2:
        m_value = "left";
        m_timestamp = Q_INT64_C(-1);
        setIcon(2);
        break;
    case 3:
        m_value = "auto";
        m_timestamp = 0;
        m_currentstate=0;
        setIcon(0);
        break;
    }

    emit ValueChanged(QVariantList() << m_value, m_timestamp);
}
开发者ID:CODeRUS,项目名称:system-ui-widgets,代码行数:26,代码来源:MWToolsOrientation.cpp

示例3: Q_INT64_C

int QHexEdit::addressWidth()
{
    qint64 size = _chunks->size();
    int n = 1;
    if (size > Q_INT64_C(0x100000000)) {
        n += 8;
        size /= Q_INT64_C(0x100000000);
    }
    if (size > 0x10000) {
        n += 4;
        size /= 0x10000;
    }
    if (size > 0x100) {
        n += 2;
        size /= 0x100;
    }
    if (size > 0x10) {
        n += 1;
        size /= 0x10;
    }

    if (n > _addressWidth)
        return n;
    else
        return _addressWidth;
}
开发者ID:hellprototypes,项目名称:Hell-serial-tool,代码行数:26,代码来源:qhexedit.cpp

示例4: QObject

QGitHubReleaseAPIPrivate::QGitHubReleaseAPIPrivate(const QUrl &apiUrl, bool multi,
												   QGitHubReleaseAPI::TYPE type, QObject *p) :
	QObject(p), m_apiDownloader(new FileDownloader(apiUrl, m_userAgent)), m_jsonData(), m_vdata(),
	m_errorString(), m_rateLimit(0), m_rateLimitRemaining(0), m_singleEntryRequested(!multi),
	m_rateLimitReset(), m_avatars(), m_eTag(QString::null), m_dlOutputFile(0L),
	m_readBytes(Q_INT64_C(-1)), m_readReply(0L), m_bytesAvail(Q_INT64_C(-1)), m_type(type) {
	init();
}
开发者ID:jacmoe,项目名称:QGitHubReleaseAPI,代码行数:8,代码来源:qgithubreleaseapi_p.cpp

示例5: testCopyTo

static void testCopyTo( KArchive* archive )
{
    const KArchiveDirectory* dir = archive->directory();
    KTempDir tmpDir;
    const QString dirName = tmpDir.name();

    dir->copyTo( dirName );

    QVERIFY(QFile::exists(dirName+"dir"));
    QVERIFY(QFileInfo(dirName+"dir").isDir());

    QFileInfo fileInfo1(dirName+"dir/subdir/mediumfile2");
    QVERIFY(fileInfo1.exists());
    QVERIFY(fileInfo1.isFile());
    QCOMPARE(fileInfo1.size(), Q_INT64_C(100));

    QFileInfo fileInfo2(dirName+"hugefile");
    QVERIFY(fileInfo2.exists());
    QVERIFY(fileInfo2.isFile());
    QCOMPARE(fileInfo2.size(), Q_INT64_C(20000));

    QFileInfo fileInfo3(dirName+"mediumfile");
    QVERIFY(fileInfo3.exists());
    QVERIFY(fileInfo3.isFile());
    QCOMPARE(fileInfo3.size(), Q_INT64_C(100));

    QFileInfo fileInfo4(dirName+"my/dir/test3");
    QVERIFY(fileInfo4.exists());
    QVERIFY(fileInfo4.isFile());
    QCOMPARE(fileInfo4.size(), Q_INT64_C(29));

#ifndef Q_OS_WIN
    const QString fileName = dirName+"z/test3_symlink";
    const QFileInfo fileInfo5(fileName);
    QVERIFY(fileInfo5.exists());
    QVERIFY(fileInfo5.isFile());
    // Do not use fileInfo.readLink() for unix symlinks
    // It returns the -full- path to the target, while we want the target string "as is".
    QString symLinkTarget;
    const QByteArray encodedFileName = QFile::encodeName(fileName);
    QByteArray s;
#if defined(PATH_MAX)
    s.resize(PATH_MAX+1);
#else
    int path_max = pathconf(encodedFileName.data(), _PC_PATH_MAX);
    if (path_max <= 0) {
        path_max = 4096;
    }
    s.resize(path_max);
#endif
    int len = readlink(encodedFileName.data(), s.data(), s.size() - 1);
    if ( len >= 0 ) {
        s[len] = '\0';
        symLinkTarget = QFile::decodeName(s);
    }
    QCOMPARE(symLinkTarget, QString("test3"));
#endif
}
开发者ID:vasi,项目名称:kdelibs,代码行数:58,代码来源:karchivetest.cpp

示例6: Q_Q

void QNetworkReplyImplPrivate::_q_copyReadyRead()
{
    Q_Q(QNetworkReplyImpl);
    if (state != Working)
        return;
    if (!copyDevice || !q->isOpen())
        return;

    // FIXME Optimize to use download buffer if it is a QBuffer.
    // Needs to be done where sendCacheContents() (?) of HTTP is emitting
    // metaDataChanged ?

    forever {
        qint64 bytesToRead = nextDownstreamBlockSize();
        if (bytesToRead == 0)
            // we'll be called again, eventually
            break;

        bytesToRead = qBound<qint64>(1, bytesToRead, copyDevice->bytesAvailable());
        QByteArray byteData;
        byteData.resize(bytesToRead);
        qint64 bytesActuallyRead = copyDevice->read(byteData.data(), byteData.size());
        if (bytesActuallyRead == -1) {
            byteData.clear();
            backendNotify(NotifyCopyFinished);
            break;
        }

        byteData.resize(bytesActuallyRead);
        readBuffer.append(byteData);

        if (!copyDevice->isSequential() && copyDevice->atEnd()) {
            backendNotify(NotifyCopyFinished);
            bytesDownloaded += bytesActuallyRead;
            break;
        }

        bytesDownloaded += bytesActuallyRead;
    }

    if (bytesDownloaded == lastBytesDownloaded) {
        // we didn't read anything
        return;
    }

    lastBytesDownloaded = bytesDownloaded;
    QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader);
    if (preMigrationDownloaded != Q_INT64_C(-1))
        totalSize = totalSize.toLongLong() + preMigrationDownloaded;
    pauseNotificationHandling();
    // emit readyRead before downloadProgress incase this will cause events to be
    // processed and we get into a recursive call (as in QProgressDialog).
    emit q->readyRead();
    emit q->downloadProgress(bytesDownloaded,
                             totalSize.isNull() ? Q_INT64_C(-1) : totalSize.toLongLong());
    resumeNotificationHandling();
}
开发者ID:Suneal,项目名称:qt,代码行数:57,代码来源:qnetworkreplyimpl.cpp

示例7: switch

qint64 BitcoinUnits::maxAmount(int unit)
{
    switch(unit)
    {
    case BTC:  return Q_INT64_C(2500000000000);
    case mBTC: return Q_INT64_C(2500000000000000);
    default:   return 0;
    }
}
开发者ID:Devakkalji,项目名称:ADC,代码行数:9,代码来源:bitcoinunits.cpp

示例8: switch

qint64 CarboncoinUnits::maxAmount(int unit)
{
    switch(unit)
    {
    case CARBON:  return Q_INT64_C(21000000);
    case KCARBON: return Q_INT64_C(21000);
    case MCARBON: return Q_INT64_C(21);
    default:   return 0;
    }
}
开发者ID:carboncointrust,项目名称:CarboncoinCore,代码行数:10,代码来源:carboncoinunits.cpp

示例9: switch

qint64 BitmarkUnits::maxAmount(int unit)
{
    switch(unit)
    {
    case BTM:  return Q_INT64_C(21000000);
    case MARK: return Q_INT64_C(21000000000);
    case mb: return Q_INT64_C(21000000000000);
    default:   return 0;
    }
}
开发者ID:Amarha,项目名称:bitmark,代码行数:10,代码来源:bitmarkunits.cpp

示例10: switch

qint64 DarcoinUnits::maxAmount(int unit)
{
    switch(unit)
    {
    case DAR:  return Q_INT64_C(21000000);
    case mDAR: return Q_INT64_C(21000000000);
    case uDAR: return Q_INT64_C(21000000000000);
    default:   return 0;
    }
}
开发者ID:seraph1188,项目名称:darcoin,代码行数:10,代码来源:darcoinunits.cpp

示例11: switch

qint64 BitcoinUnits::maxAmount(int unit)
{
    switch(unit)
    {
    case LAT:  return Q_INT64_C(21000000);
    case mLAT: return Q_INT64_C(21000000000);
    case uLAT: return Q_INT64_C(21000000000000);
    default:   return 0;
    }
}
开发者ID:cptCort3z,项目名称:LatinumCoin,代码行数:10,代码来源:bitcoinunits.cpp

示例12: switch

qint64 VirtaCoinUnits::maxAmount(int unit)
{
    switch(unit)
    {
    case VTA:  return Q_INT64_C(21000000000);
    case mVTA: return Q_INT64_C(21000000000000);
    case uVTA: return Q_INT64_C(21000000000000000);
    default:   return 0;
    }
}
开发者ID:ANGEL1507,项目名称:VirtaCoinProject,代码行数:10,代码来源:virtacoinunits.cpp

示例13: readSignedByte

qint8 readSignedByte(QIODevice &device)
{
    qint8 result = 0;
    if (device.read(reinterpret_cast<char *> (&result),
            Q_INT64_C(1)) != Q_INT64_C(1))
    {
        throw std::runtime_error("Unable to read file");
    }
    return result;
}
开发者ID:rel-eng,项目名称:QWinHelp,代码行数:10,代码来源:IOUtils.cpp

示例14: switch

qint64 NautiluscoinUnits::maxAmount(int unit)
{
    switch(unit)
    {
    case NAUT:  return Q_INT64_C(21000000);
    case mNAUT: return Q_INT64_C(21000000000);
    case uNAUT: return Q_INT64_C(21000000000000);
    default:   return 0;
    }
}
开发者ID:Nosredna1970,项目名称:nautiluscoin,代码行数:10,代码来源:nautiluscoinunits.cpp

示例15: switch

qint64 iQcoinUnits::maxAmount(int unit)
{
    switch(unit)
    {
    case IQC:  return Q_INT64_C(21000000);
    case mIQC: return Q_INT64_C(21000000000);
    case uIQC: return Q_INT64_C(21000000000000);
    default:   return 0;
    }
}
开发者ID:iQcoin,项目名称:iQcoin,代码行数:10,代码来源:iQcoinunits.cpp


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