This repository has been archived by the owner on Sep 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathtypes.h
84 lines (70 loc) · 2.2 KB
/
types.h
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
/*
This file is part of duckOS.
duckOS is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
duckOS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with duckOS. If not, see <https://www.gnu.org/licenses/>.
Copyright (c) Byteduck 2016-2021. All rights reserved.
*/
#pragma once
#ifdef DUCKOS_KERNEL
#include <kernel/kstd/types.h>
#include <kernel/kstd/vector.hpp>
#define _TERM_VECTOR_TYPE kstd::vector
#else
#include <cstddef>
#include <cstdint>
#include <vector>
#define _TERM_VECTOR_TYPE std::vector
#endif
#define TERM_COLOR_BLACK 0
#define TERM_COLOR_RED 1
#define TERM_COLOR_GREEN 2
#define TERM_COLOR_YELLOW 3
#define TERM_COLOR_BLUE 4
#define TERM_COLOR_MAGENTA 5
#define TERM_COLOR_CYAN 6
#define TERM_COLOR_WHITE 7
#define TERM_COLOR_BRIGHT_BLACK 8
#define TERM_COLOR_BRIGHT_RED 9
#define TERM_COLOR_BRIGHT_GREEN 10
#define TERM_COLOR_BRIGHT_YELLOW 11
#define TERM_COLOR_BRIGHT_BLUE 12
#define TERM_COLOR_BRIGHT_MAGENTA 13
#define TERM_COLOR_BRIGHT CYAN 14
#define TERM_COLOR_BRIGHT_WHITE 15
#define TERM_DEFAULT_FOREGROUND TERM_COLOR_WHITE
#define TERM_DEFAULT_BACKGROUND TERM_COLOR_BLACK
namespace Term {
template<class T> using Vector = _TERM_VECTOR_TYPE<T>;
class Attribute {
public:
inline Attribute(uint8_t fg = TERM_DEFAULT_FOREGROUND, uint8_t bg = TERM_DEFAULT_BACKGROUND): fg(fg), bg(bg) {}
uint8_t fg = TERM_DEFAULT_FOREGROUND;
uint8_t bg = TERM_DEFAULT_BACKGROUND;
};
class Character {
public:
inline Character(uint32_t codepoint = 0, Attribute attr = {}): codepoint(codepoint), attr(attr) {}
uint32_t codepoint = 0;
Attribute attr;
};
class Position {
public:
inline Position(int col, int line): col(col), line(line) {}
int col;
int line;
};
class Size {
public:
inline Size(int cols, int lines): cols(cols), lines(lines) {}
int cols;
int lines;
};
}