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