1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/c++/ukazatele/barvicky.cpp Mon May 07 14:05:26 2012 +0200
1.3 @@ -0,0 +1,29 @@
1.4 +#include <barvicky.h>
1.5 +#include <string>
1.6 +
1.7 +using namespace std;
1.8 +
1.9 +string obarvi (string text, int barva) {
1.10 + string zacatek;
1.11 + string konec;
1.12 +
1.13 + switch (barva) {
1.14 + case BARVA_ZELENA :
1.15 + zacatek = string("\033[22;32m");
1.16 + konec = string("\033[0m");
1.17 + break;
1.18 + case BARVA_CERVENA :
1.19 + zacatek = string("\033[22;31m");
1.20 + konec = string("\033[0m");
1.21 + break;
1.22 + dafault:
1.23 + zacatek = ("");
1.24 + konec = ("");
1.25 + }
1.26 +
1.27 + return zacatek + text + konec;
1.28 +}
1.29 +
1.30 +string obarvi (const char * text, int barva) {
1.31 + return obarvi(string(text), barva);
1.32 +}