 |
PhoenixMock
1.8.7
Tools to split/merge/print mock used in Phoenix
|
Go to the documentation of this file.
129 printf(
"\033[H\033[2J");
136 printf(
"\033[%sm",color);
143 fprintf(stderr,
"\033[%sm", color);
150 printf(
"\033[%dm",color);
157 fprintf(stderr,
"\033[%dm", color);
166 for(string::const_iterator it =
str.begin(); it !=
str.end(); it++){
168 if(couleur > 7){couleur = 1;}
169 sprintf(buffer,
"3%d", couleur);
183 sprintf(buffer,
"\033[%dm", color);
184 return string(buffer) +
str +
"\033[0m";
192 printf(
"\033[%dm%s\033[0m",color,
str.c_str());
200 fprintf(stderr,
"\033[%dm%s\033[0m",color,
str.c_str());
208 ioctl(0, TIOCGWINSZ, &w);
217 ioctl(0, TIOCGWINSZ, &w);
226 void printAllCol(
const std::string & strLeft,
char ch,
const std::string & strRight){
228 long unsigned int sizeLeft(strLeft.size()), sizeRight(strRight.size());
229 long unsigned int sizeStr(sizeLeft - ((
long unsigned int)
countNbChar(strLeft ,
'\033')*9)/2 + sizeRight - ((
long unsigned int)
countNbChar(strRight ,
'\033')*9)/2);
230 if(sizeStr > longueurConsole){
231 cout << strLeft << strRight << endl;
234 long unsigned int nbChar(longueurConsole - sizeStr);
235 for(
long unsigned int i(0); i < nbChar; ++i){
238 cout << strRight << endl;
247 void printAll(
const std::string & strLeft,
char ch,
const std::string & strRight){
249 long unsigned int sizeLeft(strLeft.size()), sizeRight(strRight.size());
250 long unsigned int sizeStr(sizeLeft + sizeRight);
251 if(sizeStr > longueurConsole){
252 cout << strLeft << strRight << endl;
255 long unsigned int nbChar(longueurConsole - sizeStr);
256 for(
long unsigned int i(0); i < nbChar; ++i){
259 cout << strRight << endl;
268 void printAllCerr(
const std::string & strLeft,
char ch,
const std::string & strRight){
270 long unsigned int sizeLeft(strLeft.size()), sizeRight(strRight.size());
271 long unsigned int sizeStr(sizeLeft + sizeRight);
272 if(sizeStr > longueurConsole){
273 cerr << strLeft << strRight;
276 long unsigned int nbChar(longueurConsole - sizeStr);
277 for(
long unsigned int i(0); i < nbChar; ++i){
289 void printAllColCerr(
const std::string & strLeft,
char ch,
const std::string & strRight){
291 long unsigned int sizeLeft(strLeft.size()), sizeRight(strRight.size());
292 long unsigned int sizeStr(sizeLeft - ((
long unsigned int)
countNbChar(strLeft ,
'\033')*9)/2 + sizeRight - ((
long unsigned int)
countNbChar(strRight ,
'\033')*9)/2);
293 if(sizeStr > longueurConsole){
294 cerr << strLeft << strRight;
297 long unsigned int nbChar(longueurConsole - sizeStr);
298 for(
long unsigned int i(0); i < nbChar; ++i){
void clearTerminal()
fonction qui permet d'éffacer le terminal
std::string termBWhite()
affiche le fond du terminal en blanc
std::string termBRed()
affiche le fond du terminal en rouge
short unsigned int getNbColTerminal()
fonction qui renvoie le nombre de colonnes du terminal
std::string termBlue()
affiche le terminal blue
std::string termBYellow()
affiche le fond du terminal en jaune
void printAll(const std::string &strLeft, char ch, const std::string &strRight)
fonction qui écrit un texte dans la console en l'alignant à droite (ne prend pas en compte la couleur...
std::string termPurple()
affiche le terminal violet
std::string termBCyan()
affiche le fond du terminal en cyan
void printColorCerr(const std::string &str, PTerminalStyle color)
fonction qui affiche un texte coloré dans le terminal
void printAllColCerr(const std::string &strLeft, char ch, const std::string &strRight)
fonction qui écrit un texte dans la console d'erreur en l'alignant à droite (prend en compte la coule...
std::string termBGreen()
affiche le fond du terminal en vert
std::string termPositive()
affiche le terminal positif
std::string termDefault()
affiche le terminal par défaut
std::string termRed()
affiche le terminal rouge
std::string colorString(const std::string &str, PTerminalStyle color)
fonction qui permet de colorier du texte dans une string
std::string termBlink()
affiche le terminal clignotant
std::string termYellow()
affiche le terminal jaune
void printAllCol(const std::string &strLeft, char ch, const std::string &strRight)
fonction qui écrit un texte dans la console en l'alignant à droite (prend en compte la couleur du tex...
std::string termBright()
affiche le terminal brillant
std::string termUnderlined()
affiche le terminal souligné
std::string termGreen()
affiche le terminal vert
void textColorCerr(const char *color)
focntion qui permet de changer la couleur du texte dan le terminal (sortie d'erreur)
void printAllCerr(const std::string &strLeft, char ch, const std::string &strRight)
fonction qui écrit un texte dans la console d'erreur en l'alignant à droite (ne prend pas en compte l...
void textColor(const char *color)
focntion qui permet de changer la couleur du texte dan le terminal
std::string termWhite()
affiche le terminal blanc
short unsigned int getNbRowTerminal()
fonction qui renvoie le nombre de lignes du terminal
std::string termBBlue()
affiche le fond du terminal en bleu
PTerminalStyle
enum qui permet de ne pas avoir à se rappeler les codes couleurs du terminal
std::string termBBlack()
affiche le fond du terminal en noir
size_t countNbChar(const std::string &str, char ch)
Count number of chararacters ch in string.
std::string termBlack()
affiche le terminal noir
std::string termCyan()
affiche le terminal cyan
void printColor(const std::string &str, PTerminalStyle color)
fonction qui affiche un texte coloré dans le terminal
std::string termNegative()
affiche le terminal négatif
void printDelire(const std::string &str)
fonction qui utilise toutes les couleur du terminal pour afficher un message
std::string termBPurple()
affiche le fond du terminal en violet