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


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

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


在下文中一共展示了ProbeABI::setArchitecture方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: detectAbiForQtCore

ProbeABI ProbeABIDetector::detectAbiForQtCore(const QString &path) const
{
    if (path.isEmpty())
        return ProbeABI();

    // try to find the version
    ProbeABI abi = qtVersionFromFileName(path);
    if (!abi.hasQtVersion())
        abi = qtVersionFromExec(path);

    // TODO: architecture detection fallback without elf.h?
    const QString arch = archFromELF(path);
    abi.setArchitecture(arch);

    return abi;
}
开发者ID:xhaakon,项目名称:GammaRay,代码行数:16,代码来源: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: 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

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