libzypp 17.38.5

DrunkenBishop.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8\---------------------------------------------------------------------*/
11#ifndef ZYPP_BASE_DRUNKENBISHOP_H
12#define ZYPP_BASE_DRUNKENBISHOP_H
13
14#include <iosfwd>
15#include <vector>
16#include <string>
17
18#include <zypp-core/base/PtrTypes.h>
19#include <zypp-core/base/Flags.h>
20
22 namespace zypp
23{
25 namespace base
26 {
61 class ZYPP_API DrunkenBishop
62 {
63 friend std::ostream & operator<<( std::ostream & str, const DrunkenBishop & obj );
64
65 public:
67 DrunkenBishop();
68
70 DrunkenBishop( const std::string & data_r, const std::string & title_r = std::string() );
71
73 DrunkenBishop( const std::string & data_r, const std::string & title_r, unsigned height_r );
75 DrunkenBishop( const std::string & data_r, unsigned height_r )
76 : DrunkenBishop( data_r, std::string(), height_r )
77 {}
78
80 DrunkenBishop( const std::string & data_r, const std::string & title_r, unsigned height_r, unsigned width_r );
82 DrunkenBishop( const std::string & data_r, unsigned height_r, unsigned width_r )
83 : DrunkenBishop( data_r, std::string(), height_r, width_r )
84 {}
85
87 ~DrunkenBishop();
88
89 public:
90 /* Rendering options */
91 enum OptionBits {
92 USE_COLOR = (1<<0),
93 };
94 ZYPP_DECLARE_FLAGS(Options,OptionBits);
95
97 std::ostream & dumpOn( std::ostream & str, Options options_r = Options() ) const
98 { return dumpOn( str, std::string(), options_r ); }
99
100 std::ostream & dumpOn( std::ostream & str, const std::string & prefix_r, Options options_r = Options() ) const;
101
103 std::string asString( Options options_r = Options() ) const
104 { return asString( std::string(), options_r ); }
105
106 std::string asString( const std::string & prefix_r, Options options_r = Options() ) const;
107
109 std::vector<std::string> asLines( Options options_r = Options() ) const
110 { return asLines( std::string(), options_r ); }
111
112 std::vector<std::string> asLines( const std::string & prefix_r, Options options_r = Options() ) const;
113
114 public:
115 class Impl;
116 private:
117 RW_pointer<Impl> _pimpl;
118 };
119
120 ZYPP_DECLARE_OPERATORS_FOR_FLAGS(DrunkenBishop::Options);
121
123 inline std::ostream & operator<<( std::ostream & str, const DrunkenBishop & obj )
124 { return obj.dumpOn( str ); }
125
126 } // namespace base
128} // namespace zypp
130#endif // ZYPP_BASE_DRUNKENBISHOP_H
Flags.h
ZYPP_DECLARE_OPERATORS_FOR_FLAGS
#define ZYPP_DECLARE_OPERATORS_FOR_FLAGS(Name)
Definition Flags.h:177
PtrTypes.h
Impl
zypp::base::DrunkenBishop
Random art fingerprint visualization Visualize fingerprint data on a [17x9] (SSH) or [19x11] (GPG) or...
Definition DrunkenBishop.h:62
zypp::base::DrunkenBishop::DrunkenBishop
DrunkenBishop(const std::string &data_r, unsigned height_r)
Definition DrunkenBishop.h:75
zypp::base::DrunkenBishop::OptionBits
OptionBits
Definition DrunkenBishop.h:91
zypp::base::DrunkenBishop::USE_COLOR
@ USE_COLOR
use colors
Definition DrunkenBishop.h:92
zypp::base::DrunkenBishop::_pimpl
RW_pointer< Impl > _pimpl
Implementation class.
Definition DrunkenBishop.h:117
zypp::base::DrunkenBishop::ZYPP_DECLARE_FLAGS
ZYPP_DECLARE_FLAGS(Options, OptionBits)
zypp::base::DrunkenBishop::asString
std::string asString(Options options_r=Options()) const
Render board as string.
Definition DrunkenBishop.h:103
zypp::base::DrunkenBishop::operator<<
friend std::ostream & operator<<(std::ostream &str, const DrunkenBishop &obj)
zypp::base::DrunkenBishop::asLines
std::vector< std::string > asLines(Options options_r=Options()) const
Render to an array of lines.
Definition DrunkenBishop.h:109
zypp::base::DrunkenBishop::DrunkenBishop
DrunkenBishop(const std::string &data_r, unsigned height_r, unsigned width_r)
Definition DrunkenBishop.h:82
zypp::base::DrunkenBishop::DrunkenBishop
DrunkenBishop()
Default ctor: empty board (1x1).
Definition DrunkenBishop.cc:373
zypp::base::DrunkenBishop::dumpOn
std::ostream & dumpOn(std::ostream &str, Options options_r=Options()) const
Render board to steam.
Definition DrunkenBishop.h:97
std
Definition ansi.h:855
str
String related utilities and Regular expression matching.
zypp::base
Definition Random.cc:7
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition CodePitfalls.doc:2
zypp::dumpOn
std::ostream & dumpOn(std::ostream &str, const Capability &obj)
Definition Capability.cc:588
zypp::ZYPP_API
const Arch Arch_armv7hnl Arch_armv7nhl ZYPP_API
Definition Arch.h:247
zypp::asString
std::string asString(const Patch::Category &obj)
Definition Patch.cc:122
zypp::RW_pointer
Wrapper for const correct access via Smart pointer types.
Definition PtrTypes.h:293