2015-07-15 11:37:58 -07:00
|
|
|
*******************
|
|
|
|
** libpipecolors **
|
|
|
|
*******************
|
|
|
|
|
|
|
|
This library parses input like printf and sprintf but instead of returning a
|
|
|
|
boring string it will replace renegade bbs style pipecodes (|09) with their
|
|
|
|
ansi equivelent.
|
|
|
|
|
|
|
|
**************************
|
|
|
|
** It has two functions **
|
|
|
|
**************************
|
|
|
|
|
|
|
|
int pcprintf(const char * format, ...);
|
|
|
|
int pcsprintf(char * str, const char * format, ...);
|
|
|
|
|
|
|
|
***********
|
|
|
|
** To Do **
|
|
|
|
***********
|
|
|
|
|
|
|
|
[x] Remove std::map requirement
|
2015-07-16 13:53:27 -07:00
|
|
|
[x] Remove boost requirement without forcing -std=c++11 (Reduced size from 1.2M to 87K)
|
2015-07-15 11:37:58 -07:00
|
|
|
|
|
|
|
*****************
|
|
|
|
** Example use **
|
|
|
|
*****************
|
|
|
|
|
|
|
|
#include <cstdio>
|
|
|
|
#include <iostream>
|
|
|
|
#include <pipecolors.h>
|
|
|
|
|
|
|
|
using namespace pipecolors;
|
|
|
|
|
|
|
|
int main(void) {
|
|
|
|
|
|
|
|
int num = 5;
|
|
|
|
const char* str = "My number is";
|
|
|
|
pcprintf("|02%s |10%d|39\n", str, num);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
This would return \x1b[0;32mMy number is \x1b[0;92m5\x1b[0;39m\n, Printing str in dark green and num in light green
|