82 lines
4.4 KiB
HTML
82 lines
4.4 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="X-UA-Compatible" content="chrome=1">
|
|
<title>Libpipecolors by sk-5</title>
|
|
|
|
<link rel="stylesheet" href="stylesheets/styles.css">
|
|
<link rel="stylesheet" href="stylesheets/github-light.css">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
|
|
<!--[if lt IE 9]>
|
|
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
<![endif]-->
|
|
</head>
|
|
<body>
|
|
<div class="wrapper">
|
|
<header>
|
|
<h1>Libpipecolors</h1>
|
|
<p>linux color code library</p>
|
|
|
|
<p class="view"><a href="https://github.com/sk-5/libpipecolors">View the Project on GitHub <small>sk-5/libpipecolors</small></a></p>
|
|
|
|
|
|
<ul>
|
|
<li><a href="https://github.com/sk-5/libpipecolors/archive/1.2.1.zip">Download <strong>ZIP File</strong></a></li>
|
|
<li><a href="https://github.com/sk-5/libpipecolors/archive/1.2.1.tar.gz">Download <strong>TAR Ball</strong></a></li>
|
|
<li><a href="https://github.com/sk-5/libpipecolors">View On <strong>GitHub</strong></a></li>
|
|
</ul>
|
|
</header>
|
|
<section>
|
|
<h1>
|
|
<a id="libpipecolors" class="anchor" href="#libpipecolors" aria-hidden="true"><span class="octicon octicon-link"></span></a>libpipecolors</h1>
|
|
|
|
<p>This library parses input like <strong><em>printf</em></strong> and <strong><em>sprintf</em></strong> but instead of returning a boring string it will replace renegade bbs style pipecodes (|09) with their ansi equivelent.</p>
|
|
|
|
<h2>
|
|
<a id="it-has-two-functions--" class="anchor" href="#it-has-two-functions--" aria-hidden="true"><span class="octicon octicon-link"></span></a>It has two functions -</h2>
|
|
|
|
<div class="highlight highlight-c++"><pre><span class="pl-k">int</span> <span class="pl-en">pcprintf</span>(<span class="pl-k">const</span> <span class="pl-k">char</span> * format, ...);
|
|
<span class="pl-k">int</span> <span class="pl-en">pcsprintf</span>(<span class="pl-k">char</span> * str, <span class="pl-k">const</span> <span class="pl-k">char</span> * format, ...);</pre></div>
|
|
|
|
<h3>
|
|
<a id="to-do" class="anchor" href="#to-do" aria-hidden="true"><span class="octicon octicon-link"></span></a>To Do</h3>
|
|
|
|
<ul>
|
|
<li>[x] Remove std::map requirement</li>
|
|
<li>[x] Remove boost requirement without forcing <code>-std=c++11</code><br /> - (Reduced size from 1.2M to 97K)
|
|
</li>
|
|
</ul>
|
|
|
|
<h2>
|
|
<a id="example-use" class="anchor" href="#example-use" aria-hidden="true"><span class="octicon octicon-link"></span></a>Example use</h2>
|
|
|
|
<div class="highlight highlight-c++"><pre>#<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds"><</span>cstdio<span class="pl-pds">></span></span>
|
|
#<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds"><</span>iostream<span class="pl-pds">></span></span>
|
|
#<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds"><</span>pipecolors.h<span class="pl-pds">></span></span>
|
|
|
|
<span class="pl-k">using</span> <span class="pl-k">namespace</span> <span class="pl-en">pipecolors</span><span class="pl-k">;</span>
|
|
|
|
<span class="pl-k">int</span> <span class="pl-en">main</span>(<span class="pl-k">void</span>) {
|
|
|
|
<span class="pl-k">int</span> num = <span class="pl-c1">5</span>;
|
|
<span class="pl-k">const</span> <span class="pl-k">char</span>* str = <span class="pl-s"><span class="pl-pds">"</span>My number is<span class="pl-pds">"</span></span>;
|
|
<span class="pl-c1">pcprintf</span>(<span class="pl-s"><span class="pl-pds">"</span>|02<span class="pl-c1">%s</span> |10<span class="pl-c1">%d</span>|39<span class="pl-cce">\n</span><span class="pl-pds">"</span></span>, str, num);
|
|
|
|
<span class="pl-k">return</span> <span class="pl-c1">0</span>;
|
|
}</pre></div>
|
|
|
|
<p>This would return <code>\x1b[0;32mMy number is \x1b[0;92m5\x1b[0;39m\n</code><br />
|
|
Or : <em style="color:#008800; font-weight:bold;">My number is </em><em style="color:#00cc00; font-weight:bold;">5</em>.<br />
|
|
Printing str in <em style="color:#008800; font-weight:bold;">dark green</em> and num in <em style="color:#00ff00; font-weight:bold;">light green</em></p>
|
|
</section>
|
|
<footer>
|
|
<p>This project is maintained by <a href="https://github.com/sk-5">sk-5</a></p>
|
|
<p><small>Hosted on GitHub Pages — Theme by <a href="https://github.com/orderedlist">orderedlist</a></small></p>
|
|
</footer>
|
|
</div>
|
|
<script src="javascripts/scale.fix.js"></script>
|
|
|
|
</body>
|
|
</html>
|