c++/parameter-lister/info/globalcode/parameterLister/TerminalOutputModule.h
changeset 26 6e5c4e267ddb
parent 16 65f51abd5fb8
child 28 bfef9f34e438
     1.1 --- a/c++/parameter-lister/info/globalcode/parameterLister/TerminalOutputModule.h	Sat Sep 10 23:52:37 2016 +0200
     1.2 +++ b/c++/parameter-lister/info/globalcode/parameterLister/TerminalOutputModule.h	Sun Sep 11 00:00:21 2016 +0200
     1.3 @@ -1,7 +1,8 @@
     1.4  #ifndef TERMINALOUTPUTMODULE_H
     1.5 -#define	TERMINALOUTPUTMODULE_H
     1.6 +#define TERMINALOUTPUTMODULE_H
     1.7  
     1.8  #include <iostream>
     1.9 +#include <sstream>
    1.10  
    1.11  #include "OutputModule.h"
    1.12  
    1.13 @@ -9,16 +10,30 @@
    1.14  namespace globalcode {
    1.15  namespace parameterLister {
    1.16  
    1.17 +using namespace std;
    1.18 +
    1.19  class TerminalOutputModule : public OutputModule {
    1.20  public:
    1.21 -	virtual int process(std::ostream &output, std::string &command, std::vector<std::string> &args);
    1.22 +	virtual int process(ostream &output, string &command, vector<string> &args);
    1.23  private:
    1.24  
    1.25 +	const int RED = 31;
    1.26 +	const int GREEN = 32;
    1.27 +	const int BLUE = 34;
    1.28 +
    1.29 +	string colorize(int foreground, string text) {
    1.30 +		//return "\033[" + "32" + "m" + text + "\033[39m";
    1.31 +		ostringstream fgStream;
    1.32 +		fgStream << foreground;
    1.33 +		return "\033[" + fgStream.str() + "m" + text + "\033[39m";
    1.34 +	}
    1.35 +
    1.36 +	// tabulky: http://www.rubydoc.info/gems/terminal-table/1.4.2/frames
    1.37  };
    1.38  
    1.39  }
    1.40  }
    1.41  }
    1.42  
    1.43 -#endif	/* TERMINALOUTPUTMODULE_H */
    1.44 +#endif /* TERMINALOUTPUTMODULE_H */
    1.45