File: Display.h

package info (click to toggle)
drbd-utils 9.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 5,388 kB
  • sloc: ansic: 43,698; xml: 15,968; cpp: 7,783; sh: 3,699; makefile: 1,353; perl: 353
file content (87 lines) | stat: -rw-r--r-- 2,448 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#ifndef DISPLAY_H
#define	DISPLAY_H

#include <new>
#include <stdexcept>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstdint>

#include <GenericDisplay.h>
#include <map_types.h>
#include <DrbdResource.h>
#include <DrbdConnection.h>
#include <DrbdVolume.h>
#include <DrbdRole.h>

class Display : public GenericDisplay
{
  public:
    static const char* ANSI_CLEAR;
    static const char* ANSI_CLEAR_LINE;

    static const char* FORMAT_HEADER;

    static const char* RES_LABEL;
    static const char* RES_FORMAT_NAME;

    static const char* ROLE_LABEL;
    static const char* ROLE_FORMAT_PRIMARY;
    static const char* ROLE_FORMAT_SECONDARY;

    static const char* CONN_LABEL;
    static const char* CONN_FORMAT_NAME;
    static const char* CONN_FORMAT_NODE_ID;
    static const char* CONN_FORMAT_STATE_NORM;

    static const char* VOL_LABEL;
    static const char* VOL_LABEL_MINOR;
    static const char* VOL_FORMAT_NR;
    static const char* VOL_FORMAT_MINOR;
    static const char* VOL_FORMAT_STATE_NORM;
    static const char* VOL_FORMAT_STATE_CLIENT;
    static const char* VOL_FORMAT_REPL_NORM;

    static const char* FORMAT_WARN;
    static const char* FORMAT_ALERT;
    static const char* FORMAT_RESET;

    static const uint16_t MIN_SIZE_X;
    static const uint16_t MAX_SIZE_X;
    static const uint16_t MIN_SIZE_Y;
    static const uint16_t MAX_SIZE_Y;

    Display(std::ostream& out_ref, ResourcesMap& resources_map_ref);
    Display(const Display& orig) = delete;
    Display& operator=(const Display& orig) = delete;
    Display(Display&& orig) = delete;
    Display& operator=(Display&& orig) = delete;
    virtual ~Display() noexcept override
    {
    }

    virtual void clear();
    virtual void initial_display() override;
    virtual void status_display() override;
    virtual void display_header() const override;

    virtual void list_resources();
    virtual void list_connections(DrbdResource& res);
    virtual void list_volumes(DrbdResource& res);
    virtual void list_peer_volumes(DrbdConnection& conn);

    virtual void set_terminal_size(uint16_t size_x, uint16_t size_y) override;
    virtual void key_pressed(const char key) override;

  private:
    ResourcesMap& resources_map;
    std::ostream& out;
    uint16_t term_x {80};
    uint16_t term_y {25};
    bool hide_norm_peer_volumes {true};
    bool show_header {true};
    bool enable_term_size {true};
};

#endif	/* DISPLAY_H */