|
Revision 290, 1.0 kB
(checked in by athomas, 4 years ago)
|
Initial import.
|
| Line | |
|---|
| 1 |
#ifndef CRASH_TERMINAL |
|---|
| 2 |
#define CRASH_TERMINAL |
|---|
| 3 |
|
|---|
| 4 |
#include <unistd.h> |
|---|
| 5 |
#include <stdexcept> |
|---|
| 6 |
#include <iostream> |
|---|
| 7 |
#include "Strings.h" |
|---|
| 8 |
|
|---|
| 9 |
using namespace std; |
|---|
| 10 |
|
|---|
| 11 |
namespace term { |
|---|
| 12 |
|
|---|
| 13 |
enum Colour { |
|---|
| 14 |
Black, |
|---|
| 15 |
Red, |
|---|
| 16 |
Green, |
|---|
| 17 |
Brown, |
|---|
| 18 |
Blue, |
|---|
| 19 |
Magenta, |
|---|
| 20 |
Cyan, |
|---|
| 21 |
White |
|---|
| 22 |
}; |
|---|
| 23 |
|
|---|
| 24 |
enum Attribute { |
|---|
| 25 |
Normal, |
|---|
| 26 |
Bold, |
|---|
| 27 |
HalfBright, |
|---|
| 28 |
Underline = 4, |
|---|
| 29 |
Blink, |
|---|
| 30 |
Reverse = 7, |
|---|
| 31 |
}; |
|---|
| 32 |
|
|---|
| 33 |
void forceColour(bool state); |
|---|
| 34 |
|
|---|
| 35 |
// Used for getting the string representation of terminal attributes |
|---|
| 36 |
string background(Colour colour); |
|---|
| 37 |
string foreground(Colour colour); |
|---|
| 38 |
string colour(Colour colour); |
|---|
| 39 |
string attribute(Attribute attribute); |
|---|
| 40 |
string title(string const &str); |
|---|
| 41 |
|
|---|
| 42 |
// Stream-oriented terminal attributes |
|---|
| 43 |
ostream &black(ostream &os); |
|---|
| 44 |
ostream &red(ostream &os); |
|---|
| 45 |
ostream &green(ostream &os); |
|---|
| 46 |
ostream &yellow(ostream &os); |
|---|
| 47 |
ostream &blue(ostream &os); |
|---|
| 48 |
ostream &magenta(ostream &os); |
|---|
| 49 |
ostream &cyan(ostream &os); |
|---|
| 50 |
ostream &white(ostream &os); |
|---|
| 51 |
|
|---|
| 52 |
ostream &normal(ostream &os); |
|---|
| 53 |
ostream &bold(ostream &os); |
|---|
| 54 |
ostream &halfbright(ostream &os); |
|---|
| 55 |
ostream &underline(ostream &os); |
|---|
| 56 |
ostream &blink(ostream &os); |
|---|
| 57 |
ostream &reverse(ostream &os); |
|---|
| 58 |
|
|---|
| 59 |
} |
|---|
| 60 |
#endif |
|---|