libpipecolors/index.html

82 lines
4.4 KiB
HTML
Raw Permalink Normal View History

2015-07-15 09:00:12 -07:00
<!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>
2015-07-17 14:39:20 -07:00
<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>
2015-07-15 09:00:12 -07:00
<li><a href="https://github.com/sk-5/libpipecolors">View On <strong>GitHub</strong></a></li>
</ul>
</header>
<section>
2015-07-15 09:11:03 -07:00
<h1>
<a id="libpipecolors" class="anchor" href="#libpipecolors" aria-hidden="true"><span class="octicon octicon-link"></span></a>libpipecolors</h1>
2015-07-15 09:00:12 -07:00
2015-07-15 09:11:03 -07:00
<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>
2015-07-15 09:00:12 -07:00
2015-07-15 09:11:03 -07:00
<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>
2015-07-15 09:00:12 -07:00
2015-07-15 09:11:03 -07:00
<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>
2015-07-15 09:00:12 -07:00
<h3>
2015-07-15 09:11:03 -07:00
<a id="to-do" class="anchor" href="#to-do" aria-hidden="true"><span class="octicon octicon-link"></span></a>To Do</h3>
2015-07-15 09:00:12 -07:00
2015-07-15 09:11:03 -07:00
<ul>
<li>[x] Remove std::map requirement</li>
2015-07-16 13:59:51 -07:00
<li>[x] Remove boost requirement without forcing <code>-std=c++11</code><br /> - (Reduced size from 1.2M to 97K)
2015-07-15 09:11:03 -07:00
</li>
</ul>
2015-07-15 09:00:12 -07:00
2015-07-15 09:11:03 -07:00
<h2>
<a id="example-use" class="anchor" href="#example-use" aria-hidden="true"><span class="octicon octicon-link"></span></a>Example use</h2>
2015-07-15 09:00:12 -07:00
2015-07-15 09:11:03 -07:00
<div class="highlight highlight-c++"><pre>#<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds">&lt;</span>cstdio<span class="pl-pds">&gt;</span></span>
#<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds">&lt;</span>iostream<span class="pl-pds">&gt;</span></span>
#<span class="pl-k">include</span> <span class="pl-s"><span class="pl-pds">&lt;</span>pipecolors.h<span class="pl-pds">&gt;</span></span>
2015-07-15 09:00:12 -07:00
2015-07-15 09:11:03 -07:00
<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>
2015-07-15 14:52:57 -07:00
<p>This would return <code>\x1b[0;32mMy number is \x1b[0;92m5\x1b[0;39m\n</code><br />
2015-07-15 15:02:28 -07:00
Or : <em style="color:#008800; font-weight:bold;">My number is </em><em style="color:#00cc00; font-weight:bold;">5</em>.<br />
2015-07-15 14:57:14 -07:00
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>
2015-07-15 09:00:12 -07:00
</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 &mdash; Theme by <a href="https://github.com/orderedlist">orderedlist</a></small></p>
</footer>
</div>
<script src="javascripts/scale.fix.js"></script>
</body>
</html>