libcruft-util/term.hpp

57 lines
1.3 KiB
C++
Raw Normal View History

2016-03-21 14:20:39 +11:00
/*
2018-08-04 15:14:06 +10:00
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
2016-03-21 14:20:39 +11:00
*
* Copyright 2016 Danny Robson <danny@nerdcruft.net>
*/
#pragma once
2016-03-21 14:20:39 +11:00
2018-03-22 16:10:06 +11:00
#include <iosfwd>
2016-03-21 14:20:39 +11:00
namespace cruft::term {
2016-03-21 14:20:39 +11:00
bool has_csi_support (void);
namespace csi {
struct code {
static constexpr char CSI = '\x1B';
};
struct graphics : public code {
static constexpr char terminator = 'm';
enum layer : char {
2016-03-21 14:20:39 +11:00
FOREGROUND = 30,
BACKGROUND = 40
};
enum hue : char {
2016-03-21 14:20:39 +11:00
BLACK = 0,
RED = 1,
GREEN = 2,
YELLOW = 3,
BLUE = 4,
MAGENTA = 5,
CYAN = 6,
WHITE = 7,
};
graphics (layer, hue);
explicit graphics (char value);
char value (void) const;
char value (char);
static const graphics RESET;
private:
char m_value;
};
std::ostream& operator<< (std::ostream&, code);
std::ostream& operator<< (std::ostream&, graphics);
}
}