Files
2024-08-27 12:53:26 +01:00

136 lines
3.4 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: 95a1b13144581b79cbebe041abed61d43430d902 Maintainer: Fan2Shrek Status: ready -->
<!-- Reviewed: yes -->
<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>Cette méthode ajoute une nouvelle entrée au hachage</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>bool</type><methodname>QuickHashStringIntHash::add</methodname>
<methodparam><type>string</type><parameter>key</parameter></methodparam>
<methodparam><type>int</type><parameter>value</parameter></methodparam>
</methodsynopsis>
<para>
Cette méthode ajoute une nouvelle entrée au hachage, et retourne si l'entrée
a été ajoutée. Les entrées sont par défaut toujours ajoutées sauf si
<constant>QuickHashStringIntHash::CHECK_FOR_DUPES</constant> a été passé lors de la création du hachage.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>key</parameter></term>
<listitem>
<para>
La clé de l'entrée à ajouter.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>value</parameter></term>
<listitem>
<para>
La valeur de l'entrée à ajouter.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&true; lorsque l'entrée a été ajoutée, et &false; si l'entrée n'a pas été ajoutée.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Exemple de <function>QuickHashStringIntHash::add</function></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:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->