Sophie

Sophie

distrib > Mageia > 1 > i586 > by-pkgid > d92aa75c2d384ff9f513aed09a46f703 > files > 231

parrot-doc-3.1.0-2.mga1.i586.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Parrot  - A byte buffer</title>
        <link rel="stylesheet" type="text/css"
            href="../../../resources/parrot.css"
            media="all">
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    </head>
    <body>
        <div id="wrapper">
            <div id="header">

                <a href="http://www.parrot.org">
                <img border=0 src="../../../resources/parrot_logo.png" id="logo" alt="parrot">
                </a>
            </div> <!-- "header" -->
            <div id="divider"></div>
            <div id="mainbody">
                <div id="breadcrumb">
                    <a href="../../../html/index.html">Home</a> &raquo; <a href="../../../html/pmc.html">PMCs</a> &raquo; A byte buffer
                </div>

<h1><a name="NAME"
>NAME</a></h1>

<p>src/pmc/bytebuffer.pmc &#45; A byte buffer</p>

<h1><a name="DESCRIPTION"
>DESCRIPTION</a></h1>

<p><code>ByteBuffer</code> provides a resizable byte buffer with random access to individual bytes and conversions from and to parrot strings.</p>

<h2><a name="Vtable_functions"
>Vtable functions</a></h2>

<dl>
<dt><a name="void_init()"
><b><code>void init()</b></code></a></dt>
Create an empty buffer
<dt><a name="void_init_int()"
><b><code>void init_int()</b></code></a></dt>
Create a buffer of initial_size capacity.
<dt><a name="void_mark()"
><b><code>void mark()</b></code></a></dt>
Mark the source string if any.
<dt><a name="void_destroy()"
><b><code>void destroy()</b></code></a></dt>
Free the buffer when destroying.
<dt><a name="INTVAL_elements()"
><b><code>INTVAL elements()</b></code></a></dt>
Get current size.
<dt><a name="void_set_integer_native()"
><b><code>void set_integer_native()</b></code></a></dt>
Resize the buffer to the given value.
<dt><a name="void_set_string_native()"
><b><code>void set_string_native()</b></code></a></dt>
Reset the buffer with the content of the string.
<dt><a name="INTVAL_get_integer_keyed_int()"
><b><code>INTVAL get_integer_keyed_int()</b></code></a></dt>
Get the value of the byte at position or 0 if out of bounds.
<dt><a name="void_set_integer_keyed_int()"
><b><code>void set_integer_keyed_int()</b></code></a></dt>
Set the value of the byte at position,
resizing the buffer if the position is out of current size.
<dt><a name="void_push_integer(INTVAL_value)"
><b><code>void push_integer(INTVAL value)</b></code></a></dt>
Extends the buffer by adding a byte of value <code>value</code> to the end.
<dt><a name="PMC_*get_iter()"
><b><code>PMC *get_iter()</b></code></a></dt>
Return a new Iterator for this PMC.</dl>

<h2><a name="Methods"
>Methods</a></h2>

<dl>
<dt><a name="get_string(string_encoding)"
><b><code>get_string(string encoding)</b></code></a></dt>
Create a string with the buffer content and the encoding specified.
<dt><a name="get_string_as(string_as)"
><b><code>get_string_as(string as)</b></code></a></dt>
Create a string with the buffer content and the same encoding as the string argument.
<dt><a name="get_chars(int_pos,_int_length,_string_encoding)"
><b><code>get_chars(int pos, int length, string encoding)</b></code></a></dt>
Get a string from the buffer content with the specified encoding and length in codepoints.</dl>

<h2><a name="Auxiliar_functions"
>Auxiliar functions</a></h2>

<dl>
<dt><a name="static_INTVAL_grow_to(INTVAL_position)"
><b><code>static INTVAL grow_to(INTVAL position)</b></code></a></dt>
Calculate new size enough for using position and with some margin to decrease the number of reallocations.
<dt><a name="static_STRING_*_build_string(PARROT_INTERP,_const_unsigned_char_*content,_INTVAL_size,_const_STR_VTABLE_*encoding)"
><b><code>static STRING * build_string(PARROT_INTERP, const unsigned char *content, INTVAL size, const STR_VTABLE *encoding)</b></code></a></dt>
Build a string from the buffer content with the encoding specified.</dl>
            </div> <!-- "mainbody" -->
            <div id="divider"></div>
            <div id="footer">
	        Copyright &copy; 2002-2011, Parrot Foundation.
            </div>
        </div> <!-- "wrapper" -->
    </body>
</html>