Ejemplo n.º 1
0
bool Architecture::FormatCharacter(
    Document      const& rDoc,
    Address       const& rAddr,
    Character     const& rChar,
    PrintData          & rPrintData) const
{
    auto const& rBinStrm = rDoc.GetBinaryStream();
    std::ostringstream oss;
    TOffset Off;

    if (!rDoc.ConvertAddressToFileOffset(rAddr, Off))
        return false;

    switch (rChar.GetSubType())
    {
    case Character::AsciiCharacterType:
    default:
    {
        s8 Char;
        if (!rBinStrm.Read(Off, Char))
            return false;

        switch (Char)
        {
        case '\0':
            oss << "\\0";
            break;
        case '\a':
            oss << "\\a";
            break;
        case '\b':
            oss << "\\b";
            break;
        case '\t':
            oss << "\\t";
            break;
        case '\n':
            oss << "\\n";
            break;
        case '\v':
            oss << "\\v";
            break;
        case '\f':
            oss << "\\f";
            break;
        case '\r':
            oss << "\\r";
            break;
        default:
            oss << Char;
            break;
        }
    }
    }
    rPrintData.AppendCharacter(oss.str());
    return true;
}
Ejemplo n.º 2
0
bool Architecture::FormatCharacter(
  Document      const& rDoc,
  BinaryStream  const& rBinStrm,
  Address       const& rAddr,
  Character     const& rChar,
  std::string        & rStrCell,
  Cell::Mark::List   & rMarks) const
{
  std::ostringstream oss;
  TOffset Off;

  if (!rDoc.ConvertAddressToFileOffset(rAddr, Off))
    return false;

  switch (rChar.GetSubType())
  {
  case Character::AsciiCharacterType: default:
    {
      s8 Char;
      if (!rBinStrm.Read(Off, Char))
        return false;

      switch (Char)
      {
      case '\0': oss << "\\0"; break;
      case '\a': oss << "\\a"; break;
      case '\b': oss << "\\b"; break;
      case '\t': oss << "\\t"; break;
      case '\n': oss << "\\n"; break;
      case '\v': oss << "\\v"; break;
      case '\f': oss << "\\f"; break;
      case '\r': oss << "\\r"; break;
      default:   oss << Char;  break;
      }
    }
  }
  rMarks.push_back(Cell::Mark(Cell::Mark::StringType, 1));
  rStrCell = oss.str();
  return true;
}