message: [vtbackend] Charset Improve implementation readability.
diff: @@ -71,8 +71,8 @@ class CharsetMapping
  // TODO: could surely be implemented branchless with a jump-table and computed goto.
  if (code < 127)
  {
  - auto result = map(_shift, static_cast<char>(code));
  - _shift = _selected;
  + auto result = map(_tableForNextGraphic, static_cast<char>(code));
  + _tableForNextGraphic = _selectedTable;
  return result;
  }
  else if (code != 127)
  @@ -90,12 +90,12 @@ class CharsetMapping
  return (*_tables[static_cast<size_t>(table)])[static_cast<uint8_t>(code)];
  }
  - constexpr void singleShift(CharsetTable table) noexcept { _shift = table; }
  + constexpr void singleShift(CharsetTable table) noexcept { _tableForNextGraphic = table; }
  - constexpr void selectDefaultTable(CharsetTable table) noexcept
  + constexpr void lockingShift(CharsetTable table) noexcept
  {
  - _selected = table;
  - _shift = table;
  + _selectedTable = table;
  + _tableForNextGraphic = table;
  }
  [[nodiscard]] bool isSelected(CharsetTable table, CharsetId id) const noexcept
  @@ -103,18 +103,20 @@ class CharsetMapping
  return _tables[static_cast<size_t>(table)] == charsetMap(id);
  }
  - [[nodiscard]] bool isSelected(CharsetId id) const noexcept { return isSelected(currentTable(), id); }
  + [[nodiscard]] bool isSelected(CharsetId id) const noexcept
  + {
  + return isSelected(_tableForNextGraphic, id);
  + }
  + // Selects a given designated character set into the table G0, G1, G2, or G3.
  void select(CharsetTable table, CharsetId id) noexcept
  {
  _tables[static_cast<size_t>(table)] = charsetMap(id);
  }
  - [[nodiscard]] constexpr CharsetTable currentTable() const noexcept { return _shift; }
  -
  private:
  - CharsetTable _shift = CharsetTable::G0;
  - CharsetTable _selected = CharsetTable::G0;
  + CharsetTable _tableForNextGraphic = CharsetTable::G0;
  + CharsetTable _selectedTable = CharsetTable::G0;
  using Tables = std::array<CharsetMap const*, 4>;
  Tables _tables;
  