sources/coloredline.h

changeset 191
2e6cbacafdc7
parent 190
90bf9049e5eb
child 195
be953e1621d9
equal deleted inserted replaced
190:90bf9049e5eb 191:2e6cbacafdc7
47 WHITE = COLOR_WHITE, 47 WHITE = COLOR_WHITE,
48 DEFAULT = 8, 48 DEFAULT = 8,
49 NUM_COLORS 49 NUM_COLORS
50 }; 50 };
51 51
52 // ------------------------------------------------------------------------------------------------- 52 constexpr int RLINE_ON_COLOR = 256;
53 // 53 constexpr int RLINE_OFF_COLOR = 264;
54 enum 54 constexpr int RLINE_ON_BOLD = 272;
55 { 55 constexpr int RLINE_OFF_BOLD = 273;
56 RLINE_ON_COLOR = 256,
57 RLINE_OFF_COLOR = 264,
58 RLINE_ON_BOLD = 272,
59 RLINE_OFF_BOLD
60 };
61 56
62 // -------------------------------------------------------------------------------------------------
63 //
64 class ColoredLine 57 class ColoredLine
65 { 58 {
66 public: 59 public:
67 ColoredLine(); 60 ColoredLine();
68 61
69 const Vector<int>& data() const { return m_data; } 62 const std::vector<int>& data() const { return m_data; }
70 int length() const { return m_length; } 63 int length() const { return m_length; }
71 void addChar(char ch); 64 void addChar(char ch);
72 void addString(const std::string& msg); 65 void addString(const std::string& msg);
73 void finalize(); 66 void finalize();
74 int rows(int cols) const; 67 int rows(int cols) const;
75 68
76 private: 69 private:
77 void activateColor(Color color, bool bold); 70 void activateColor(Color color, bool bold);
78 void setColor(Color a, bool on); 71 void setColor(Color a, bool on);
79 72
80 Vector<int> m_data; 73 std::vector<int> m_data;
81 int m_length; 74 int m_length;
82 bool m_final; 75 bool m_final;
83 Color m_activeColor; 76 Color m_activeColor;
84 bool m_boldActive; 77 bool m_boldActive;
85 int m_colorCodeStage; 78 int m_colorCodeStage;

mercurial