- Added the QuickHash extension's documentation.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@313895 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Derick Rethans 2011-07-28 17:20:50 +00:00
parent 709d4139c8
commit 5fe42e0290
59 changed files with 5857 additions and 0 deletions

View file

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<book xml:id="book.quickhash" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Quickhash</title>
<titleabbrev>Quickhash</titleabbrev>
<preface xml:id="intro.quickhash">
&reftitle.intro;
<para>
The quickhash extension contains a set of specific strongly-typed classes
to deal with specific set and hash implementions.
</para>
</preface>
&reference.quickhash.setup;
&reference.quickhash.constants;
&reference.quickhash.examples;
&reference.quickhash.quickhashintset;
&reference.quickhash.quickhashinthash;
&reference.quickhash.quickhashstringinthash;
&reference.quickhash.quickhashintstringhash;
</book>
<!-- 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:"../../../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
-->

View file

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<appendix xml:id="quickhash.constants" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.constants;
&no.constants;
</appendix>
<!-- 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:"../../../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
-->

View file

@ -0,0 +1,12 @@
&reference.quickhash.quickhashinthash.add;
&reference.quickhash.quickhashinthash.construct;
&reference.quickhash.quickhashinthash.delete;
&reference.quickhash.quickhashinthash.exists;
&reference.quickhash.quickhashinthash.get;
&reference.quickhash.quickhashinthash.getsize;
&reference.quickhash.quickhashinthash.loadfromfile;
&reference.quickhash.quickhashinthash.loadfromstring;
&reference.quickhash.quickhashinthash.savetofile;
&reference.quickhash.quickhashinthash.savetostring;
&reference.quickhash.quickhashinthash.set;
&reference.quickhash.quickhashinthash.update;

View file

@ -0,0 +1,9 @@
&reference.quickhash.quickhashintset.add;
&reference.quickhash.quickhashintset.construct;
&reference.quickhash.quickhashintset.delete;
&reference.quickhash.quickhashintset.exists;
&reference.quickhash.quickhashintset.getsize;
&reference.quickhash.quickhashintset.loadfromfile;
&reference.quickhash.quickhashintset.loadfromstring;
&reference.quickhash.quickhashintset.savetofile;
&reference.quickhash.quickhashintset.savetostring;

View file

@ -0,0 +1,12 @@
&reference.quickhash.quickhashintstringhash.add;
&reference.quickhash.quickhashintstringhash.construct;
&reference.quickhash.quickhashintstringhash.delete;
&reference.quickhash.quickhashintstringhash.exists;
&reference.quickhash.quickhashintstringhash.get;
&reference.quickhash.quickhashintstringhash.getsize;
&reference.quickhash.quickhashintstringhash.loadfromfile;
&reference.quickhash.quickhashintstringhash.loadfromstring;
&reference.quickhash.quickhashintstringhash.savetofile;
&reference.quickhash.quickhashintstringhash.savetostring;
&reference.quickhash.quickhashintstringhash.set;
&reference.quickhash.quickhashintstringhash.update;

View file

@ -0,0 +1,12 @@
&reference.quickhash.quickhashstringinthash.add;
&reference.quickhash.quickhashstringinthash.construct;
&reference.quickhash.quickhashstringinthash.delete;
&reference.quickhash.quickhashstringinthash.exists;
&reference.quickhash.quickhashstringinthash.get;
&reference.quickhash.quickhashstringinthash.getsize;
&reference.quickhash.quickhashstringinthash.loadfromfile;
&reference.quickhash.quickhashstringinthash.loadfromstring;
&reference.quickhash.quickhashstringinthash.savetofile;
&reference.quickhash.quickhashstringinthash.savetostring;
&reference.quickhash.quickhashstringinthash.set;
&reference.quickhash.quickhashstringinthash.update;

View file

@ -0,0 +1,150 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<chapter xml:id="quickhash.examples" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.examples;
<example>
<title>Quickhash Example</title>
<programlisting role="php">
<![CDATA[
<?php
$set = new QuickHashIntSet( 1024, QuickHashIntSet::CHECK_FOR_DUPES );
$set->add( 1 );
$set->add( 3 );
var_dump( $set->exists( 3 ) );
var_dump( $set->exists( 4 ) );
$set->saveToFile( "/tmp/test-set.set" );
$newSet = QuickHashIntSet::loadFromFile(
"/tmp/test-set.set"
);
var_dump( $newSet->exists( 3 ) );
var_dump( $newSet->exists( 4 ) );
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
bool(true)
bool(false)
bool(true)
bool(false)
]]>
</screen>
</example>
<example>
<title>Quickhash ArrayAccess Example</title>
<programlisting role="php">
<![CDATA[
<?php
$hash = new QuickHashIntHash( 64 );
// Adding and updating hash entries.
$hash[3] = 145926;
$hash[3] = 1415926;
$hash[2] = 72;
// Checking if keys exist
var_dump( isset( $hash[3] ) );
// Removing hash entries
unset( $hash[2] );
// Retrieving the value stored for a hash
echo $hash[3], "\n";
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
bool(true)
1415926
]]>
</screen>
</example>
<example>
<title>Quickhash Iterator Example</title>
<programlisting role="php">
<![CDATA[
<?php
$hash = new QuickHashIntHash( 64 );
// Adding hash entries.
$hash[1] = 145926;
$hash[2] = 1415926;
$hash[3] = 72;
$hash[4] = 712314;
$hash[5] = -4234;
foreach( $hash as $key => $value )
{
echo $key, ' => ', $value, "\n";
}
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
5 => -4234
4 => 712314
1 => 145926
2 => 1415926
3 => 72
]]>
</screen>
</example>
<example>
<title>Quickhash String Values Example</title>
<programlisting role="php">
<![CDATA[
<?php
$hash = new QuickHashIntStringHash( 64 );
// Adding hash entries.
$hash[1] = "one million four hundred fifteen thousand nine hundred twenty six";
$hash->add( 2, "one more" );1415926;
foreach( $hash as $key => $value )
{
echo $key, ' => ', $value, "\n";
}
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
1 => one million four hundred fifteen thousand nine hundred twenty six
2 => one more
]]>
</screen>
</example>
</chapter>
<!-- 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:"../../../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
-->

View file

@ -0,0 +1,160 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<phpdoc:classref xml:id="class.quickhashinthash" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>The QuickHashIntHash class</title>
<titleabbrev>QuickHashIntHash</titleabbrev>
<partintro>
<!-- {{{ QuickHashIntHash intro -->
<section xml:id="quickhashinthash.intro">
&reftitle.intro;
<para>
This class wraps around a hash containing integer numbers, where the
values are also integer numbers. Hashes are also available as
implementation of the ArrayAccess interface.
</para>
<para>
Hashes can also be iterated over with foreach as the Iterator interface is
implemented as well. The order of which elements are returned in is not
guaranteed.
</para>
</section>
<!-- }}} -->
<section xml:id="quickhashinthash.synopsis">
&reftitle.classsynopsis;
<!-- {{{ Synopsis -->
<classsynopsis>
<ooclass><classname>QuickHashIntHash</classname></ooclass>
<!-- {{{ Class synopsis -->
<classsynopsisinfo>
<ooclass>
<classname>QuickHashIntHash</classname>
</ooclass>
</classsynopsisinfo>
<!-- }}} -->
<classsynopsisinfo role="comment">Constants</classsynopsisinfo>
<fieldsynopsis>
<modifier>const</modifier>
<type>integer</type>
<varname linkend="quickhashinthash.constants.check-for-dupes">QuickHashIntHash::CHECK_FOR_DUPES</varname>
<initializer>1</initializer>
</fieldsynopsis>
<fieldsynopsis>
<modifier>const</modifier>
<type>integer</type>
<varname linkend="quickhashinthash.constants.do-not-use-zend-alloc">QuickHashIntHash::DO_NOT_USE_ZEND_ALLOC</varname>
<initializer>2</initializer>
</fieldsynopsis>
<fieldsynopsis>
<modifier>const</modifier>
<type>integer</type>
<varname linkend="quickhashinthash.constants.hasher-no-hash">QuickHashIntHash::HASHER_NO_HASH</varname>
<initializer>256</initializer>
</fieldsynopsis>
<fieldsynopsis>
<modifier>const</modifier>
<type>integer</type>
<varname linkend="quickhashinthash.constants.hasher-jenkins1">QuickHashIntHash::HASHER_JENKINS1</varname>
<initializer>512</initializer>
</fieldsynopsis>
<fieldsynopsis>
<modifier>const</modifier>
<type>integer</type>
<varname linkend="quickhashinthash.constants.hasher-jenkins2">QuickHashIntHash::HASHER_JENKINS2</varname>
<initializer>1024</initializer>
</fieldsynopsis>
<classsynopsisinfo role="comment">Methods</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.quickhashinthash')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
</classsynopsis>
<!-- }}} -->
</section>
<!-- {{{ QuickHashIntHash constants -->
<section xml:id="quickhashinthash.constants">
&reftitle.constants;
<section xml:id="quickhashinthash.constants.types">
<title>QuickHashIntHash Node Types</title>
<variablelist>
<varlistentry xml:id="quickhashinthash.constants.check-for-dupes">
<term><constant>QuickHashIntHash::CHECK_FOR_DUPES</constant></term>
<listitem>
<para>If enabled, adding duplicate elements to a set (through either add() or
loadFromFile()) will result in those elements to be dropped from the
set. This will take up extra time, so only used when it is required.</para>
</listitem>
</varlistentry>
<varlistentry xml:id="quickhashinthash.constants.do-not-use-zend-alloc">
<term><constant>QuickHashIntHash::DO_NOT_USE_ZEND_ALLOC</constant></term>
<listitem>
<para>Disables the use of PHP's internal memory manager for internal
set structures. With this option enabled, internal allocations will not
count towards the memory_limit settings.</para>
</listitem>
</varlistentry>
<varlistentry xml:id="quickhashinthash.constants.hasher-no-hash">
<term><constant>QuickHashIntHash::HASHER_NO_HASH</constant></term>
<listitem>
<para>Selects to not use a hashing function, but merely use a modulo to
find the bucket list index. This is not faster than normal hashing, and
gives more collisions.</para>
</listitem>
</varlistentry>
<varlistentry xml:id="quickhashinthash.constants.hasher-jenkins1">
<term><constant>QuickHashIntHash::HASHER_JENKINS1</constant></term>
<listitem>
<para>This is the default hashing function to turn the integer hashes
into bucket list indexes.</para>
</listitem>
</varlistentry>
<varlistentry xml:id="quickhashinthash.constants.hasher-jenkins2">
<term><constant>QuickHashIntHash::HASHER_JENKINS2</constant></term>
<listitem>
<para>Selects a variant hashing algorithm.</para>
</listitem>
</varlistentry>
</variablelist>
</section>
</section>
<!-- }}} -->
</partintro>
&reference.quickhash.entities.quickhashinthash;
</phpdoc:classref>
<!-- 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:"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
-->

View file

@ -0,0 +1,138 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashinthash.add" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashIntHash::add</refname>
<refpurpose>This method adds a new entry to the hash.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>boolean</type><methodname>QuickHashIntHash::add</methodname>
<methodparam><type>integer</type><parameter>key</parameter></methodparam>
<methodparam choice="opt"><type>integer</type><parameter>value</parameter></methodparam>
</methodsynopsis>
<para>
This method adds a new entry to the hash, and returns whether the entry was
added. Entries are by default always added unless
QuickHashIntHash::CHECK_FOR_DUPES has been passed when the hash was created.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>key</parameter></term>
<listitem>
<para>
The key of the entry to add.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>value</parameter></term>
<listitem>
<para>
The optional value of the entry to add. If no value is specified,
<literal>1</literal> will be used.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&true; when the entry was added, and &false; if the entry was not added.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashIntHash::add</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
echo "without dupe checking\n";
$hash = new QuickHashIntHash( 1024 );
var_dump( $hash->exists( 4 ) );
var_dump( $hash->get( 4 ) );
var_dump( $hash->add( 4, 22 ) );
var_dump( $hash->exists( 4 ) );
var_dump( $hash->get( 4 ) );
var_dump( $hash->add( 4, 12 ) );
echo "\nwith dupe checking\n";
$hash = new QuickHashIntHash( 1024, QuickHashIntHash::CHECK_FOR_DUPES );
var_dump( $hash->exists( 4 ) );
var_dump( $hash->get( 4 ) );
var_dump( $hash->add( 4, 78 ) );
var_dump( $hash->exists( 4 ) );
var_dump( $hash->get( 4 ) );
var_dump( $hash->add( 4, 9 ) );
echo "\ndefault value\n";
var_dump( $hash->add( 5 ) );
var_dump( $hash->get( 5 ) );
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
without dupe checking
bool(false)
bool(false)
bool(true)
bool(true)
int(22)
bool(true)
with dupe checking
bool(false)
bool(false)
bool(true)
bool(true)
int(78)
bool(false)
default value
bool(true)
int(1)
]]>
</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:"../../../../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
-->

View file

@ -0,0 +1,108 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashinthash.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashIntHash::__construct</refname>
<refpurpose>Creates a new QuickHashIntHash object</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<methodname>QuickHashIntHash::__construct</methodname>
<methodparam><type>integer</type><parameter>size</parameter></methodparam>
<methodparam choice="opt"><type>integer</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<para>
This constructor creates a new QuickHashIntHash. The size is the amount of
bucket lists to create. The more lists there are, the less collisions you
will have. Options are also supported.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<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 64 to 4194304.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>options</parameter></term>
<listitem>
<para>
The options that you can pass in are: QuickHashIntHash::CHECK_FOR_DUPES,
which makes sure no duplicate entries are added to the hash;
QuickHashIntHash::DO_NOT_USE_ZEND_ALLOC to not use PHP's internal memory
manager as well as one of QuickHashIntHash::HASHER_NO_HASH,
QuickHashIntHash::HASHER_JENKINS1 or QuickHashIntHash::HASHER_JENKINS2.
These last three configure which hashing algorithm to use. All options
can be combined using bitmasks.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a new QuickHashIntHash object.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashIntHash::__construct</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
var_dump( new QuickHashIntHash( 1024 ) );
var_dump( new QuickHashIntHash( 1024, QuickHashIntHash::CHECK_FOR_DUPES ) );
var_dump(
new QuickHashIntHash(
1024,
QuickHashIntHash::DO_NOT_USE_ZEND_ALLOC | QuickHashIntHash::HASHER_JENKINS2
)
);
?>
]]>
</programlisting>
</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:"../../../../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
-->

View file

@ -0,0 +1,102 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashinthash.delete" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashIntHash::delete</refname>
<refpurpose>This method deletes am entry from the hash.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>boolean</type><methodname>QuickHashIntHash::delete</methodname>
<methodparam><type>integer</type><parameter>key</parameter></methodparam>
</methodsynopsis>
<para>
This method deletes an entry from the hash, and returns whether the entry was
deleted or not. Associated memory structures will not be freed immediately,
but rather when the hash itself is freed.
</para>
<para>
Elements can not be deleted when the hash is used in an iterator. The
method will not throw an exception, but simply return &false; like would
happen with any other deletion failure.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>key</parameter></term>
<listitem>
<para>
The key of the entry to delete.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&true; when the entry was deleted, and &false; if the entry was not deleted.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashIntHash::delete</function> example</title>
<programlisting role="php">
<![CDATA[<?php
$hash = new QuickHashIntHash( 1024 );
var_dump( $hash->exists( 4 ) );
var_dump( $hash->add( 4, 5 ) );
var_dump( $hash->delete( 4 ) );
var_dump( $hash->exists( 4 ) );
var_dump( $hash->delete( 4 ) );
?>]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
bool(false)
bool(true)
bool(true)
bool(false)
bool(false)
]]>
</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:"../../../../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
-->

View file

@ -0,0 +1,112 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashinthash.exists" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashIntHash::exists</refname>
<refpurpose>This method checks whether a key is part of the hash</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>boolean</type><methodname>QuickHashIntHash::exists</methodname>
<methodparam><type>integer</type><parameter>key</parameter></methodparam>
</methodsynopsis>
<para>
This method checks whether an entry with the provided key exists in the
hash.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>key</parameter></term>
<listitem>
<para>
The key of the entry to check for whether it exists in the hash.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns &true; when the entry was found, or &false; when the entry is not
found.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashIntHash::exists</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
//generate 200000 elements
$array = range( 0, 199999 );
$existingEntries = array_rand( array_flip( $array ), 180000 );
$testForEntries = array_rand( array_flip( $array ), 1000 );
$foundCount = 0;
echo "Creating hash: ", microtime( true ), "\n";
$hash = new QuickHashIntHash( 100000 );
echo "Adding elements: ", microtime( true ), "\n";
foreach( $existingEntries as $key )
{
$hash->add( $key, 56 );
}
echo "Doing 1000 tests: ", microtime( true ), "\n";
foreach( $testForEntries as $key )
{
$foundCount += $hash->exists( $key );
}
echo "Done, $foundCount found: ", microtime( true ), "\n";
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
Creating hash: 1263588703.0748
Adding elements: 1263588703.0757
Doing 1000 tests: 1263588703.7851
Done, 898 found: 1263588703.7897
]]>
</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:"../../../../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
-->

View file

@ -0,0 +1,99 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashinthash.get" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashIntHash::get</refname>
<refpurpose>This method retrieves a value from the hash by its key.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>integer</type><methodname>QuickHashIntHash::get</methodname>
<methodparam><type>integer</type><parameter>key</parameter></methodparam>
</methodsynopsis>
<para>
This method retrieves a value from the hash by its key.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>key</parameter></term>
<listitem>
<para>
The key of the entry to add.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The value if the key exists, or &null; if the key wasn't part of the hash.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashIntHash::get</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$hash = new QuickHashIntHash( 8 );
var_dump( $hash->get( 1 ) );
var_dump( $hash->add( 2 ) );
var_dump( $hash->get( 2 ) );
var_dump( $hash->add( 3, 5 ) );
var_dump( $hash->get( 3 ) );
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
bool(false)
bool(true)
int(1)
bool(true)
int(5)
]]>
</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:"../../../../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
-->

View file

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashinthash.getsize" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashIntHash::getSize</refname>
<refpurpose>Returns the number of elements in the hash</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>integer</type><methodname>QuickHashIntHash::getSize</methodname><void/>
</methodsynopsis>
<para>
Returns the number of elements in the hash.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>key</parameter></term>
<listitem>
<para>
The key of the entry to add.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The number of elements in the hash.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashIntHash::getSize</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$hash = new QuickHashIntHash( 8 );
var_dump( $hash->add( 2 ) );
var_dump( $hash->add( 3, 5 ) );
var_dump( $hash->getSize() );
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
bool(true)
bool(true)
int(2)
]]>
</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:"../../../../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
-->

View file

@ -0,0 +1,162 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashinthash.loadfromfile" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashIntHash::loadFromFile</refname>
<refpurpose>This factory method creates a hash from a file</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <modifier>static</modifier> <type>QuickHashIntHash</type><methodname>QuickHashIntHash::loadFromFile</methodname>
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
<methodparam choice="opt"><type>integer</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<para>
This factory method creates a new hash from a definition file on disk. The
file format consists of a signature 'QH\0x11\0', the number of elements as
a 32 bit signed integer in system Endianness, followed by 32 bit signed
integers packed together in the Endianness that the system that the code
runs on uses. For each hash element there are two 32 bit signed integers
stored. The first of each element is the key, and the second is the value
belonging to the key. An example could be:
</para>
<para>
<example>
<title>QuickHash IntHash file format</title>
<screen><![CDATA[00000000 51 48 11 00 02 00 00 00 01 00 00 00 01 00 00 00 |QH..............|
00000010 03 00 00 00 09 00 00 00 |........|
00000018
]]></screen>
</example>
</para>
<para>
<example>
<title>QuickHash IntHash file format</title>
<screen><![CDATA[header signature ('QH'; key type: 1; value type: 1; filler: \0x00)
00000000 51 48 11 00
number of elements:
00000004 02 00 00 00
data string:
00000000 01 00 00 00 01 00 00 00 03 00 00 00 09 00 00 00
key/value 1 (key = 1, value = 1)
01 00 00 00 01 00 00 00
key/value 2 (key = 3, value = 9)
03 00 00 00 09 00 00 00
]]></screen>
</example>
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>filename</parameter></term>
<listitem>
<para>
The filename of the file to read the hash from.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>options</parameter></term>
<listitem>
<para>
The same options that the class' contructor takes; except that the size
option is ignored. It is automatically calculated to be the same as the
number of entries in the hash, rounded up to the nearest power of two
with a maximum limit of 4194304.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a new QuickHashIntHash.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashIntHash::loadFromFile</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$file = dirname( __FILE__ ) . "/simple.hash";
$hash = QuickHashIntHash::loadFromFile(
$file,
QuickHashIntHash::DO_NOT_USE_ZEND_ALLOC
);
foreach( range( 0, 0x0f ) as $key )
{
printf( "Key %3d (%2x) is %s\n",
$key, $key,
$hash->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:"../../../../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
-->

View file

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashinthash.loadfromstring" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashIntHash::loadFromString</refname>
<refpurpose>This factory method creates a hash from a string</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <modifier>static</modifier> <type>QuickHashIntHash</type><methodname>QuickHashIntHash::loadFromString</methodname>
<methodparam><type>string</type><parameter>contents</parameter></methodparam>
<methodparam choice="opt"><type>integer</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<para>
This factory method creates a new hash 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. For each element
there are two 32 bit signed integers stored. The first of each element is
the key, and the second is the value belonging to the key.
</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 hash.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>options</parameter></term>
<listitem>
<para>
The same options that the class' contructor takes; except that the size
option is ignored. It is automatically calculated to be the same as the
number of entries in the hash, rounded up to the nearest power of two
with a maximum limit of 4194304.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a new QuickHashIntHash.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashIntHash::loadFromString</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$contents = file_get_contents( dirname( __FILE__ ) . "/simple.hash" );
$hash = QuickHashIntHash::loadFromString(
$contents,
QuickHashIntHash::DO_NOT_USE_ZEND_ALLOC
);
foreach( range( 0, 0x0f ) as $key )
{
printf( "Key %3d (%2x) is %s\n",
$key, $key,
$hash->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:"../../../../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
-->

View file

@ -0,0 +1,89 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashinthash.savetofile" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashIntHash::saveToFile</refname>
<refpurpose>This method stores an in-memory hash to disk.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>void</type><methodname>QuickHashIntHash::saveToFile</methodname>
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
</methodsynopsis>
<para>
This method stores an existing hash to a file on disk, in the same format
that loadFromFile() can read.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>filename</parameter></term>
<listitem>
<para>
The filename of the file to store the hash in.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
This method doesn't return anything.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashIntHash::saveToFile</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$hash = new QuickHashIntHash( 1024 );
var_dump( $hash->exists( 4 ) );
var_dump( $hash->add( 4, 43 ) );
var_dump( $hash->exists( 4 ) );
var_dump( $hash->add( 4, 52 ) );
$hash->saveToFile( '/tmp/test.hash' );
?>
]]>
</programlisting>
</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:"../../../../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
-->

View file

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashinthash.savetostring" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashIntHash::saveToString</refname>
<refpurpose>This method returns a serialized version of the hash.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>string</type><methodname>QuickHashIntHash::saveToString</methodname><void/>
</methodsynopsis>
<para>
This method returns a serialized version of the hash in the same format that
loadFromString() can read.
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
This method returns a string containing a serialized format of the hash.
Each element is stored as a four byte value in the Endianness that the
current system uses.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashIntHash::saveToString</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$hash = new QuickHashIntHash( 1024 );
var_dump( $hash->exists( 4 ) );
var_dump( $hash->add( 4, 34 ) );
var_dump( $hash->exists( 4 ) );
var_dump( $hash->add( 4, 55 ) );
var_dump( $hash->saveToString() );
?>
]]>
</programlisting>
</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:"../../../../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
-->

View file

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashinthash.set" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashIntHash::set</refname>
<refpurpose>This method updates an entry in the hash with a new value, or
adds a new one if the entry doesn't exist.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>boolean</type><methodname>QuickHashIntHash::set</methodname>
<methodparam><type>integer</type><parameter>key</parameter></methodparam>
<methodparam><type>integer</type><parameter>value</parameter></methodparam>
</methodsynopsis>
<para>
This method tries to update an entry with a new value. In case the entry
did not yet exist, it will instead add a new entry. It returns whether the
entry was added or update. If there are duplicate keys, only the first
found element will get an updated value. Use
QuickHashIntHash::CHECK_FOR_DUPES during hash creation to prevent duplicate
keys from being part of the hash.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>key</parameter></term>
<listitem>
<para>
The key of the entry to add or update.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>value</parameter></term>
<listitem>
<para>
The new value to set the entry with.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
2 if the entry was found and updated, 1if the entry was newly added or 0
if there was an error.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashIntHash::set</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$hash = new QuickHashIntHash( 1024 );
echo "Set->Add\n";
var_dump( $hash->get( 46692 ) );
var_dump( $hash->set( 46692, 16091 ) );
var_dump( $hash->get( 46692 ) );
echo "Set->Update\n";
var_dump( $hash->set( 46692, 29906 ) );
var_dump( $hash->get( 46692 ) );
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
bool(false)
int(2)
int(16091)
Set->Update
int(1)
int(29906)
]]>
</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:"../../../../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
-->

View file

@ -0,0 +1,107 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashinthash.update" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashIntHash::update</refname>
<refpurpose>This method updates an entry in the hash with a new value.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>boolean</type><methodname>QuickHashIntHash::update</methodname>
<methodparam><type>integer</type><parameter>key</parameter></methodparam>
<methodparam><type>integer</type><parameter>value</parameter></methodparam>
</methodsynopsis>
<para>
This method updates an entry with a new value, and returns whether the entry was
update. If there are duplicate keys, only the first found element will get
an updated value. Use QuickHashIntHash::CHECK_FOR_DUPES during hash
creation to prevent duplicate keys from being part of the hash.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>key</parameter></term>
<listitem>
<para>
The key of the entry to add.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>value</parameter></term>
<listitem>
<para>
The new value to update the entry with.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&true; when the entry was found and updated, and &false; if the entry was
not part of the hash already.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashIntHash::update</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$hash = new QuickHashIntHash( 1024 );
var_dump( $hash->add( 141421, 173205 ) );
var_dump( $hash->update( 141421, 223606 ) );
var_dump( $hash->get( 141421 ) );
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
bool(true)
bool(true)
int(223606)
]]>
</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:"../../../../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
-->

View file

@ -0,0 +1,158 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<phpdoc:classref xml:id="class.quickhashintset" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>The QuickHashIntSet class</title>
<titleabbrev>QuickHashIntSet</titleabbrev>
<partintro>
<!-- {{{ QuickHashIntSet intro -->
<section xml:id="quickhashintset.intro">
&reftitle.intro;
<para>
This class wraps around a set containing integer numbers.
</para>
<para>
Sets can also be iterated over with foreach as the Iterator interface is
implemented as well. The order of which elements are returned in is not
guaranteed.
</para>
</section>
<!-- }}} -->
<section xml:id="quickhashintset.synopsis">
&reftitle.classsynopsis;
<!-- {{{ Synopsis -->
<classsynopsis>
<ooclass><classname>QuickHashIntSet</classname></ooclass>
<!-- {{{ Class synopsis -->
<classsynopsisinfo>
<ooclass>
<classname>QuickHashIntSet</classname>
</ooclass>
</classsynopsisinfo>
<!-- }}} -->
<classsynopsisinfo role="comment">Constants</classsynopsisinfo>
<fieldsynopsis>
<modifier>const</modifier>
<type>integer</type>
<varname linkend="quickhashintset.constants.check-for-dupes">QuickHashIntSet::CHECK_FOR_DUPES</varname>
<initializer>1</initializer>
</fieldsynopsis>
<fieldsynopsis>
<modifier>const</modifier>
<type>integer</type>
<varname linkend="quickhashintset.constants.do-not-use-zend-alloc">QuickHashIntSet::DO_NOT_USE_ZEND_ALLOC</varname>
<initializer>2</initializer>
</fieldsynopsis>
<fieldsynopsis>
<modifier>const</modifier>
<type>integer</type>
<varname linkend="quickhashintset.constants.hasher-no-hash">QuickHashIntSet::HASHER_NO_HASH</varname>
<initializer>256</initializer>
</fieldsynopsis>
<fieldsynopsis>
<modifier>const</modifier>
<type>integer</type>
<varname linkend="quickhashintset.constants.hasher-jenkins1">QuickHashIntSet::HASHER_JENKINS1</varname>
<initializer>512</initializer>
</fieldsynopsis>
<fieldsynopsis>
<modifier>const</modifier>
<type>integer</type>
<varname linkend="quickhashintset.constants.hasher-jenkins2">QuickHashIntSet::HASHER_JENKINS2</varname>
<initializer>1024</initializer>
</fieldsynopsis>
<classsynopsisinfo role="comment">Methods</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.quickhashintset')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
</classsynopsis>
<!-- }}} -->
</section>
<!-- {{{ QuickHashIntSet constants -->
<section xml:id="quickhashintset.constants">
&reftitle.constants;
<section xml:id="quickhashintset.constants.types">
<title>QuickHashIntSet Node Types</title>
<variablelist>
<varlistentry xml:id="quickhashintset.constants.check-for-dupes">
<term><constant>QuickHashIntSet::CHECK_FOR_DUPES</constant></term>
<listitem>
<para>If enabled, adding duplicate elements to a set (through either add() or
loadFromFile()) will result in those elements to be dropped from the
set. This will take up extra time, so only used when it is required.</para>
</listitem>
</varlistentry>
<varlistentry xml:id="quickhashintset.constants.do-not-use-zend-alloc">
<term><constant>QuickHashIntSet::DO_NOT_USE_ZEND_ALLOC</constant></term>
<listitem>
<para>Disables the use of PHP's internal memory manager for internal
set structures. With this option enabled, internal allocations will not
count towards the memory_limit settings.</para>
</listitem>
</varlistentry>
<varlistentry xml:id="quickhashintset.constants.hasher-no-hash">
<term><constant>QuickHashIntSet::HASHER_NO_HASH</constant></term>
<listitem>
<para>Selects to not use a hashing function, but merely use a modulo to
find the bucket list index. This is not faster than normal hashing, and
gives more collisions.</para>
</listitem>
</varlistentry>
<varlistentry xml:id="quickhashintset.constants.hasher-jenkins1">
<term><constant>QuickHashIntSet::HASHER_JENKINS1</constant></term>
<listitem>
<para>This is the default hashing function to turn the integer hashes
into bucket list indexes.</para>
</listitem>
</varlistentry>
<varlistentry xml:id="quickhashintset.constants.hasher-jenkins2">
<term><constant>QuickHashIntSet::HASHER_JENKINS2</constant></term>
<listitem>
<para>Selects a variant hashing algorithm.</para>
</listitem>
</varlistentry>
</variablelist>
</section>
</section>
<!-- }}} -->
</partintro>
&reference.quickhash.entities.quickhashintset;
</phpdoc:classref>
<!-- 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:"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
-->

View file

@ -0,0 +1,112 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashintset.add" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashIntSet::add</refname>
<refpurpose>This method adds a new entry to the set.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>boolean</type><methodname>QuickHashIntSet::add</methodname>
<methodparam><type>integer</type><parameter>key</parameter></methodparam>
</methodsynopsis>
<para>
This method adds a new entry to the set, and returns whether the entry was
added. Entries are by default always added unless
QuickHashIntSet::CHECK_FOR_DUPES has been passed when the set was created.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>key</parameter></term>
<listitem>
<para>
The key of the entry to add.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&true; when the entry was added, and &false; if the entry was not added.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashIntSet::add</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
echo "without dupe checking\n";
$set = new QuickHashIntSet( 1024 );
var_dump( $set->exists( 4 ) );
var_dump( $set->add( 4 ) );
var_dump( $set->exists( 4 ) );
var_dump( $set->add( 4 ) );
echo "\nwith dupe checking\n";
$set = new QuickHashIntSet( 1024, QuickHashIntSet::CHECK_FOR_DUPES );
var_dump( $set->exists( 4 ) );
var_dump( $set->add( 4 ) );
var_dump( $set->exists( 4 ) );
var_dump( $set->add( 4 ) );
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
without dupe checking
bool(false)
bool(true)
bool(true)
bool(true)
with dupe checking
bool(false)
bool(true)
bool(true)
bool(false)
]]>
</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:"../../../../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
-->

View file

@ -0,0 +1,108 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashintset.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashIntSet::__construct</refname>
<refpurpose>Creates a new QuickHashIntSet object</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<methodname>QuickHashIntSet::__construct</methodname>
<methodparam><type>integer</type><parameter>size</parameter></methodparam>
<methodparam choice="opt"><type>integer</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<para>
This constructor creates a new QuickHashIntSet. The size is the amount of
bucket lists to create. The more lists there are, the less collisions you
will have. Options are also supported.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<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 options that you can pass in are: QuickHashIntSet::CHECK_FOR_DUPES,
which makes sure no duplicate entries are added to the set;
QuickHashIntSet::DO_NOT_USE_ZEND_ALLOC to not use PHP's internal memory
manager as well as one of QuickHashIntSet::HASHER_NO_HASH,
QuickHashIntSet::HASHER_JENKINS1 or QuickHashIntSet::HASHER_JENKINS2.
These last three configure which hashing algorithm to use. All options
can be combined using bitmasks.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a new QuickHashIntSet object.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashIntSet::__construct</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
var_dump( new QuickHashIntSet( 1024 ) );
var_dump( new QuickHashIntSet( 1024, QuickHashIntSet::CHECK_FOR_DUPES ) );
var_dump(
new QuickHashIntSet(
1024,
QuickHashIntSet::DO_NOT_USE_ZEND_ALLOC | QuickHashIntSet::HASHER_JENKINS2
)
);
?>
]]>
</programlisting>
</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:"../../../../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
-->

View file

@ -0,0 +1,97 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashintset.delete" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashIntSet::delete</refname>
<refpurpose>This method deletes an entry from the set.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>boolean</type><methodname>QuickHashIntSet::delete</methodname>
<methodparam><type>integer</type><parameter>key</parameter></methodparam>
</methodsynopsis>
<para>
This method deletes an entry from the set, and returns whether the entry was
deleted or not. Associated memory structures will not be freed immediately,
but rather when the set itself is freed.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>key</parameter></term>
<listitem>
<para>
The key of the entry to delete.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&true; when the entry was deleted, and &false; if the entry was not deleted.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashIntSet::delete</function> example</title>
<programlisting role="php">
<![CDATA[<?php
$set = new QuickHashIntSet( 1024 );
var_dump( $set->exists( 4 ) );
var_dump( $set->add( 4 ) );
var_dump( $set->delete( 4 ) );
var_dump( $set->exists( 4 ) );
var_dump( $set->delete( 4 ) );
?>]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
bool(false)
bool(true)
bool(true)
bool(false)
bool(false)
]]>
</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:"../../../../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
-->

View file

@ -0,0 +1,112 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashintset.exists" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashIntSet::exists</refname>
<refpurpose>This method checks whether a key is part of the set</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>boolean</type><methodname>QuickHashIntSet::exists</methodname>
<methodparam><type>integer</type><parameter>key</parameter></methodparam>
</methodsynopsis>
<para>
This method checks whether an entry with the provided key exists in the
set.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>key</parameter></term>
<listitem>
<para>
The key of the entry to check for whether it exists in the set.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns &true; when the entry was found, or &false; when the entry is not
found.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashIntSet::exists</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
//generate 200000 elements
$array = range( 0, 199999 );
$existingEntries = array_rand( array_flip( $array ), 180000 );
$testForEntries = array_rand( array_flip( $array ), 1000 );
$foundCount = 0;
echo "Creating set: ", microtime( true ), "\n";
$set = new QuickHashIntSet( 100000 );
echo "Adding elements: ", microtime( true ), "\n";
foreach( $existingEntries as $key )
{
$set->add( $key );
}
echo "Doing 1000 tests: ", microtime( true ), "\n";
foreach( $testForEntries as $key )
{
$foundCount += $set->exists( $key );
}
echo "Done, $foundCount found: ", microtime( true ), "\n";
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
Creating set: 1263588703.0748
Adding elements: 1263588703.0757
Doing 1000 tests: 1263588703.7851
Done, 898 found: 1263588703.7897
]]>
</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:"../../../../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
-->

View file

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashintset.getsize" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashIntSet::getSize</refname>
<refpurpose>Returns the number of elements in the set</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier><type>integer</type><methodname>QuickHashIntSet::getSize</methodname><void/>
</methodsynopsis>
<para>
Returns the number of elements in the set.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>key</parameter></term>
<listitem>
<para>
The key of the entry to add.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The number of elements in the set.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashIntSet::getSize</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$set = new QuickHashIntSet( 8 );
var_dump( $set->add( 2 ) );
var_dump( $set->add( 3 ) );
var_dump( $set->getSize() );
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
bool(true)
bool(true)
int(2)
]]>
</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:"../../../../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
-->

View file

@ -0,0 +1,128 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashintset.loadfromfile" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashIntSet::loadFromFile</refname>
<refpurpose>This factory method creates a set from a file</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <modifier>static</modifier> <type>QuickHashIntSet</type><methodname>QuickHashIntSet::loadFromFile</methodname>
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
<methodparam choice="opt"><type>integer</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<para>
This factory method creates a new set from a definition file on disk. 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>filename</parameter></term>
<listitem>
<para>
The filename of the file to read the set from.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>options</parameter></term>
<listitem>
<para>
The same options that the class' contructor 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
with a maximum limit of 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::loadFromFile</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$file = dirname( __FILE__ ) . "/simple.set";
$set = QuickHashIntSet::loadFromFile(
$file,
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:"../../../../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
-->

View file

@ -0,0 +1,128 @@
<?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>integer</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>options</parameter></term>
<listitem>
<para>
The same options that the class' contructor 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:"../../../../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
-->

View file

@ -0,0 +1,89 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashintset.savetofile" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashIntSet::saveToFile</refname>
<refpurpose>This method stores an in-memory set to disk.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>void</type><methodname>QuickHashIntSet::saveToFile</methodname>
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
</methodsynopsis>
<para>
This method stores an existing set to a file on disk, in the same format
that loadFromFile() can read.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>filename</parameter></term>
<listitem>
<para>
The filename of the file to store the hash in.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
This method doesn't return anything.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashIntSet::saveToFile</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$set = new QuickHashIntSet( 1024 );
var_dump( $set->exists( 4 ) );
var_dump( $set->add( 4 ) );
var_dump( $set->exists( 4 ) );
var_dump( $set->add( 4 ) );
$set->saveToFile( '/tmp/test.set' );
?>
]]>
</programlisting>
</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:"../../../../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
-->

View file

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashintset.savetostring" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashIntSet::saveToString</refname>
<refpurpose>This method returns a serialized version of the set.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>string</type><methodname>QuickHashIntSet::saveToString</methodname><void/>
</methodsynopsis>
<para>
This method returns a serialized version of the set in the same format that
loadFromString() can read.
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
This method returns a string containing a serialized format of the set.
Each element is stored as a four byte value in the Endianness that the
current system uses.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashIntSet::saveToString</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$set = new QuickHashIntSet( 1024 );
var_dump( $set->exists( 4 ) );
var_dump( $set->add( 4 ) );
var_dump( $set->exists( 4 ) );
var_dump( $set->add( 4 ) );
var_dump( $set->saveToString() );
?>
]]>
</programlisting>
</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:"../../../../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
-->

View file

@ -0,0 +1,160 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<phpdoc:classref xml:id="class.quickhashintstringhash" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>The QuickHashIntStringHash class</title>
<titleabbrev>QuickHashIntStringHash</titleabbrev>
<partintro>
<!-- {{{ QuickHashIntStringHash intro -->
<section xml:id="quickhashintstringhash.intro">
&reftitle.intro;
<para>
This class wraps around a hash containing integer numbers, where the
values are strings. Hashes are also available as implementation of the
ArrayAccess interface.
</para>
<para>
Hashes can also be iterated over with foreach as the Iterator interface is
implemented as well. The order of which elements are returned in is not
guaranteed.
</para>
</section>
<!-- }}} -->
<section xml:id="quickhashintstringhash.synopsis">
&reftitle.classsynopsis;
<!-- {{{ Synopsis -->
<classsynopsis>
<ooclass><classname>QuickHashIntStringHash</classname></ooclass>
<!-- {{{ Class synopsis -->
<classsynopsisinfo>
<ooclass>
<classname>QuickHashIntStringHash</classname>
</ooclass>
</classsynopsisinfo>
<!-- }}} -->
<classsynopsisinfo role="comment">Constants</classsynopsisinfo>
<fieldsynopsis>
<modifier>const</modifier>
<type>integer</type>
<varname linkend="quickhashintstringhash.constants.check-for-dupes">QuickHashIntStringHash::CHECK_FOR_DUPES</varname>
<initializer>1</initializer>
</fieldsynopsis>
<fieldsynopsis>
<modifier>const</modifier>
<type>integer</type>
<varname linkend="quickhashintstringhash.constants.do-not-use-zend-alloc">QuickHashIntStringHash::DO_NOT_USE_ZEND_ALLOC</varname>
<initializer>2</initializer>
</fieldsynopsis>
<fieldsynopsis>
<modifier>const</modifier>
<type>integer</type>
<varname linkend="quickhashintstringhash.constants.hasher-no-hash">QuickHashIntStringHash::HASHER_NO_HASH</varname>
<initializer>256</initializer>
</fieldsynopsis>
<fieldsynopsis>
<modifier>const</modifier>
<type>integer</type>
<varname linkend="quickhashintstringhash.constants.hasher-jenkins1">QuickHashIntStringHash::HASHER_JENKINS1</varname>
<initializer>512</initializer>
</fieldsynopsis>
<fieldsynopsis>
<modifier>const</modifier>
<type>integer</type>
<varname linkend="quickhashintstringhash.constants.hasher-jenkins2">QuickHashIntStringHash::HASHER_JENKINS2</varname>
<initializer>1024</initializer>
</fieldsynopsis>
<classsynopsisinfo role="comment">Methods</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.quickhashintstringhash')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
</classsynopsis>
<!-- }}} -->
</section>
<!-- {{{ QuickHashIntStringHash constants -->
<section xml:id="quickhashintstringhash.constants">
&reftitle.constants;
<section xml:id="quickhashintstringhash.constants.types">
<title>QuickHashIntStringHash Node Types</title>
<variablelist>
<varlistentry xml:id="quickhashintstringhash.constants.check-for-dupes">
<term><constant>QuickHashIntStringHash::CHECK_FOR_DUPES</constant></term>
<listitem>
<para>If enabled, adding duplicate elements to a set (through either add() or
loadFromFile()) will result in those elements to be dropped from the
set. This will take up extra time, so only used when it is required.</para>
</listitem>
</varlistentry>
<varlistentry xml:id="quickhashintstringhash.constants.do-not-use-zend-alloc">
<term><constant>QuickHashIntStringHash::DO_NOT_USE_ZEND_ALLOC</constant></term>
<listitem>
<para>Disables the use of PHP's internal memory manager for internal
set structures. With this option enabled, internal allocations will not
count towards the memory_limit settings.</para>
</listitem>
</varlistentry>
<varlistentry xml:id="quickhashintstringhash.constants.hasher-no-hash">
<term><constant>QuickHashIntStringHash::HASHER_NO_HASH</constant></term>
<listitem>
<para>Selects to not use a hashing function, but merely use a modulo to
find the bucket list index. This is not faster than normal hashing, and
gives more collisions.</para>
</listitem>
</varlistentry>
<varlistentry xml:id="quickhashintstringhash.constants.hasher-jenkins1">
<term><constant>QuickHashIntStringHash::HASHER_JENKINS1</constant></term>
<listitem>
<para>This is the default hashing function to turn the integer hashes
into bucket list indexes.</para>
</listitem>
</varlistentry>
<varlistentry xml:id="quickhashintstringhash.constants.hasher-jenkins2">
<term><constant>QuickHashIntStringHash::HASHER_JENKINS2</constant></term>
<listitem>
<para>Selects a variant hashing algorithm.</para>
</listitem>
</varlistentry>
</variablelist>
</section>
</section>
<!-- }}} -->
</partintro>
&reference.quickhash.entities.quickhashintstringhash;
</phpdoc:classref>
<!-- 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:"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
-->

View file

@ -0,0 +1,130 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashintstringhash.add" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashIntStringHash::add</refname>
<refpurpose>This method adds a new entry to the hash.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>boolean</type><methodname>QuickHashIntStringHash::add</methodname>
<methodparam><type>integer</type><parameter>key</parameter></methodparam>
<methodparam><type>string</type><parameter>value</parameter></methodparam>
</methodsynopsis>
<para>
This method adds a new entry to the hash, and returns whether the entry was
added. Entries are by default always added unless
QuickHashIntStringHash::CHECK_FOR_DUPES has been passed when the hash was created.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>key</parameter></term>
<listitem>
<para>
The key of the entry to add.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>value</parameter></term>
<listitem>
<para>
The value of the entry to add. If a non-string is passed, it will be
converted to a string automatically if possible.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&true; when the entry was added, and &false; if the entry was not added.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashIntStringHash::add</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
echo "without dupe checking\n";
$hash = new QuickHashIntStringHash( 1024 );
var_dump( $hash->exists( 4 ) );
var_dump( $hash->get( 4 ) );
var_dump( $hash->add( 4, "twenty two" ) );
var_dump( $hash->exists( 4 ) );
var_dump( $hash->get( 4 ) );
var_dump( $hash->add( 4, "twelve" ) );
echo "\nwith dupe checking\n";
$hash = new QuickHashIntStringHash( 1024, QuickHashIntStringHash::CHECK_FOR_DUPES );
var_dump( $hash->exists( 4 ) );
var_dump( $hash->get( 4 ) );
var_dump( $hash->add( 4, "seventy eight" ) );
var_dump( $hash->exists( 4 ) );
var_dump( $hash->get( 4 ) );
var_dump( $hash->add( 4, "nine" ) );
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
without dupe checking
bool(false)
bool(false)
bool(true)
bool(true)
string(10) "twenty two"
bool(true)
with dupe checking
bool(false)
bool(false)
bool(true)
bool(true)
string(13) "seventy eight"
bool(false)
]]>
</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:"../../../../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
-->

View file

@ -0,0 +1,108 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashintstringhash.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashIntStringHash::__construct</refname>
<refpurpose>Creates a new QuickHashIntStringHash object</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<methodname>QuickHashIntStringHash::__construct</methodname>
<methodparam><type>integer</type><parameter>size</parameter></methodparam>
<methodparam choice="opt"><type>integer</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<para>
This constructor creates a new QuickHashIntStringHash. The size is the amount of
bucket lists to create. The more lists there are, the less collisions you
will have. Options are also supported.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<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 64 to 4194304.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>options</parameter></term>
<listitem>
<para>
The options that you can pass in are: QuickHashIntStringHash::CHECK_FOR_DUPES,
which makes sure no duplicate entries are added to the hash;
QuickHashIntStringHash::DO_NOT_USE_ZEND_ALLOC to not use PHP's internal memory
manager as well as one of QuickHashIntStringHash::HASHER_NO_HASH,
QuickHashIntStringHash::HASHER_JENKINS1 or QuickHashIntStringHash::HASHER_JENKINS2.
These last three configure which hashing algorithm to use. All options
can be combined using bitmasks.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a new QuickHashIntStringHash object.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashIntStringHash::__construct</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
var_dump( new QuickHashIntStringHash( 1024 ) );
var_dump( new QuickHashIntStringHash( 1024, QuickHashIntStringHash::CHECK_FOR_DUPES ) );
var_dump(
new QuickHashIntStringHash(
1024,
QuickHashIntStringHash::DO_NOT_USE_ZEND_ALLOC | QuickHashIntStringHash::HASHER_JENKINS2
)
);
?>
]]>
</programlisting>
</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:"../../../../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
-->

View file

@ -0,0 +1,102 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashintstringhash.delete" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashIntStringHash::delete</refname>
<refpurpose>This method deletes am entry from the hash.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>boolean</type><methodname>QuickHashIntStringHash::delete</methodname>
<methodparam><type>integer</type><parameter>key</parameter></methodparam>
</methodsynopsis>
<para>
This method deletes an entry from the hash, and returns whether the entry was
deleted or not. Associated memory structures will not be freed immediately,
but rather when the hash itself is freed.
</para>
<para>
Elements can not be deleted when the hash is used in an iterator. The
method will not throw an exception, but simply return &false; like would
happen with any other deletion failure.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>key</parameter></term>
<listitem>
<para>
The key of the entry to delete.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&true; when the entry was deleted, and &false; if the entry was not deleted.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashIntStringHash::delete</function> example</title>
<programlisting role="php">
<![CDATA[<?php
$hash = new QuickHashIntStringHash( 1024 );
var_dump( $hash->exists( 4 ) );
var_dump( $hash->add( 4, "five" ) );
var_dump( $hash->delete( 4 ) );
var_dump( $hash->exists( 4 ) );
var_dump( $hash->delete( 4 ) );
?>]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
bool(false)
bool(true)
bool(true)
bool(false)
bool(false)
]]>
</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:"../../../../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
-->

View file

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashintstringhash.exists" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashIntStringHash::exists</refname>
<refpurpose>This method checks whether a key is part of the hash</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>boolean</type><methodname>QuickHashIntStringHash::exists</methodname>
<methodparam><type>integer</type><parameter>key</parameter></methodparam>
</methodsynopsis>
<para>
This method checks whether an entry with the provided key exists in the
hash.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>key</parameter></term>
<listitem>
<para>
The key of the entry to check for whether it exists in the hash.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns &true; when the entry was found, or &false; when the entry is not
found.
</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:"../../../../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
-->

View file

@ -0,0 +1,99 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashintstringhash.get" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashIntStringHash::get</refname>
<refpurpose>This method retrieves a value from the hash by its key.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>integer</type><methodname>QuickHashIntStringHash::get</methodname>
<methodparam><type>integer</type><parameter>key</parameter></methodparam>
</methodsynopsis>
<para>
This method retrieves a value from the hash by its key.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>key</parameter></term>
<listitem>
<para>
The key of the entry to add.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The value if the key exists, or &null; if the key wasn't part of the hash.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashIntStringHash::get</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$hash = new QuickHashIntStringHash( 8 );
var_dump( $hash->get( 1 ) );
var_dump( $hash->add( 2, "two" ) );
var_dump( $hash->get( 2 ) );
var_dump( $hash->add( 3, 5 ) );
var_dump( $hash->get( 3 ) );
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
bool(false)
bool(true)
string(3) "two"
bool(true)
string(1) "5"
]]>
</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:"../../../../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
-->

View file

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashintstringhash.getsize" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashIntStringHash::getSize</refname>
<refpurpose>Returns the number of elements in the hash</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>integer</type><methodname>QuickHashIntStringHash::getSize</methodname><void/>
</methodsynopsis>
<para>
Returns the number of elements in the hash.
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The number of elements in the hash.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashIntStringHash::getSize</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$hash = new QuickHashIntStringHash( 8 );
var_dump( $hash->add( 2, "two" ) );
var_dump( $hash->add( 3, 5 ) );
var_dump( $hash->getSize() );
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
bool(true)
bool(true)
int(2)
]]>
</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:"../../../../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
-->

View file

@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashintstringhash.loadfromfile" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashIntStringHash::loadFromFile</refname>
<refpurpose>This factory method creates a hash from a file</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <modifier>static</modifier> <type>QuickHashIntStringHash</type><methodname>QuickHashIntStringHash::loadFromFile</methodname>
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
<methodparam choice="opt"><type>integer</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<para>
This factory method creates a new hash from a definition file on disk. The
file format consists of a signature 'QH\0x12\0', the number of elements as
a 32 bit signed integer in system Endianness, an unsigned 32 bit integer
containing the number of element data to follow in characters. This element
data contains all the strings. After the header and the strings, the
elements follow in pairs of two unsigned 32 bit integers where the first
one is the key, and the second one the index in the the element data
string. An example could be:
</para>
<para>
<example>
<title>QuickHash IntString file format</title>
<screen><![CDATA[00000000 51 48 12 00 02 00 00 00 09 00 00 00 4f 4e 45 00 |QH..........ONE.|
00000010 4e 49 4e 45 00 01 00 00 00 00 00 00 00 03 00 00 |NINE............|
00000020 00 04 00 00 00 |.....|
00000025
]]></screen>
</example>
</para>
<para>
<example>
<title>QuickHash IntString file format</title>
<screen><![CDATA[
header signature ('QH'; key type: 1; value type: 2; filler: \0x00)
00000000 51 48 12 00
number of elements:
00000004 02 00 00 00
length of string values (9 characters):
00000008 09 00 00 00
string values:
0000000C 4f 4e 45 00 4e 49 4e 45 00
data string:
00000015 01 00 00 00 00 00 00 00 03 00 00 00 04 00 00 00
key/value 1 (key = 1, string index = 0 ("ONE")):
01 00 00 00 00 00 00 00
key/value 2 (key = 3, string index = 4 ("NINE")):
03 00 00 00 04 00 00 00
]]></screen>
</example>
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>filename</parameter></term>
<listitem>
<para>
The filename of the file to read the hash from.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>options</parameter></term>
<listitem>
<para>
The same options that the class' contructor takes; except that the size
option is ignored. It is automatically calculated to be the same as the
number of entries in the hash, rounded up to the nearest power of two
with a maximum limit of 4194304.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a new QuickHashIntStringHash.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashIntStringHash::loadFromFile</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$file = dirname( __FILE__ ) . "/simple.string.hash";
$hash = QuickHashIntStringHash::loadFromFile(
$file,
QuickHashIntStringHash::DO_NOT_USE_ZEND_ALLOC
);
foreach( range( 0, 0x0f ) as $key )
{
printf( "Key %3d (%2x) is %s\n",
$key, $key,
$hash->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:"../../../../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
-->

View file

@ -0,0 +1,127 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashintstringhash.loadfromstring" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashIntStringHash::loadFromString</refname>
<refpurpose>This factory method creates a hash from a string</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <modifier>static</modifier> <type>QuickHashIntStringHash</type><methodname>QuickHashIntStringHash::loadFromString</methodname>
<methodparam><type>string</type><parameter>contents</parameter></methodparam>
<methodparam choice="opt"><type>integer</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<para>
This factory method creates a new hash from a definition in a string. The
format is the same as the one used in "loadFromFile".
</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 hash.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>options</parameter></term>
<listitem>
<para>
The same options that the class' contructor takes; except that the size
option is ignored. It is automatically calculated to be the same as the
number of entries in the hash, rounded up to the nearest power of two
with a maximum limit of 4194304.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a new QuickHashIntStringHash.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashIntStringHash::loadFromString</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$contents = file_get_contents( dirname( __FILE__ ) . "/simple.hash" );
$hash = QuickHashIntStringHash::loadFromString(
$contents,
QuickHashIntStringHash::DO_NOT_USE_ZEND_ALLOC
);
foreach( range( 0, 0x0f ) as $key )
{
printf( "Key %3d (%2x) is %s\n",
$key, $key,
$hash->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:"../../../../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
-->

View file

@ -0,0 +1,89 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashintstringhash.savetofile" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashIntStringHash::saveToFile</refname>
<refpurpose>This method stores an in-memory hash to disk.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>void</type><methodname>QuickHashIntStringHash::saveToFile</methodname>
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
</methodsynopsis>
<para>
This method stores an existing hash to a file on disk, in the same format
that loadFromFile() can read.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>filename</parameter></term>
<listitem>
<para>
The filename of the file to store the hash in.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
This method doesn't return anything.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashIntStringHash::saveToFile</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$hash = new QuickHashIntStringHash( 1024 );
var_dump( $hash->exists( 4 ) );
var_dump( $hash->add( 4, "fourty three" ) );
var_dump( $hash->exists( 4 ) );
var_dump( $hash->add( 4, "fifty two" ) );
$hash->saveToFile( '/tmp/test.string.hash' );
?>
]]>
</programlisting>
</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:"../../../../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
-->

View file

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashintstringhash.savetostring" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashIntStringHash::saveToString</refname>
<refpurpose>This method returns a serialized version of the hash.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>string</type><methodname>QuickHashIntStringHash::saveToStringe</methodname><void/>
</methodsynopsis>
<para>
This method returns a serialized version of the hash in the same format that
loadFromString() can read.
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
This method returns a string containing a serialized format of the hash.
Each element is stored as a four byte value in the Endianness that the
current system uses.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashIntStringHash::saveToString</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$hash = new QuickHashIntStringHash( 1024 );
var_dump( $hash->exists( 4 ) );
var_dump( $hash->add( 4, "thirty four" ) );
var_dump( $hash->exists( 4 ) );
var_dump( $hash->add( 5, "fifty five" ) );
var_dump( $hash->saveToString() );
?>
]]>
</programlisting>
</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:"../../../../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
-->

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashintstringhash.set" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashIntStringHash::set</refname>
<refpurpose>This method updates an entry in the hash with a new value, or
adds a new one if the entry doesn't exist.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>boolean</type><methodname>QuickHashIntStringHash::set</methodname>
<methodparam><type>integer</type><parameter>key</parameter></methodparam>
<methodparam><type>string</type><parameter>value</parameter></methodparam>
</methodsynopsis>
<para>
This method tries to update an entry with a new value. In case the entry
did not yet exist, it will instead add a new entry. It returns whether the
entry was added or update. If there are duplicate keys, only the first
found element will get an updated value. Use
QuickHashIntStringHash::CHECK_FOR_DUPES during hash creation to prevent duplicate
keys from being part of the hash.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>key</parameter></term>
<listitem>
<para>
The key of the entry to add or update.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>value</parameter></term>
<listitem>
<para>
The value of the entry to add. If a non-string is passed, it will be
converted to a string automatically if possible.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
2 if the entry was found and updated, 1 if the entry was newly added or 0
if there was an error.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashIntStringHash::set</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$hash = new QuickHashIntStringHash( 1024 );
echo "Set->Add\n";
var_dump( $hash->get( 46692 ) );
var_dump( $hash->set( 46692, "sixteen thousand ninety one" ) );
var_dump( $hash->get( 46692 ) );
echo "Set->Update\n";
var_dump( $hash->set( 46692, "twenty nine thousand nine hundred six" ) );
var_dump( $hash->get( 46692 ) );
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
Set->Add
bool(false)
int(2)
string(27) "sixteen thousand ninety one"
Set->Update
int(1)
string(37) "twenty nine thousand nine hundred six"
]]>
</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:"../../../../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
-->

View file

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashintstringhash.update" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashIntStringHash::update</refname>
<refpurpose>This method updates an entry in the hash with a new value.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>boolean</type><methodname>QuickHashIntStringHash::update</methodname>
<methodparam><type>integer</type><parameter>key</parameter></methodparam>
<methodparam><type>string</type><parameter>value</parameter></methodparam>
</methodsynopsis>
<para>
This method updates an entry with a new value, and returns whether the entry was
update. If there are duplicate keys, only the first found element will get
an updated value. Use QuickHashIntStringHash::CHECK_FOR_DUPES during hash
creation to prevent duplicate keys from being part of the hash.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>key</parameter></term>
<listitem>
<para>
The key of the entry to add.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>value</parameter></term>
<listitem>
<para>
The new value for the entry. If a non-string is passed, it will be
converted to a string automatically if possible.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&true; when the entry was found and updated, and &false; if the entry was
not part of the hash already.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashIntStringHash::update</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$hash->add( 161803398, "--" );
$hash->add( 314159265, "a lot" );
echo $hash->get( 161803398 ), "\n";
echo $hash->get( 314159265 ), "\n";
var_dump( $hash->update( 314159265, "a lot plus one" ) );
var_dump( $hash->update( 314159999, "a lot plus one" ) );
echo $hash->get( 161803398 ), "\n";
echo $hash->get( 314159265 ), "\n";
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
--
a lot
bool(true)
bool(false)
--
a lot plus one
]]>
</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:"../../../../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
-->

View file

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<phpdoc:classref xml:id="class.quickhashstringinthash" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>The QuickHashStringIntHash class</title>
<titleabbrev>QuickHashStringIntHash</titleabbrev>
<partintro>
<!-- {{{ QuickHashStringIntHash intro -->
<section xml:id="quickhashstringinthash.intro">
&reftitle.intro;
<para>
This class wraps around a hash containing strings, where the
values are integer numbers. Hashes are also available as
implementation of the ArrayAccess interface.
</para>
<para>
Hashes can also be iterated over with foreach as the Iterator interface is
implemented as well. The order of which elements are returned in is not
guaranteed.
</para>
</section>
<!-- }}} -->
<section xml:id="quickhashstringinthash.synopsis">
&reftitle.classsynopsis;
<!-- {{{ Synopsis -->
<classsynopsis>
<ooclass><classname>QuickHashStringIntHash</classname></ooclass>
<!-- {{{ Class synopsis -->
<classsynopsisinfo>
<ooclass>
<classname>QuickHashStringIntHash</classname>
</ooclass>
</classsynopsisinfo>
<!-- }}} -->
<classsynopsisinfo role="comment">Constants</classsynopsisinfo>
<fieldsynopsis>
<modifier>const</modifier>
<type>integer</type>
<varname linkend="quickhashstringinthash.constants.check-for-dupes">QuickHashStringIntHash::CHECK_FOR_DUPES</varname>
<initializer>1</initializer>
</fieldsynopsis>
<fieldsynopsis>
<modifier>const</modifier>
<type>integer</type>
<varname linkend="quickhashstringinthash.constants.do-not-use-zend-alloc">QuickHashStringIntHash::DO_NOT_USE_ZEND_ALLOC</varname>
<initializer>2</initializer>
</fieldsynopsis>
<classsynopsisinfo role="comment">Methods</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.quickhashstringinthash')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
</classsynopsis>
<!-- }}} -->
</section>
<!-- {{{ QuickHashStringIntHash constants -->
<section xml:id="quickhashstringinthash.constants">
&reftitle.constants;
<section xml:id="quickhashstringinthash.constants.types">
<title>QuickHashStringIntHash Node Types</title>
<variablelist>
<varlistentry xml:id="quickhashstringinthash.constants.check-for-dupes">
<term><constant>QuickHashStringIntHash::CHECK_FOR_DUPES</constant></term>
<listitem>
<para>If enabled, adding duplicate elements to a set (through either add() or
loadFromFile()) will result in those elements to be dropped from the
set. This will take up extra time, so only used when it is required.</para>
</listitem>
</varlistentry>
<varlistentry xml:id="quickhashstringinthash.constants.do-not-use-zend-alloc">
<term><constant>QuickHashStringIntHash::DO_NOT_USE_ZEND_ALLOC</constant></term>
<listitem>
<para>Disables the use of PHP's internal memory manager for internal
set structures. With this option enabled, internal allocations will not
count towards the memory_limit settings.</para>
</listitem>
</varlistentry>
</variablelist>
</section>
</section>
<!-- }}} -->
</partintro>
&reference.quickhash.entities.quickhashstringinthash;
</phpdoc:classref>
<!-- 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:"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
-->

View file

@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashstringinthash.add" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashStringIntHash::add</refname>
<refpurpose>This method adds a new entry to the hash.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>boolean</type><methodname>QuickHashStringIntHash::add</methodname>
<methodparam><type>string</type><parameter>key</parameter></methodparam>
<methodparam><type>int</type><parameter>value</parameter></methodparam>
</methodsynopsis>
<para>
This method adds a new entry to the hash, and returns whether the entry was
added. Entries are by default always added unless
QuickHashStringIntHash::CHECK_FOR_DUPES has been passed when the hash was created.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>key</parameter></term>
<listitem>
<para>
The key of the entry to add.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>value</parameter></term>
<listitem>
<para>
The value of the entry to add.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&true; when the entry was added, and &false; if the entry was not added.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashStringIntHash::add</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
echo "without dupe checking\n";
$hash = new QuickHashStringIntHash( 1024 );
var_dump( $hash );
var_dump( $hash->exists( "four" ) );
var_dump( $hash->get( "four" ) );
var_dump( $hash->add( "four", 22 ) );
var_dump( $hash->exists( "four" ) );
var_dump( $hash->get( "four" ) );
var_dump( $hash->add( "four", 12 ) );
echo "\nwith dupe checking\n";
$hash = new QuickHashStringIntHash( 1024, QuickHashStringIntHash::CHECK_FOR_DUPES );
var_dump( $hash );
var_dump( $hash->exists( "four" ) );
var_dump( $hash->get( "four" ) );
var_dump( $hash->add( "four", 78 ) );
var_dump( $hash->exists( "four" ) );
var_dump( $hash->get( "four" ) );
var_dump( $hash->add( "four", 9 ) );
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
without dupe checking
object(QuickHashStringIntHash)#1 (0) {
}
bool(false)
bool(false)
bool(true)
bool(true)
int(22)
bool(true)
with dupe checking
object(QuickHashStringIntHash)#2 (0) {
}
bool(false)
bool(false)
bool(true)
bool(true)
int(78)
bool(false)
]]>
</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:"../../../../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
-->

View file

@ -0,0 +1,100 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashstringinthash.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashStringIntHash::__construct</refname>
<refpurpose>Creates a new QuickHashStringIntHash object</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<methodname>QuickHashStringIntHash::__construct</methodname>
<methodparam><type>integer</type><parameter>size</parameter></methodparam>
<methodparam choice="opt"><type>integer</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<para>
This constructor creates a new QuickHashStringIntHash. The size is the amount of
bucket lists to create. The more lists there are, the less collisions you
will have. Options are also supported.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<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 64 to 4194304.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>options</parameter></term>
<listitem>
<para>
The options that you can pass in are:
QuickHashStringIntHash::CHECK_FOR_DUPES, which makes sure no duplicate
entries are added to the hash and
QuickHashStringIntHash::DO_NOT_USE_ZEND_ALLOC to not use PHP's internal
memory manager.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a new QuickHashStringIntHash object.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashStringIntHash::__construct</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
var_dump( new QuickHashStringIntHash( 1024 ) );
var_dump( new QuickHashStringIntHash( 1024, QuickHashStringIntHash::CHECK_FOR_DUPES ) );
?>
]]>
</programlisting>
</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:"../../../../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
-->

View file

@ -0,0 +1,106 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashstringinthash.delete" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashStringIntHash::delete</refname>
<refpurpose>This method deletes am entry from the hash.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>boolean</type><methodname>QuickHashStringIntHash::delete</methodname>
<methodparam><type>string</type><parameter>key</parameter></methodparam>
</methodsynopsis>
<para>
This method deletes an entry from the hash, and returns whether the entry was
deleted or not. Associated memory structures will not be freed immediately,
but rather when the hash itself is freed.
</para>
<para>
Elements can not be deleted when the hash is used in an iterator. The
method will not throw an exception, but simply return &false; like would
happen with any other deletion failure.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>key</parameter></term>
<listitem>
<para>
The key of the entry to delete.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&true; when the entry was deleted, and &false; if the entry was not deleted.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashStringIntHash::delete</function> example</title>
<programlisting role="php">
<![CDATA[<?php
$hash = new QuickHashStringIntHash( 1024 );
var_dump( $hash->exists( 'four' ) );
var_dump( $hash->add( 'four', 5 ) );
var_dump( $hash->get( 'four' ) );
var_dump( $hash->delete( 'four' ) );
var_dump( $hash->exists( 'four' ) );
var_dump( $hash->get( 'four' ) );
var_dump( $hash->delete( 'four' ) );
?>]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
bool(false)
bool(true)
int(5)
bool(true)
bool(false)
bool(false)
bool(false)
]]>
</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:"../../../../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
-->

View file

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashstringinthash.exists" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashStringIntHash::exists</refname>
<refpurpose>This method checks whether a key is part of the hash</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>boolean</type><methodname>QuickHashStringIntHash::exists</methodname>
<methodparam><type>string</type><parameter>key</parameter></methodparam>
</methodsynopsis>
<para>
This method checks whether an entry with the provided key exists in the
hash.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>key</parameter></term>
<listitem>
<para>
The key of the entry to check for whether it exists in the hash.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns &true; when the entry was found, or &false; when the entry is not
found.
</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:"../../../../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
-->

View file

@ -0,0 +1,94 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashstringinthash.get" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashStringIntHash::get</refname>
<refpurpose>This method retrieves a value from the hash by its key.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>integer</type><methodname>QuickHashStringIntHash::get</methodname>
<methodparam><type>string</type><parameter>key</parameter></methodparam>
</methodsynopsis>
<para>
This method retrieves a value from the hash by its key.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>key</parameter></term>
<listitem>
<para>
The key of the entry to add.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The value if the key exists, or &null; if the key wasn't part of the hash.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashStringIntHash::get</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$hash = new QuickHashStringIntHash( 8 );
var_dump( $hash->get( "one" ) );
var_dump( $hash->add( "two", 2 ) );
var_dump( $hash->get( "two" ) );
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
bool(false)
bool(true)
int(2)
]]>
</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:"../../../../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
-->

View file

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashstringinthash.getsize" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashStringIntHash::getSize</refname>
<refpurpose>Returns the number of elements in the hash</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>integer</type><methodname>QuickHashStringIntHash::getSize</methodname><void/>
</methodsynopsis>
<para>
Returns the number of elements in the hash.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>key</parameter></term>
<listitem>
<para>
The key of the entry to add.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
The number of elements in the hash.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashStringIntHash::getSize</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$hash = new QuickHashStringIntHash( 8 );
var_dump( $hash->add( "two", 2 ) );
var_dump( $hash->add( "three", 5 ) );
var_dump( $hash->getSize() );
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
bool(true)
bool(true)
int(2)
]]>
</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:"../../../../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
-->

View file

@ -0,0 +1,181 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashstringinthash.loadfromfile" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashStringIntHash::loadFromFile</refname>
<refpurpose>This factory method creates a hash from a file</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <modifier>static</modifier> <type>QuickHashStringIntHash</type><methodname>QuickHashStringIntHash::loadFromFile</methodname>
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
<methodparam choice="opt"><type>integer</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<para>
This factory method creates a new hash from a definition file on disk. The
file format consists of a signature 'QH\0x21\0', the number of elements as
a 32 bit signed integer in system Endianness, an unsigned 32 bit integer
containing the number of element data to follow in characters. This element
data contains all the strings. The follows another signed 32 bit integer
containing the number of bucket lists. After the header and the strings,
the elements follow. They are ordered by bucket list so that the keys don't
have to be hashed in order to restore the hash. For each bucket list, the
following information is stored (all as 32 bit integers): the bucket list
index, the number of elements in that list, and then in pairs of two
unsigned 32 bit integers the elements, where the first one is the index
into the string list containing the keys, and the second one the value. An
example could be:
</para>
<para>
<example>
<title>QuickHash StringIntHash file format</title>
<screen><![CDATA[<![CDATA[00000000 51 48 21 00 02 00 00 00 09 00 00 00 40 00 00 00 |QH!.........@...|
00000010 4f 4e 45 00 4e 49 4e 45 00 07 00 00 00 01 00 00 |ONE.NINE........|
00000020 00 00 00 00 00 01 00 00 00 2f 00 00 00 01 00 00 |........./......|
00000030 00 04 00 00 00 03 00 00 00 |.........|
00000039]]></screen>
</example>
</para>
<para>
<example>
<title>QuickHash IntHash file format</title>
<screen><![CDATA[header signature ('QH'; key type: 2; value type: 1; filler: \0x00)
00000000 51 48 21 00
number of elements:
00000004 02 00 00 00
length of string values (9 characters):
00000008 09 00 00 00
number of hash bucket lists (this is configured for hashes as argument to the
constructor normally, 64 in this case):
0000000C 40 00 00 00
string values:
00000010 4f 4e 45 00 4e 49 4e 45 00
bucket lists:
bucket list 1 (with key 7, and 1 element):
header:
07 00 00 00 01 00 00 00
elements (key index: 0 ('ONE'), value = 0):
00 00 00 00 01 00 00 00
bucket list 2 (with key 0x2f, and 1 element):
header:
2f 00 00 00 01 00 00 00
elements (key index: 4 ('NINE'), value = 3):
04 00 00 00 03 00 00 00
]]></screen>
</example>
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>filename</parameter></term>
<listitem>
<para>
The filename of the file to read the hash from.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>options</parameter></term>
<listitem>
<para>
The same options that the class' contructor takes; except that the size
option is ignored. It is read from the file format (unlike the
QuickHashIntHash and QuickhashIntStringHash classes, where it is
automatically calculated from the number of entries in the hash.)
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a new QuickHashStringIntHash.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashStringIntHash::loadFromFile</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$file = dirname( __FILE__ ) . "/simple.hash.string";
$hash = QuickHashStringIntHash::loadFromFile(
$file,
QuickHashStringIntHash::DO_NOT_USE_ZEND_ALLOC
);
foreach( range( 0, 0x0f ) as $key )
{
$i = 48712 + $key * 1631;
$k = base_convert( $i, 10, 36 );
echo $k, ' => ', $hash->get( $k ), "\n";
}
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
11l4 => 48712
12uf => 50343
143q => 51974
15d1 => 53605
16mc => 55236
17vn => 56867
194y => 58498
1ae9 => 60129
1bnk => 61760
1cwv => 63391
1e66 => 65022
1ffh => 66653
1gos => 68284
1hy3 => 69915
1j7e => 71546
1kgp => 73177
]]>
</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:"../../../../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
-->

View file

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashstringinthash.loadfromstring" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashStringIntHash::loadFromString</refname>
<refpurpose>This factory method creates a hash from a string</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <modifier>static</modifier> <type>QuickHashStringIntHash</type><methodname>QuickHashStringIntHash::loadFromString</methodname>
<methodparam><type>string</type><parameter>contents</parameter></methodparam>
<methodparam choice="opt"><type>integer</type><parameter>options</parameter></methodparam>
</methodsynopsis>
<para>
This factory method creates a new hash from a definition in a string. The
format is the same as the one used in "loadFromFile".
</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 hash.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>options</parameter></term>
<listitem>
<para>
The same options that the class' contructor takes; except that the size
option is ignored. It is automatically calculated to be the same as the
number of entries in the hash, rounded up to the nearest power of two
with a maximum limit of 4194304.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a new QuickHashStringIntHash.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashStringIntHash::loadFromString</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$contents = file_get_contents( dirname( __FILE__ ) . "/simple.hash.string" );
$hash = QuickHashStringIntHash::loadFromString(
$contents,
QuickHashStringIntHash::DO_NOT_USE_ZEND_ALLOC
);
foreach( range( 0, 0x0f ) as $key )
{
$i = 48712 + $key * 1631;
$k = base_convert( $i, 10, 36 );
echo $k, ' => ', $hash->get( $k ), "\n";
}
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
11l4 => 48712
12uf => 50343
143q => 51974
15d1 => 53605
16mc => 55236
17vn => 56867
194y => 58498
1ae9 => 60129
1bnk => 61760
1cwv => 63391
1e66 => 65022
1ffh => 66653
1gos => 68284
1hy3 => 69915
1j7e => 71546
1kgp => 73177
]]>
</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:"../../../../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
-->

View file

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashstringinthash.savetofile" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashStringIntHash::saveToFile</refname>
<refpurpose>This method stores an in-memory hash to disk.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>void</type><methodname>QuickHashStringIntHash::saveToFile</methodname>
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
</methodsynopsis>
<para>
This method stores an existing hash to a file on disk, in the same format
that loadFromFile() can read.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>filename</parameter></term>
<listitem>
<para>
The filename of the file to store the hash in.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
This method doesn't return anything.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashStringIntHash::saveToFile</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$hash = new QuickHashStringIntHash( 1024 );
var_dump( $hash->add( "fourty three", 42 ) );
var_dump( $hash->add( "fifty two", 52 ) );
$hash->saveToFile( '/tmp/test.hash.string' );
?>
]]>
</programlisting>
</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:"../../../../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
-->

View file

@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashstringinthash.savetostring" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashStringIntHash::saveToString</refname>
<refpurpose>This method returns a serialized version of the hash.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>string</type><methodname>QuickHashStringIntHash::saveToString</methodname><void/>
</methodsynopsis>
<para>
This method returns a serialized version of the hash in the same format that
loadFromString() can read.
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
This method returns a serialized format of an existing hash, in the same format
that loadFromString() can read.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashStringIntHash::saveToString</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$hash = new QuickHashStringIntHash( 1024 );
var_dump( $hash->add( "fourty three", 42 ) );
var_dump( $hash->add( "fifty two", 52 ) );
var_dump( $hash->saveToString() );
?>
]]>
</programlisting>
</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:"../../../../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
-->

View file

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashstringinthash.set" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashStringIntHash::set</refname>
<refpurpose>This method updates an entry in the hash with a new value, or
adds a new one if the entry doesn't exist.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>boolean</type><methodname>QuickHashStringIntHash::set</methodname>
<methodparam><type>string</type><parameter>key</parameter></methodparam>
<methodparam><type>int</type><parameter>value</parameter></methodparam>
</methodsynopsis>
<para>
This method tries to update an entry with a new value. In case the entry
did not yet exist, it will instead add a new entry. It returns whether the
entry was added or update. If there are duplicate keys, only the first
found element will get an updated value. Use
QuickHashStringIntHash::CHECK_FOR_DUPES during hash creation to prevent duplicate
keys from being part of the hash.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>key</parameter></term>
<listitem>
<para>
The key of the entry to add or update.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>value</parameter></term>
<listitem>
<para>
The value of the entry to add. If a non-string is passed, it will be
converted to a string automatically if possible.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
2 if the entry was found and updated, 1 if the entry was newly added or 0
if there was an error.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashStringIntHash::set</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$hash = new QuickHashStringIntHash( 1024 );
echo "Set->Add\n";
var_dump( $hash->get( "fourty six thousand six hundred ninety two" ) );
var_dump( $hash->set( "fourty six thousand six hundred ninety two", 16091 ) );
var_dump( $hash->get( "fourty six thousand six hundred ninety two" ) );
echo "Set->Update\n";
var_dump( $hash->set( "fourty six thousand six hundred ninety two", 29906 ) );
var_dump( $hash->get( "fourty six thousand six hundred ninety two" ) );
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
Set->Add
bool(false)
int(2)
int(16091)
Set->Update
int(1)
int(29906)
]]>
</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:"../../../../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
-->

View file

@ -0,0 +1,119 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<refentry xml:id="quickhashstringinthash.update" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>QuickHashStringIntHash::update</refname>
<refpurpose>This method updates an entry in the hash with a new value.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>boolean</type><methodname>QuickHashStringIntHash::update</methodname>
<methodparam><type>string</type><parameter>key</parameter></methodparam>
<methodparam><type>integer</type><parameter>value</parameter></methodparam>
</methodsynopsis>
<para>
This method updates an entry with a new value, and returns whether the entry was
update. If there are duplicate keys, only the first found element will get
an updated value. Use QuickHashStringIntHash::CHECK_FOR_DUPES during hash
creation to prevent duplicate keys from being part of the hash.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>key</parameter></term>
<listitem>
<para>
The key of the entry to add.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>value</parameter></term>
<listitem>
<para>
The new value for the entry. If a non-string is passed, it will be
converted to a string automatically if possible.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&true; when the entry was found and updated, and &false; if the entry was
not part of the hash already.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>QuickHashStringIntHash::update</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$hash = new QuickHashStringIntHash( 1024 );
$hash->add( 'six', 314159265 );
$hash->add( "a lot", 314159265 );
echo $hash->get( 'six' ), "\n";
echo $hash->get( 'a lot' ), "\n";
var_dump( $hash->update( 'a lot', 314159266 ) );
var_dump( $hash->update( "a lot plus one", 314159999 ) );
echo $hash->get( 'six' ), "\n";
echo $hash->get( 'a lot' ), "\n";
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
314159265
314159265
bool(true)
bool(false)
314159265
314159266
]]>
</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:"../../../../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
-->

View file

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<reference xml:id="ref.quickhash" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Quickhash &Functions;</title>
&reference.quickhash.entities.functions;
</reference>
<!-- 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:"../../../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
-->

View file

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: $ -->
<chapter xml:id="quickhash.setup" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
&reftitle.setup;
<section xml:id="quickhash.requirements">
&reftitle.required;
<para>
This extension requires no additional libraries.
</para>
</section>
<section xml:id="quickhash.installation">
&reftitle.install;
<para>
&pecl.info;
<link xlink:href="&url.pecl.package;quickhash">&url.pecl.package;quickhash</link>
</para>
</section>
<section xml:id="quickhash.configuration">
&reftitle.runtime;
&no.config;
</section>
</chapter>
<!-- 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:"../../../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
-->

View file

@ -0,0 +1,63 @@
<?xml version='1.0' encoding='utf-8'?>
<!-- $Revision: $ -->
<!--
Do NOT translate this file
-->
<versions>
<!-- Methods -->
<function name='quickhashintset::__construct' from='PECL quickhash &gt;= Unknown'/>
<function name='quickhashintset::add' from='PECL quickhash &gt;= Unknown'/>
<function name='quickhashintset::exists' from='PECL quickhash &gt;= Unknown'/>
<function name='quickhashintset::delete' from='PECL quickhash &gt;= Unknown'/>
<function name='quickhashintset::getsize' from='PECL quickhash &gt;= Unknown'/>
<function name='quickhashintset::loadfromfile' from='PECL quickhash &gt;= Unknown'/>
<function name='quickhashintset::loadfromstring' from='PECL quickhash &gt;= Unknown'/>
<function name='quickhashintset::savetofile' from='PECL quickhash &gt;= Unknown'/>
<function name='quickhashintset::savetostring' from='PECL quickhash &gt;= Unknown'/>
<function name='quickhashinthash::__construct' from='PECL quickhash &gt;= Unknown'/>
<function name='quickhashinthash::add' from='PECL quickhash &gt;= Unknown'/>
<function name='quickhashinthash::exists' from='PECL quickhash &gt;= Unknown'/>
<function name='quickhashinthash::get' from='PECL quickhash &gt;= Unknown'/>
<function name='quickhashinthash::set' from='PECL quickhash &gt;= Unknown'/>
<function name='quickhashinthash::update' from='PECL quickhash &gt;= Unknown'/>
<function name='quickhashinthash::delete' from='PECL quickhash &gt;= Unknown'/>
<function name='quickhashinthash::getsize' from='PECL quickhash &gt;= Unknown'/>
<function name='quickhashinthash::loadfromfile' from='PECL quickhash &gt;= Unknown'/>
<function name='quickhashinthash::loadfromstring' from='PECL quickhash &gt;= Unknown'/>
<function name='quickhashinthash::savetofile' from='PECL quickhash &gt;= Unknown'/>
<function name='quickhashinthash::savetostring' from='PECL quickhash &gt;= Unknown'/>
<function name='quickhashintstringhash::__construct' from='PECL quickhash &gt;= Unknown'/>
<function name='quickhashintstringhash::add' from='PECL quickhash &gt;= Unknown'/>
<function name='quickhashintstringhash::exists' from='PECL quickhash &gt;= Unknown'/>
<function name='quickhashintstringhash::get' from='PECL quickhash &gt;= Unknown'/>
<function name='quickhashintstringhash::set' from='PECL quickhash &gt;= Unknown'/>
<function name='quickhashintstringhash::update' from='PECL quickhash &gt;= Unknown'/>
<function name='quickhashintstringhash::delete' from='PECL quickhash &gt;= Unknown'/>
<function name='quickhashintstringhash::getsize' from='PECL quickhash &gt;= Unknown'/>
<function name='quickhashintstringhash::loadfromfile' from='PECL quickhash &gt;= Unknown'/>
<function name='quickhashintstringhash::loadfromstring' from='PECL quickhash &gt;= Unknown'/>
<function name='quickhashintstringhash::savetofile' from='PECL quickhash &gt;= Unknown'/>
<function name='quickhashintstringhash::savetostring' from='PECL quickhash &gt;= Unknown'/>
</versions>
<!-- 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:"../../../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
-->