php-doc-en/reference/quickhash/quickhashintset/loadfromstring.xml
Jakub Vrana 60ec244618 Fix protos
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@321911 c90b9560-bf6c-de11-be94-00142212c4b1
2012-01-08 07:59:53 +00:00

139 lines
3.7 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="quickhashintset.loadfromstring" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashIntSet::loadFromString</refname>
<refpurpose>This factory method creates a set from a string</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <modifier>static</modifier> <type>QuickHashIntSet</type><methodname>QuickHashIntSet::loadFromString</methodname>
<methodparam><type>string</type><parameter>contents</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>size</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<para>
This factory method creates a new set from a definition in a string. The
file format consists of 32 bit signed integers packed together in the
Endianness that the system that the code runs on uses.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>contents</parameter></term>
<listitem>
<para>
The string containing a serialized format of the set.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>size</parameter></term>
<listitem>
<para>
The amount of bucket lists to configure. The number you pass in will be
automatically rounded up to the next power of two. It is also
automatically limited from 4 to 4194304.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>options</parameter></term>
<listitem>
<para>
The same options that the class' constructor takes; except that the size
option is ignored. It is automatically calculated to be the same as the
number of entries in the set, rounded up to the nearest power of two
automatically limited from 64 to 4194304.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a new QuickHashIntSet.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashIntSet::loadFromString</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$contents = file_get_contents( dirname( __FILE__ ) . "/simple.set" );
$set = QuickHashIntSet::loadFromString(
$contents,
QuickHashIntSet::DO_NOT_USE_ZEND_ALLOC
);
foreach( range( 0, 0x0f ) as $key )
{
printf( "Key %3d (%2x) is %s\n",
$key, $key,
$set->exists( $key ) ? 'set' : 'unset'
);
}
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
Key 0 ( 0) is unset
Key 1 ( 1) is set
Key 2 ( 2) is set
Key 3 ( 3) is set
Key 4 ( 4) is unset
Key 5 ( 5) is set
Key 6 ( 6) is unset
Key 7 ( 7) is set
Key 8 ( 8) is unset
Key 9 ( 9) is unset
Key 10 ( a) is unset
Key 11 ( b) is set
Key 12 ( c) is unset
Key 13 ( d) is set
Key 14 ( e) is unset
Key 15 ( f) is unset
]]>
</screen>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->