📄 arrays_byte.sgml
字号:
</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-byte-array-prepend">g_byte_array_prepend ()</title><programlisting><link linkend="GByteArray">GByteArray</link>* g_byte_array_prepend (<link linkend="GByteArray">GByteArray</link> *array, const <link linkend="guint8">guint8</link> *data, <link linkend="guint">guint</link> len);</programlisting><para>Adds the given data to the start of the <link linkend="GByteArray">GByteArray</link>.The array will grow in size automatically if necessary.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>array</parameter> :</entry><entry>a <link linkend="GByteArray">GByteArray</link>.</entry></row><row><entry align="right"><parameter>data</parameter> :</entry><entry>the byte data to be added.</entry></row><row><entry align="right"><parameter>len</parameter> :</entry><entry>the number of bytes to add.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the <link linkend="GByteArray">GByteArray</link>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-byte-array-remove-index">g_byte_array_remove_index ()</title><programlisting><link linkend="GByteArray">GByteArray</link>* g_byte_array_remove_index (<link linkend="GByteArray">GByteArray</link> *array, <link linkend="guint">guint</link> index);</programlisting><para>Removes the byte at the given index from a <link linkend="GByteArray">GByteArray</link>.The following bytes are moved down one place.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>array</parameter> :</entry><entry>a <link linkend="GByteArray">GByteArray</link>.</entry></row><row><entry align="right"><parameter>index</parameter> :</entry><entry>the index of the byte to remove.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the <link linkend="GByteArray">GByteArray</link>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-byte-array-remove-index-fast">g_byte_array_remove_index_fast ()</title><programlisting><link linkend="GByteArray">GByteArray</link>* g_byte_array_remove_index_fast (<link linkend="GByteArray">GByteArray</link> *array, <link linkend="guint">guint</link> index);</programlisting><para>Removes the byte at the given index from a <link linkend="GByteArray">GByteArray</link>.The last element in the array is used to fill in the space, so this functiondoes not preserve the order of the <link linkend="GByteArray">GByteArray</link>. But it is faster than<link linkend="g-byte-array-remove-index">g_byte_array_remove_index</link>().</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>array</parameter> :</entry><entry>a <link linkend="GByteArray">GByteArray</link>.</entry></row><row><entry align="right"><parameter>index</parameter> :</entry><entry>the index of the byte to remove.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the <link linkend="GByteArray">GByteArray</link>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-byte-array-sort">g_byte_array_sort ()</title><programlisting>void g_byte_array_sort (<link linkend="GByteArray">GByteArray</link> *array, <link linkend="GCompareFunc">GCompareFunc</link> compare_func);</programlisting><para>Sorts a byte array, using <parameter>compare_func</parameter> which should be a <function><link linkend="qsort">qsort</link>()</function>-stylecomparison function (returns -1 for first arg is less than second arg, 0 forequal, 1 if first arg is greater than second arg).</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>array</parameter> :</entry><entry>a <link linkend="GByteArray">GByteArray</link>.</entry></row><row><entry align="right"><parameter>compare_func</parameter> :</entry><entry>comparison function.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-byte-array-sort-with-data">g_byte_array_sort_with_data ()</title><programlisting>void g_byte_array_sort_with_data (<link linkend="GByteArray">GByteArray</link> *array, <link linkend="GCompareDataFunc">GCompareDataFunc</link> compare_func, <link linkend="gpointer">gpointer</link> user_data);</programlisting><para>Like <link linkend="g-byte-array-sort">g_byte_array_sort</link>(), but the comparison function takes a user data argument.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>array</parameter> :</entry><entry>a <link linkend="GByteArray">GByteArray</link>.</entry></row><row><entry align="right"><parameter>compare_func</parameter> :</entry><entry>comparison function.</entry></row><row><entry align="right"><parameter>user_data</parameter> :</entry><entry>data to pass to <parameter>compare_func</parameter>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-byte-array-set-size">g_byte_array_set_size ()</title><programlisting><link linkend="GByteArray">GByteArray</link>* g_byte_array_set_size (<link linkend="GByteArray">GByteArray</link> *array, <link linkend="guint">guint</link> length);</programlisting><para>Sets the size of the <link linkend="GByteArray">GByteArray</link>, expanding it if necessary.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>array</parameter> :</entry><entry>a <link linkend="GByteArray">GByteArray</link>.</entry></row><row><entry align="right"><parameter>length</parameter> :</entry><entry>the new size of the <link linkend="GByteArray">GByteArray</link>.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the <link linkend="GByteArray">GByteArray</link>.</entry></row></tbody></tgroup></informaltable></refsect2><refsect2><title><anchor id="g-byte-array-free">g_byte_array_free ()</title><programlisting><link linkend="guint8">guint8</link>* g_byte_array_free (<link linkend="GByteArray">GByteArray</link> *array, <link linkend="gboolean">gboolean</link> free_segment);</programlisting><para>Frees the memory allocated by the <link linkend="GByteArray">GByteArray</link>.If <parameter>free_segment</parameter> is <literal>TRUE</literal> it frees the actual byte data.</para><informaltable pgwide="1" frame="none" role="params"><tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*"><tbody><row><entry align="right"><parameter>array</parameter> :</entry><entry>a <link linkend="GByteArray">GByteArray</link>.</entry></row><row><entry align="right"><parameter>free_segment</parameter> :</entry><entry>if <literal>TRUE</literal> the actual byte data is freed as well.</entry></row><row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry></entry></row></tbody></tgroup></informaltable></refsect2></refsect1></refentry>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -