c-snippets  Artifact Content

Artifact ebfac31607fba1e4238f2e9b6902c868722ce4ed:

Wiki page [clob] by stephan 2008-05-19 12:16:01.
D 2008-05-19T12:16:01
L clob
P 64874f3b39400ab0fc25f927f3d7b2965af9f725
U stephan
W 1026
The "clob" API is a dynamically-resizing "blob" (binary large object) class conceptually derived from code in the Fossil source tree (their APIs are also very similar, but this is a re-implementation for licensing reasons). Its primary uses are:

<ul>
<li>Creating and management of dynamic strings. (This is especially easy in conjunction with [vappendf].)</li>
<li>Output buffering. This is sometimes useful, e.g., when building up output
across several different functions.</li>
<li>Has some support for compressing/decompressing blobs. Not on-the-fly de/compression, but useful nonetheless.</li>
</ul>

The original intention of this class was to provide output buffering support
for the [http://wanderinghorse.net/cgi-bin/fossil-cgi3.cgi|cgi3 toolkit].

It's used something like this:

<pre class='code'>
Clob * c;
clob_init( &amp;c, 0, 0 );
clob_appendf( c, "Hello, %s!", "world");
...
clob_finalize( c );
</pre>

<tt>clob_appendf()</tt> is based on [vappendf]() and therefor uses its extensions.

Z 0e3a2302e2ab1285bdab8217e60ee28b