forked from balabit/libtermcapparser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcell.cc
More file actions
46 lines (38 loc) · 1.2 KB
/
cell.cc
File metadata and controls
46 lines (38 loc) · 1.2 KB
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
#include <string.h>
#include "putty/cell.hh"
using namespace Putty;
const Cell::Attributes Cell::FlagMask = 0x00FC0000U;
const Cell::Attributes Cell::FgColorMask = 0x0001FFU;
const int Cell::FgColorShift = 0;
const Cell::Attributes Cell::BgColorMask = 0x03FE00U;
const int Cell::BgColorShift = 9;
const Cell::Attributes Cell::InvalidColor = 0x03FFFFU;
const Cell::Attributes Cell::ValidMask = Cell::FlagMask | Cell::BgColorMask | Cell::FgColorMask;
const Cell::Color Cell::DefaultForeground = 256 + Cell::DEFAULT_FOREGROUND;
const Cell::Color Cell::DefaultBackground = 256 + Cell::DEFAULT_BACKGROUND;
const Cell::Attributes Cell::DefaultAttributes = (Cell::DefaultForeground << Cell::FgColorShift) |
(Cell::DefaultBackground << Cell::BgColorShift);
Cell::Cell()
: attr(DefaultAttributes)
{}
Cell::Cell(const std::wstring &characters, Attributes attr)
{
set(characters, attr);
}
Cell::Cell(const Cell &other)
: characters(other.characters),
attr(other.attr)
{}
Cell &
Cell::operator=(const Cell &other)
{
characters = other.characters;
attr = other.attr;
return *this;
}
void
Cell::set(const std::wstring &characters, Attributes attr)
{
this->characters = characters;
this->attr = attr & ValidMask;
}