aboutsummaryrefslogtreecommitdiffstats
path: root/trio/html/group___dynamic_strings.html
blob: ab3492971c433d25540d1062688731c024a09416 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
 <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
 <title>TRIO</title>
 <link href="trio.css" rel="stylesheet" type="text/css">
</head>
<body>
<!-- Generated by Doxygen 1.2.12 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="modules.html">Modules</a> &nbsp; </center>
<hr><h1>TRIO Documentation</h1>
<p>
 <dl compact><dt><b>
Author: </b><dd>
Bj�rn Reese , Daniel Stenberg</dl><a name="intro"><h2>Introduction</h2></a>

<p>
Trio is a fully matured and stable set of printf and string functions designed be used by applications with focus on portability or with the need for additional features that are not supported by standard stdio implementation.
<p>
There are several cases where you may want to consider using trio:
<p>
<ul>
<li> Portability across heterogeneous platfo
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
 <meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
 <title>TRIO</title>
 <link href="trio.css" rel="stylesheet" type="text/css">
</head>
<body>
<!-- Generated by Doxygen 1.2.12 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="modules.html">Modules</a> &nbsp; </center>
<hr><h1>Dynamic String Functions.</h1>Dynamic string functions. 
<a href="#_details">More...</a><table border=0 cellpadding=0 cellspacing=0>
<tr><td colspan=2><br><h2>Functions</h2></td></tr>
<tr><td nowrap align=right valign=top>TRIO_STRING_PUBLIC trio_string_t *&nbsp;</td><td valign=bottom><a class="el" href="group___dynamic_strings.html#a3">trio_string_create</a> (int initial_size)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Create a new dynamic string.</em> <a href="#a3">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>TRIO_STRING_PUBLIC void&nbsp;</td><td valign=bottom><a class="el" href="group___dynamic_strings.html#a4">trio_string_destroy</a> (trio_string_t *self)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Deallocate the dynamic string and its contents.</em> <a href="#a4">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>TRIO_STRING_PUBLIC char *&nbsp;</td><td valign=bottom><a class="el" href="group___dynamic_strings.html#a5">trio_string_get</a> (trio_string_t *self, int offset)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Get a pointer to the content.</em> <a href="#a5">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>TRIO_STRING_PUBLIC char *&nbsp;</td><td valign=bottom><a class="el" href="group___dynamic_strings.html#a6">trio_string_extract</a> (trio_string_t *self)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Extract the content.</em> <a href="#a6">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>TRIO_STRING_PUBLIC void&nbsp;</td><td valign=bottom><a class="el" href="group___dynamic_strings.html#a7">trio_xstring_set</a> (trio_string_t *self, char *buffer)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Set the content of the dynamic string.</em> <a href="#a7">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>TRIO_STRING_PUBLIC int&nbsp;</td><td valign=bottom><a class="el" href="group___dynamic_strings.html#a10">trio_string_append</a> (trio_string_t *self, trio_string_t *other)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Append the second string to the first.</em> <a href="#a10">More...</a><em></em></font><br><br></td></tr>
<tr><td nowrap align=right valign=top>TRIO_STRING_PUBLIC int&nbsp;</td><td valign=bottom><a class="el" href="group___dynamic_strings.html#a13">trio_string_contains</a> (trio_string_t *self, trio_string_t *other)</td></tr>
<tr><td>&nbsp;</td><td><font size=-1><em>Search for the first occurrence of second parameter in the first.</em> <a href="#a13">More...</a><em></em></font><br><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Dynamic string functions.
<p>
<b>SYNOPSIS</b>
<p>
<div class="fragment"><pre>
cc ... -ltrio -lm

#include &lt;triostr.h&gt;
</pre></div>
<p>
<b>DESCRIPTION</b> <hr><h2>Function Documentation</h2>
<a name="a10" doxytag="triostr.c::trio_string_append"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> TRIO_STRING_PUBLIC int trio_string_append </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">trio_string_t *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>self</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>trio_string_t *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>other</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Append the second string to the first.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>self</em>&nbsp;</td><td>
Dynamic string to be modified. </td></tr>
<tr><td valign=top><em>other</em>&nbsp;</td><td>
Dynamic string to copy from. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Boolean value indicating success or failure. </dl>    </td>
  </tr>
</table>
<a name="a13" doxytag="triostr.c::trio_string_contains"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> TRIO_STRING_PUBLIC int trio_string_contains </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">trio_string_t *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>self</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>trio_string_t *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>other</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Search for the first occurrence of second parameter in the first.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>self</em>&nbsp;</td><td>
Dynamic string to be modified. </td></tr>
<tr><td valign=top><em>other</em>&nbsp;</td><td>
Dynamic string to copy from. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Boolean value indicating success or failure. </dl>    </td>
  </tr>
</table>
<a name="a3" doxytag="triostr.c::trio_string_create"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> TRIO_STRING_PUBLIC trio_string_t* trio_string_create </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">int&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>initial_size</em>          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Create a new dynamic string.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>initial_size</em>&nbsp;</td><td>
Initial size of the buffer. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Newly allocated dynamic string, or NULL if memory allocation failed. </dl>    </td>
  </tr>
</table>
<a name="a4" doxytag="triostr.c::trio_string_destroy"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> TRIO_STRING_PUBLIC void trio_string_destroy </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">trio_string_t *&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>self</em>          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Deallocate the dynamic string and its contents.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>self</em>&nbsp;</td><td>
Dynamic string </td></tr>
</table>
</dl>    </td>
  </tr>
</table>
<a name="a6" doxytag="triostr.c::trio_string_extract"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> TRIO_STRING_PUBLIC char* trio_string_extract </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">trio_string_t *&nbsp;</td>
          <td class="mdname1" valign="top" nowrap>&nbsp; <em>self</em>          </td>
          <td class="md" valign="top">)&nbsp;</td>
          <td class="md" nowrap></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Extract the content.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>self</em>&nbsp;</td><td>
Dynamic String </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Content of dynamic string.</dl>The content is removed from the dynamic string. This enables destruction of the dynamic string without deallocation of the content.     </td>
  </tr>
</table>
<a name="a5" doxytag="triostr.c::trio_string_get"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> TRIO_STRING_PUBLIC char* trio_string_get </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">trio_string_t *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>self</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>int&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>offset</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Get a pointer to the content.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>self</em>&nbsp;</td><td>
Dynamic string. </td></tr>
<tr><td valign=top><em>offset</em>&nbsp;</td><td>
Offset into content. </td></tr>
</table>
</dl><dl compact><dt><b>
Returns: </b><dd>
Pointer to the content.</dl><code>Offset</code> can be zero, positive, or negative. If <code>offset</code> is zero, then the start of the content will be returned. If <code>offset</code> is positive, then a pointer to <code>offset</code> number of characters from the beginning of the content is returned. If <code>offset</code> is negative, then a pointer to <code>offset</code> number of characters from the ending of the string, starting at the terminating zero, is returned.     </td>
  </tr>
</table>
<a name="a7" doxytag="triostr.c::trio_xstring_set"></a><p>
<table width="100%" cellpadding="2" cellspacing="0" border="0">
  <tr>
    <td class="md">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td class="md" nowrap valign="top"> TRIO_STRING_PUBLIC void trio_xstring_set </td>
          <td class="md" valign="top">(&nbsp;</td>
          <td class="md" nowrap valign="top">trio_string_t *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>self</em>, </td>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <td class="md" nowrap>char *&nbsp;</td>
          <td class="mdname" nowrap>&nbsp; <em>buffer</em></td>
        </tr>
        <tr>
          <td></td>
          <td class="md">)&nbsp;</td>
          <td class="md" colspan="2"></td>
        </tr>

      </table>
    </td>
  </tr>
</table>
<table cellspacing=5 cellpadding=0 border=0>
  <tr>
    <td>
      &nbsp;
    </td>
    <td>

<p>
Set the content of the dynamic string.
<p>
<dl compact><dt><b>
Parameters: </b><dd>
<table border=0 cellspacing=2 cellpadding=0>
<tr><td valign=top><em>self</em>&nbsp;</td><td>
Dynamic String </td></tr>
<tr><td valign=top><em>buffer</em>&nbsp;</td><td>
The new content.</td></tr>
</table>
</dl>Sets the content of the dynamic string to a copy <code>buffer</code>. An existing content will be deallocated first, if necessary.
<p>
<dl compact><dt><b>
Remarks: </b><dd>
 This function will make a copy of <code>buffer</code>. You are responsible for deallocating <code>buffer</code> yourself. </dl>    </td>
  </tr>
</table>
<HR>
<center class="copyright">Copyright (C) 2001 Bj&oslash;rn Reese and Daniel Stenberg.</center>
</body>
</html>