12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
- <html><head>
- <title>string</title>
- </head><body>
- <p>[<a href="mxdoc.htm">mainpage</a>]
- [<a href="tags.htm">tags</a>]<br>
- <h1><a name="string">module: string</a></h1><p><b>Some simple string allocation and handling functions.</b><p>
- This module contains functions for object-oriented handling of
- const char* strings in C. Strings can be either zero-terminated or have some
- fixed length. The contents of the string cannot be (easily) changed.
- <p>
- MX_STRING is bit-copy-correct which means that a binary copy retains
- proper functioning and takes over ownership of internal buffers. The copy
- source MX_STRING should not be used once the copy takes place.
- <p>
- Memory containing a MX_STRING can be realloc'd without affecting proper
- operation. Therefore it can be used inside a MX_VECTOR.
- (<a href="../include/deds/string.h">../include/deds/string.h</a>)<p>Part of the <a href="deds.htm">deds</a> library.<ul><li>
- <a name="MX_STRING"><code>MX_STRING</code></a>
- <p>
- <p><b>A string object </b><p>
- (<a href="../include/deds/string.h">../include/deds/string.h</a>)<p></li>
- <li>
- <a name="void mx_string_realloc(MX_STRING* string, const MX_ALLOC alloc, const MX_FREE dfree)"><code>void mx_string_realloc(MX_STRING* string, const MX_ALLOC alloc, const MX_FREE dfree)</code></a>
- <p>
- <p><b>Reallocate a MX_STRING</b><p>
- This function changes the memory allocation of the text inside a
- MX_STRING to the ones in the argumnets. Memory is allocated using the alloc
- function and the current contents of the string is copied to the newly
- allocated memory. The free function will be called when the memory
- associated with the text needs to be freed.
- (<a href="../include/deds/string/realloc.c">../include/deds/string/realloc.c</a>)<p></li>
- <li>
- <a name="void mx_string_set(MX_STRING* string, const char* text, int len, const MX_FREE dfree)"><code>void mx_string_set(MX_STRING* string, const char* text, int len, const MX_FREE dfree)</code></a>
- <p>
- <p><b>Set MX_STRING text and length</b><p>
- This function sets the text, length and free function of a MX_STRING
- object. When mx_string_free() is called the free function will be called to
- release the memory associated with the text. The free parameter may be 0 in
- which case no function will be called to release the text memory.
- (<a href="../include/deds/string/set.c">../include/deds/string/set.c</a>)
- <p>If the len parameter is less than 0 (usually -1) then the string
- is assumed to be zero terminated.
- (<a href="../include/deds/string/set.c">../include/deds/string/set.c</a>)<p></li>
- <li>
- <a name="void mx_string(MX_STRING* string)"><code>void mx_string(MX_STRING* string)</code></a>
- <p>
- <p><b>Construct a MX_STRING</b><p>
- This function initializes a MX_STRING object. It writes the memory
- full with 0 values.
- (<a href="../include/deds/string/string.c">../include/deds/string/string.c</a>)
- <p>Since a MX_STRING filled with 0 is correctly constructed then
- static instances dont necessarily have to be constructed before use.
- (<a href="../include/deds/string/string.c">../include/deds/string/string.c</a>)<p></li>
- <li>
- <a name="void mx_string_free(MX_STRING* string)"><code>void mx_string_free(MX_STRING* string)</code></a>
- <p>
- <p><b>Destruct a MX_STRING</b><p>
- This function frees a MX_STRING object. If the associated free
- will be called to release any internal memory.
- (<a href="../include/deds/string/string.c">../include/deds/string/string.c</a>)<p></li>
- <li>
- <a name="const char* mx_string_text(const MX_STRING* string, int* len)"><code>const char* mx_string_text(const MX_STRING* string, int* len)</code></a>
- <p>
- <p><b>Get MX_STRING text and length</b><p>
- This function return the text of the string along with the length
- of the text segment.
- (<a href="../include/deds/string/text.c">../include/deds/string/text.c</a>)
- <p>The len argument can be 0 in which case the length is not returned.
- (<a href="../include/deds/string/text.c">../include/deds/string/text.c</a>)<p></li>
- <li>
- <a name="int mx_string_len(const MX_STRING* string)"><code>int mx_string_len(const MX_STRING* string)</code></a>
- <p>
- <p><b>Get MX_STRING length</b><p>
- This function return the length of the text segment.
- (<a href="../include/deds/string/text.c">../include/deds/string/text.c</a>)<p></li>
- </ul><p>Generated by <a href="http://www.deleveld.dds.nl/mxdoc/index.htm">MXDOC</a> 2.2 on Sun Feb 4 15:16:26 2007
- </body></html>
|