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


C++ ProbeABI::setQtVersion方法代码示例

本文整理汇总了C++中ProbeABI::setQtVersion方法的典型用法代码示例。如果您正苦于以下问题:C++ ProbeABI::setQtVersion方法的具体用法?C++ ProbeABI::setQtVersion怎么用?C++ ProbeABI::setQtVersion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ProbeABI的用法示例。


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

示例1: abiFromMachO

static ProbeABI abiFromMachO(const uchar* data, qint64 size)
{
  ProbeABI abi;
  const quint32 magic = *reinterpret_cast<const quint32*>(data);

  quint32 offset = 0;
  qint32 ncmds = 0;
  qint32 cmdsize = 0;

  switch (magic) {
    case MH_MAGIC:
      abi.setArchitecture(readMachOHeader<mach_header>(data, size, offset, ncmds, cmdsize));
      break;
    case MH_MAGIC_64:
      abi.setArchitecture(readMachOHeader<mach_header_64>(data, size, offset, ncmds, cmdsize));
      break;
  }

  if (offset >= size || ncmds <= 0 || cmdsize <= 0 || size <= offset + cmdsize)
    return ProbeABI();

  // read load commands
  for (int i = 0; i < ncmds; ++i) {
    const load_command* cmd = reinterpret_cast<const load_command*>(data + offset);
    if (cmd->cmd == LC_ID_DYLIB) {
      const dylib_command* dlcmd = reinterpret_cast<const dylib_command*>(data + offset);
      const int majorVersion = (dlcmd->dylib.current_version & 0x00ff0000) >> 16;
      const int minorVersion = (dlcmd->dylib.current_version & 0x0000ff00) >> 8;
      abi.setQtVersion(majorVersion, minorVersion);
    }
    offset += cmd->cmdsize;
  }

  return abi;
}
开发者ID:aleixpol,项目名称:GammaRay,代码行数:35,代码来源:probeabidetector_mac.cpp

示例2: qtVersionFromFileName

static ProbeABI qtVersionFromFileName(const QString &path)
{
    ProbeABI abi;

    const QStringList parts = path.split('.');
    if (parts.size() < 4 || parts.at(parts.size() - 4) != QLatin1String("so"))
        return abi;

    abi.setQtVersion(parts.at(parts.size() - 3).toInt(), parts.at(parts.size() - 2).toInt());
    return abi;
}
开发者ID:xhaakon,项目名称:GammaRay,代码行数:11,代码来源:probeabidetector_elf.cpp

示例3: testToString

    void testToString()
    {
        QFETCH(QString, id);
        QFETCH(int, majorVersion);
        QFETCH(int, minorVersion);
        QFETCH(bool, isDebug);
        QFETCH(QString, arch);
        QFETCH(QString, compiler);
        QFETCH(QString, compilerVersion);

        ProbeABI abi;
        abi.setQtVersion(majorVersion, minorVersion);
        abi.setIsDebug(isDebug);
        abi.setArchitecture(arch);
        abi.setCompiler(compiler);
        abi.setCompilerVersion(compilerVersion);

        QCOMPARE(abi.id(), id);
    }
开发者ID:KDAB,项目名称:GammaRay,代码行数:19,代码来源:probeabitest.cpp

示例4: qtVersionFromExec

static ProbeABI qtVersionFromExec(const QString &path)
{
    ProbeABI abi;

    // yep, you can actually execute QtCore.so...
    QProcess proc;
    proc.setReadChannelMode(QProcess::SeparateChannels);
    proc.setReadChannel(QProcess::StandardOutput);
    proc.start(path);
    proc.waitForFinished();
    const QByteArray line = proc.readLine();
    const int pos = line.lastIndexOf(' ');
    const QList<QByteArray> version = line.mid(pos).split('.');
    if (version.size() < 3)
        return abi;

    abi.setQtVersion(version.at(0).toInt(), version.at(1).toInt());

    return abi;
}
开发者ID:xhaakon,项目名称:GammaRay,代码行数:20,代码来源:probeabidetector_elf.cpp

示例5: fromString

ProbeABI ProbeABI::fromString(const QString &id)
{
    QStringList idParts = id.split('-');
    if (idParts.size() < 2)
        return ProbeABI();

    int index = 0;
    ProbeABI abi;

    // version
    static QRegExp versionRegExp("^qt(\\d+)\\_(\\d+)$");
    if (versionRegExp.indexIn(idParts.value(index++)) != 0)
        return ProbeABI();
    abi.setQtVersion(versionRegExp.cap(1).toInt(), versionRegExp.cap(2).toInt());

    // compiler
#ifdef Q_OS_WIN
    abi.setCompiler(idParts.value(index++));
    if (abi.isVersionRelevant())
        abi.setCompilerVersion(idParts.value(index++));
#endif

    if (idParts.size() != index + 1)
        return ProbeABI();

    // architecture / debug/release
    const QString postfix = QStringLiteral(GAMMARAY_DEBUG_POSTFIX);
    QString arch = idParts.value(index);

    if (!postfix.isEmpty()) {
        if (arch.endsWith(postfix, Qt::CaseInsensitive)) {
            arch.chop(postfix.length());

            if (abi.isDebugRelevant())
                abi.setIsDebug(true);
        }
    }

    abi.setArchitecture(arch);
    return abi;
}
开发者ID:iamsergio,项目名称:GammaRay,代码行数:41,代码来源:probeabi.cpp

示例6: fromString

ProbeABI ProbeABI::fromString(const QString& id)
{
  QStringList idParts = id.split('-');
  if (idParts.size() < 2)
    return ProbeABI();

  int index = 0;
  ProbeABI abi;

  // version
  static QRegExp versionRegExp("^qt(\\d+)\\.(\\d+)$");
  if (versionRegExp.indexIn(idParts.value(index++)) != 0)
    return ProbeABI();
  abi.setQtVersion(versionRegExp.cap(1).toInt(), versionRegExp.cap(2).toInt());

  // compiler
#ifdef Q_OS_WIN
  abi.setCompiler(idParts.value(index++));
#endif

  // debug/release
  if (abi.isDebugRelevant()) {
    if (idParts.size() <= index)
      return ProbeABI();
    const QString s = idParts.value(index++);
    if (s != "release" && s != "debug")
      return ProbeABI();
    abi.setIsDebug(s == "debug");
  }

  // architecture
  if (idParts.size() != index + 1)
    return ProbeABI();
  abi.setArchitecture(idParts.value(index));
  return abi;
}
开发者ID:pangpangpang3,项目名称:GammaRay,代码行数:36,代码来源:probeabi.cpp


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