libzypp: zypp-tui/output/AliveCursor.h Source File

libzypp 17.38.11

AliveCursor.h
Go to the documentation of this file.
1/*---------------------------------------------------------------------\
2| ____ _ __ __ ___ |
3| |__ / \ / / . \ . \ |
4| / / \ V /| _/ _/ |
5| / /__ | | | | | | |
6| /_____||_| |_| |_| |
7| |
8----------------------------------------------------------------------/
9*
10* This file contains private API, this might break at any time between releases.
11* Strictly for internal use!
12*/
13
14#ifndef ZYPP_TUI_OUTPUT_ALIVE_CURSOR_H
15#define ZYPP_TUI_OUTPUT_ALIVE_CURSOR_H
16
17#include <iostream>
18
19namespace ztui {
20
21 class AliveCursor
22{
23 public:
24 friend std::ostream & operator<<( std::ostream & str, const AliveCursor & obj );
25
26 AliveCursor() : _current('-')
27 {}
28
29 char current() const
30 { return _current; }
31
32 void increase()
33 {
34 switch ( _current )
35 {
36 case '-':
37 _current = '\\';
38 break;
39 case '\\':
40 _current = '|';
41 break;
42 case '|':
43 _current = '/';
44 break;
45 case '/':
46 _current = '-';
47 break;
48 }
49 }
50
51 AliveCursor & operator++()
52 {
53 increase();
54 return *this;
55 }
56
57 AliveCursor & operator++(int)
58 {
59 increase();
60 return *this;
61 }
62
63 AliveCursor & done()
64 {
65 _current = '*';
66 return *this;
67 }
68
69 private:
70 char _current;
71};
72
74 inline std::ostream & operator<<( std::ostream & str, const AliveCursor & obj )
75{ return str << obj.current(); }
76
77}
78
79#endif
80
ztui::AliveCursor::operator<<
friend std::ostream & operator<<(std::ostream &str, const AliveCursor &obj)
relates: Date Stream output
Definition AliveCursor.h:74
ztui::AliveCursor::increase
void increase()
Definition AliveCursor.h:32
ztui::AliveCursor::current
char current() const
Definition AliveCursor.h:29
ztui::AliveCursor::AliveCursor
AliveCursor()
Definition AliveCursor.h:26
ztui::AliveCursor::done
AliveCursor & done()
Definition AliveCursor.h:63
ztui::AliveCursor::operator++
AliveCursor & operator++(int)
Definition AliveCursor.h:57
ztui::AliveCursor::operator++
AliveCursor & operator++()
Definition AliveCursor.h:51
ztui::AliveCursor::_current
char _current
Definition AliveCursor.h:70
str
String related utilities and Regular expression matching.
ztui
Definition application.cc:13
zypp::operator<<
std::ostream & operator<<(std::ostream &str, const Capabilities &obj)
relates: Capabilities Stream output
Definition Capabilities.cc:65