author | František Kučera <franta-hg@frantovo.cz> |
Sun, 11 Sep 2016 19:52:26 +0200 | |
changeset 28 | bfef9f34e438 |
parent 26 | 6e5c4e267ddb |
permissions | -rw-r--r-- |
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@7 | 18 |
#ifndef TERMINALOUTPUTMODULE_H |
franta-hg@26 | 19 |
#define TERMINALOUTPUTMODULE_H |
franta-hg@7 | 20 |
|
franta-hg@9 | 21 |
#include <iostream> |
franta-hg@26 | 22 |
#include <sstream> |
franta-hg@9 | 23 |
|
franta-hg@10 | 24 |
#include "OutputModule.h" |
franta-hg@10 | 25 |
|
franta-hg@8 | 26 |
namespace info { |
franta-hg@8 | 27 |
namespace globalcode { |
franta-hg@8 | 28 |
namespace parameterLister { |
franta-hg@8 | 29 |
|
franta-hg@26 | 30 |
using namespace std; |
franta-hg@26 | 31 |
|
franta-hg@10 | 32 |
class TerminalOutputModule : public OutputModule { |
franta-hg@7 | 33 |
public: |
franta-hg@26 | 34 |
virtual int process(ostream &output, string &command, vector<string> &args); |
franta-hg@7 | 35 |
private: |
franta-hg@7 | 36 |
|
franta-hg@26 | 37 |
const int RED = 31; |
franta-hg@26 | 38 |
const int GREEN = 32; |
franta-hg@26 | 39 |
const int BLUE = 34; |
franta-hg@26 | 40 |
|
franta-hg@26 | 41 |
string colorize(int foreground, string text) { |
franta-hg@26 | 42 |
//return "\033[" + "32" + "m" + text + "\033[39m"; |
franta-hg@26 | 43 |
ostringstream fgStream; |
franta-hg@26 | 44 |
fgStream << foreground; |
franta-hg@26 | 45 |
return "\033[" + fgStream.str() + "m" + text + "\033[39m"; |
franta-hg@26 | 46 |
} |
franta-hg@26 | 47 |
|
franta-hg@26 | 48 |
// tabulky: http://www.rubydoc.info/gems/terminal-table/1.4.2/frames |
franta-hg@7 | 49 |
}; |
franta-hg@7 | 50 |
|
franta-hg@8 | 51 |
} |
franta-hg@8 | 52 |
} |
franta-hg@8 | 53 |
} |
franta-hg@8 | 54 |
|
franta-hg@26 | 55 |
#endif /* TERMINALOUTPUTMODULE_H */ |
franta-hg@7 | 56 |