libzypp: zypp::base::DrunkenBishop::Impl Class Reference

libzypp 17.38.14

zypp::base::DrunkenBishop::Impl Class Reference

DrunkenBishop implementation. More...

Inheritance diagram for zypp::base::DrunkenBishop::Impl:

## Public Member Functions
| Impl ()
| Default is an empty board.
void | compute (const std::string &data_r, const std::string &title_r, unsigned height_r=Auto, unsigned width_r=Auto)
| Build up a new board.
std::ostream & | dumpOn (std::ostream &str, const std::string &prefix_r, Options options_r) const
| Render board to a stream.

## Static Public Member Functions
static shared_ptr< Impl > | nullimpl ()
| Offer default Impl.

## Private Member Functions
void | move (Direction direction_r)
| Move Bishop from _e into direction_r and update the _board.
bool | atTL () const
| Whether _e is in the top left corner.
bool | atTR () const
| Whether _e is in the top right corner.
bool | atBL () const
| Whether _e is in the bottom left corner.
bool | atBR () const
| Whether _e is in the bottom right corner.
bool | atT () const
| Whether _e is in the top row.
bool | atB () const
| Whether _e is in the bottom row.
bool | atL () const
| Whether _e is in the left column.
bool | atR () const
| Whether _e is in the right column.
const char * | color (std::uint8_t idx_r) const
| ANSI color heatmap.
std::ostream & | renderTitleOn (std::ostream &str, const std::string &title_r) const
| Render non empty title strings.
std::ostream & | renderOn (std::ostream &str, bool useColor_r, unsigned pos_r) const
| Render board numbers to printable chars.

## Static Private Member Functions
static unsigned | odd (unsigned val_r)
| Increment even width/height values.
static std::uint8_t | bite (const char *&ch_r)
| Get next 4 moves (8 bit) from next 2 hex digits (1st digit != '\0' asserted, 0-pad if necessary).

## Private Attributes
std::vector< std::uint8_t > | _board
| the board
unsigned | _h
| board height
unsigned | _w
| board with
unsigned | _s
| start position
unsigned | _e
| end position
bool | _renderSSH
| whether to render the ssh (or gpg) char set
std::string | _fp
| fingerprint to render as bottom title
std::string | _tt
| text to render as top title

## Static Private Attributes
static constexpr const unsigned | Auto = unsigned(-1)
| Request default width/height values.

## Detailed Description

DrunkenBishop implementation.

Definition at line 75 of file DrunkenBishop.cc.

## Constructor & Destructor Documentation

## ◆ Impl()

zypp::base::DrunkenBishop::Impl::Impl | ( |  | ) |
| inline

Default is an empty board.

Definition at line 79 of file DrunkenBishop.cc.

## Member Function Documentation

## ◆ compute()

void zypp::base::DrunkenBishop::Impl::compute | ( | const std::string & | data_r,
|  | const std::string & | title_r,
|  | unsigned | height_r = Auto,
|  | unsigned | width_r = Auto )
| inline

Build up a new board.

Exceptions

  std::invalid_argument |

Definition at line 90 of file DrunkenBishop.cc.

## ◆ dumpOn()

std::ostream & zypp::base::DrunkenBishop::Impl::dumpOn | ( | std::ostream & | str,
|  | const std::string & | prefix_r,
|  | Options | options_r ) const
| inline

Render board to a stream.

Definition at line 134 of file DrunkenBishop.cc.

## ◆ odd()

unsigned zypp::base::DrunkenBishop::Impl::odd | ( | unsigned | val_r | ) |
| inlinestaticprivate

Increment even width/height values.

Definition at line 167 of file DrunkenBishop.cc.

## ◆ bite()

std::uint8_t zypp::base::DrunkenBishop::Impl::bite | ( | const char *& | ch_r | ) |
| inlinestaticprivate

Get next 4 moves (8 bit) from next 2 hex digits (1st digit != '\0' asserted, 0-pad if necessary).

Exceptions

  std::invalid_argument | if char is not a hex digit or 1st char is `\0`

Definition at line 173 of file DrunkenBishop.cc.

## ◆ move()

void zypp::base::DrunkenBishop::Impl::move | ( | Direction | direction_r | ) |
| inlineprivate

Move Bishop from _e into direction_r and update the _board.

Definition at line 183 of file DrunkenBishop.cc.

## ◆ atTL()

bool zypp::base::DrunkenBishop::Impl::atTL | ( |  | ) | const
| inlineprivate

Whether _e is in the top left corner.

Definition at line 239 of file DrunkenBishop.cc.

## ◆ atTR()

bool zypp::base::DrunkenBishop::Impl::atTR | ( |  | ) | const
| inlineprivate

Whether _e is in the top right corner.

Definition at line 243 of file DrunkenBishop.cc.

## ◆ atBL()

bool zypp::base::DrunkenBishop::Impl::atBL | ( |  | ) | const
| inlineprivate

Whether _e is in the bottom left corner.

Definition at line 247 of file DrunkenBishop.cc.

## ◆ atBR()

bool zypp::base::DrunkenBishop::Impl::atBR | ( |  | ) | const
| inlineprivate

Whether _e is in the bottom right corner.

Definition at line 251 of file DrunkenBishop.cc.

## ◆ atT()

bool zypp::base::DrunkenBishop::Impl::atT | ( |  | ) | const
| inlineprivate

Whether _e is in the top row.

Definition at line 255 of file DrunkenBishop.cc.

## ◆ atB()

bool zypp::base::DrunkenBishop::Impl::atB | ( |  | ) | const
| inlineprivate

Whether _e is in the bottom row.

Definition at line 259 of file DrunkenBishop.cc.

## ◆ atL()

bool zypp::base::DrunkenBishop::Impl::atL | ( |  | ) | const
| inlineprivate

Whether _e is in the left column.

Definition at line 263 of file DrunkenBishop.cc.

## ◆ atR()

bool zypp::base::DrunkenBishop::Impl::atR | ( |  | ) | const
| inlineprivate

Whether _e is in the right column.

Definition at line 267 of file DrunkenBishop.cc.

## ◆ color()

const char * zypp::base::DrunkenBishop::Impl::color | ( | std::uint8_t | idx_r | ) | const
| inlineprivate

ANSI color heatmap.

Definition at line 272 of file DrunkenBishop.cc.

## ◆ renderTitleOn()

std::ostream & zypp::base::DrunkenBishop::Impl::renderTitleOn | ( | std::ostream & | str,
|  | const std::string & | title_r ) const
| inlineprivate

Render non empty title strings.

Definition at line 308 of file DrunkenBishop.cc.

## ◆ renderOn()

std::ostream & zypp::base::DrunkenBishop::Impl::renderOn | ( | std::ostream & | str,
|  | bool | useColor_r,
|  | unsigned | pos_r ) const
| inlineprivate

Render board numbers to printable chars.

Definition at line 326 of file DrunkenBishop.cc.

## ◆ nullimpl()

shared_ptr< Impl > zypp::base::DrunkenBishop::Impl::nullimpl | ( |  | ) |
| inlinestatic

Offer default Impl.

Definition at line 362 of file DrunkenBishop.cc.

## Member Data Documentation

## ◆ Auto

const unsigned zypp::base::DrunkenBishop::Impl::Auto = unsigned(-1)
| staticconstexprprivate

Request default width/height values.

Definition at line 346 of file DrunkenBishop.cc.

## ◆ _board

std::vector<std::uint8_t> zypp::base::DrunkenBishop::Impl::_board
| private

the board

Definition at line 349 of file DrunkenBishop.cc.

## ◆ _h

unsigned zypp::base::DrunkenBishop::Impl::_h
| private

board height

Definition at line 350 of file DrunkenBishop.cc.

## ◆ _w

unsigned zypp::base::DrunkenBishop::Impl::_w
| private

board with

Definition at line 351 of file DrunkenBishop.cc.

## ◆ _s

unsigned zypp::base::DrunkenBishop::Impl::_s
| private

start position

Definition at line 352 of file DrunkenBishop.cc.

## ◆ _e

unsigned zypp::base::DrunkenBishop::Impl::_e
| private

end position

Definition at line 353 of file DrunkenBishop.cc.

## ◆ _renderSSH

bool zypp::base::DrunkenBishop::Impl::_renderSSH
| private

whether to render the ssh (or gpg) char set

Definition at line 356 of file DrunkenBishop.cc.

## ◆ _fp

std::string zypp::base::DrunkenBishop::Impl::_fp
| private

fingerprint to render as bottom title

Definition at line 357 of file DrunkenBishop.cc.

## ◆ _tt

std::string zypp::base::DrunkenBishop::Impl::_tt
| private

text to render as top title

Definition at line 358 of file DrunkenBishop.cc.

The documentation for this class was generated from the following file:

- zypp-common/base/DrunkenBishop.cc