Exemplo n.º 1
0
  void ImportErrorReporter::ReportLocation(const ObjectFileRef& object,
                                           const std::string& error)
  {
    progress.Warning(object.GetName()+" - "+error);

    errors.push_back(ReportError(reportLocation,object,error));
  }
Exemplo n.º 2
0
  void TextSearchIndex::splitSearchResult(const std::string& result,
                                          std::string& text,
                                          ObjectFileRef& ref) const
  {
    // Get the index that marks the end of the
    // the text and where the FileOffset begins

    // Each result has only one offset that occupies
    // the last offsetSizeBytes bytes of the string, and
    // the offset is in MSB left to right

    FileOffset offset=0;
    FileOffset add=0;
    size_t idx=result.size()-1;
    for(size_t i=0; i < offsetSizeBytes; i++) {
      add = (unsigned char)(result[idx]);
      offset |= (add << (i*8));

      idx--;
    }

    // Immediately preceding the FileOffset is
    // a single byte that denotes offset type
    RefType reftype=static_cast<RefType>((unsigned char)(result[idx]));

    ref.Set(offset,reftype);
    text=result.substr(0,idx);
  }
Exemplo n.º 3
0
bool AdminRegion::Match(const ObjectFileRef& object) const
{
if (this->object==object) {
    return true;
}

if (aliasObject==object) {
    return true;
}

if (object.GetType()==refNode) {
    for (std::vector<AdminRegion::RegionAlias>::const_iterator alias=aliases.begin();
            alias!=aliases.end();
            ++alias) {
        if (alias->objectOffset==object.GetFileOffset()) {
            return true;
        }
    }
}

return false;
}
Exemplo n.º 4
0
  bool FileScanner::Read(ObjectFileRef& ref)
  {
    uint8_t    typeByte;
    FileOffset fileOffset;

    if (!(Read(typeByte) &&
          ReadFileOffset(fileOffset))) {
      return false;
    }

    ref.Set(fileOffset,(RefType)typeByte);

    return true;
  }
Exemplo n.º 5
0
  bool LocationIndex::Read(FileScanner& scanner,
                           ObjectFileRef& object) const
  {
    uint8_t    type;
    FileOffset fileOffset;

    if (!scanner.Read(type)) {
      return false;
    }

    switch (type) {
    case refNode:
      if (!scanner.ReadFileOffset(fileOffset,
                                  bytesForNodeFileOffset)) {
        return false;
      }
      break;
    case refArea:
      if (!scanner.ReadFileOffset(fileOffset,
                                  bytesForAreaFileOffset)) {
        return false;
      }
      break;
    case refWay:
      if (!scanner.ReadFileOffset(fileOffset,
                                  bytesForWayFileOffset)) {
        return false;
      }
      break;
    default:
      return false;
    }

    object.Set(fileOffset,
               (RefType)type);

    return true;
  }