c++/parameter-lister/info/globalcode/parameterLister/terminalCodes/TerminalCodes.h
author František Kučera <franta-hg@frantovo.cz>
Sun, 11 Sep 2016 19:52:26 +0200
changeset 28 bfef9f34e438
parent 11 870b868b6b57
permissions -rw-r--r--
license: GNU GPL v3
franta-hg@28
     1
/**
franta-hg@28
     2
 * parameter-lister
franta-hg@28
     3
 * Copyright © 2015 František Kučera (frantovo.cz)
franta-hg@28
     4
 *
franta-hg@28
     5
 * This program is free software: you can redistribute it and/or modify
franta-hg@28
     6
 * it under the terms of the GNU General Public License as published by
franta-hg@28
     7
 * the Free Software Foundation, either version 3 of the License, or
franta-hg@28
     8
 * (at your option) any later version.
franta-hg@28
     9
 *
franta-hg@28
    10
 * This program is distributed in the hope that it will be useful,
franta-hg@28
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
franta-hg@28
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
franta-hg@28
    13
 * GNU General Public License for more details.
franta-hg@28
    14
 *
franta-hg@28
    15
 * You should have received a copy of the GNU General Public License
franta-hg@28
    16
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
franta-hg@28
    17
 */
franta-hg@11
    18
#ifndef TERMINALCODES_H
franta-hg@11
    19
#define	TERMINALCODES_H
franta-hg@1
    20
franta-hg@1
    21
#include <ostream>
franta-hg@3
    22
franta-hg@1
    23
namespace info {
franta-hg@3
    24
namespace globalcode {
franta-hg@3
    25
namespace parameterLister {
franta-hg@3
    26
namespace terminalCodes {
franta-hg@1
    27
franta-hg@3
    28
enum Code {
franta-hg@3
    29
	FG_RED = 31,
franta-hg@3
    30
	FG_GREEN = 32,
franta-hg@3
    31
	FG_BLUE = 34,
franta-hg@3
    32
	FG_DEFAULT = 39,
franta-hg@3
    33
	BG_RED = 41,
franta-hg@3
    34
	BG_GREEN = 42,
franta-hg@3
    35
	BG_BLUE = 44,
franta-hg@3
    36
	BG_DEFAULT = 49
franta-hg@3
    37
};
franta-hg@1
    38
franta-hg@3
    39
class Modifier {
franta-hg@3
    40
	Code code;
franta-hg@3
    41
public:
franta-hg@1
    42
franta-hg@3
    43
	Modifier(Code code) : code(code) {
franta-hg@3
    44
	}
franta-hg@1
    45
franta-hg@3
    46
	friend std::ostream&
franta-hg@3
    47
	operator<<(std::ostream& os, const Modifier& mod) {
franta-hg@3
    48
		return os << "\033[" << mod.code << "m";
franta-hg@1
    49
	}
franta-hg@3
    50
};
franta-hg@3
    51
franta-hg@3
    52
}
franta-hg@3
    53
}
franta-hg@3
    54
}
franta-hg@1
    55
}
franta-hg@1
    56
franta-hg@11
    57
#endif	/* TERMINALCODES_H */
franta-hg@1
    58