<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.quickhashintstringhash.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'fr',
  ),
  'this' => 
  array (
    0 => 'quickhashintstringhash.loadfromfile.php',
    1 => 'QuickHashIntStringHash::loadFromFile',
    2 => 'Cette m&eacute;thode d\'usine cr&eacute;e un hachage &agrave; partir d\'un fichier',
  ),
  'up' => 
  array (
    0 => 'class.quickhashintstringhash.php',
    1 => 'QuickHashIntStringHash',
  ),
  'prev' => 
  array (
    0 => 'quickhashintstringhash.getsize.php',
    1 => 'QuickHashIntStringHash::getSize',
  ),
  'next' => 
  array (
    0 => 'quickhashintstringhash.loadfromstring.php',
    1 => 'QuickHashIntStringHash::loadFromString',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    'path' => 'reference/quickhash/quickhashintstringhash/loadfromfile.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="quickhashintstringhash.loadfromfile" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">QuickHashIntStringHash::loadFromFile</h1>
  <p class="verinfo">(PECL quickhash &gt;= Unknown)</p><p class="refpurpose"><span class="refname">QuickHashIntStringHash::loadFromFile</span> &mdash; <span class="dc-title">Cette méthode d&#039;usine crée un hachage à partir d&#039;un fichier</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-quickhashintstringhash.loadfromfile-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="modifier">static</span> <span class="methodname"><strong>QuickHashIntStringHash::loadFromFile</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$filename</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$size</code><span class="initializer"> = 0</span></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$options</code><span class="initializer"> = 0</span></span>): <span class="type"><a href="class.quickhashintstringhash.php" class="type QuickHashIntStringHash">QuickHashIntStringHash</a></span></div>

  <p class="simpara">
   Cette méthode d&#039;usine crée un nouveau hachage à partir d&#039;un fichier de définition sur le disque. Le
   format du fichier consiste en une signature <code class="literal">&#039;QH\0x12\0&#039;</code>, le nombre d&#039;éléments en tant
   qu&#039;entier signé 32 bits en Endianness du système, un entier non signé 32 bits
   contenant le nombre de données d&#039;éléments à suivre en caractères. Ces données
   d&#039;éléments contiennent toutes les chaînes. Après l&#039;en-tête et les chaînes, les
   éléments suivent par paires de deux entiers non signés 32 bits où le premier
   est la clé, et le second l&#039;index dans la chaîne de données d&#039;éléments.
   Un exemple pourrait être :
  </p>
  <div class="example" id="example-1">
   <p><strong>Exemple #1 Format de fichier QuickHash IntString</strong></p>
   <div class="example-contents screen"><div class="descriptioncode"><pre class="descriptioncode">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</pre>
</div></div>
  </div>
  <div class="example" id="example-2">
   <p><strong>Exemple #2 Format de fichier QuickHash IntString</strong></p>
   <div class="example-contents screen"><div class="descriptioncode"><pre class="descriptioncode">header signature (&#039;QH&#039;; 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 (&quot;ONE&quot;)):
01 00 00 00  00 00 00 00

key/value 2 (key = 3, string index = 4 (&quot;NINE&quot;)):
03 00 00 00  04 00 00 00</pre>
</div></div>
  </div>
 </div>


 <div class="refsect1 parameters" id="refsect1-quickhashintstringhash.loadfromfile-parameters">
  <h3 class="title">Liste de paramètres</h3>
  <dl>
   
    <dt><code class="parameter">filename</code></dt>
    <dd>
     <span class="simpara">
      Le nom du fichier à partir duquel lire le hachage.
     </span>
    </dd>
   
   
    <dt><code class="parameter">size</code></dt>
    <dd>
     <span class="simpara">
      La quantité de listes de seaux à configurer. Le nombre que l&#039;on passe sera
      automatiquement arrondi à la puissance de deux suivante. Il est également
      automatiquement limité de <code class="literal">4</code> à <code class="literal">4194304</code>.
     </span>
    </dd>
   
   
    <dt><code class="parameter">options</code></dt>
    <dd>
     <span class="simpara">
      Les mêmes options que le constructeur de la classe ; sauf que l&#039;option
      size est ignorée. Elle est automatiquement calculée pour être la même que
      le nombre d&#039;entrées dans le hachage, arrondie à la puissance de deux la plus proche
      avec une limite maximale de <code class="literal">4194304</code>.
     </span>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-quickhashintstringhash.loadfromfile-returnvalues">
  <h3 class="title">Valeurs de retour</h3>
  <p class="simpara">
   Renvoie un nouveau <span class="classname"><a href="class.quickhashintstringhash.php" class="classname">QuickHashIntStringHash</a></span>.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-quickhashintstringhash.loadfromfile-examples">
  <h3 class="title">Exemples</h3>
  <div class="example" id="example-3">
   <p><strong>Exemple #3 Exemple de <span class="function"><strong>QuickHashIntStringHash::loadFromFile()</strong></span></strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$file </span><span style="color: #007700">= </span><span style="color: #0000BB">dirname</span><span style="color: #007700">( </span><span style="color: #0000BB">__FILE__ </span><span style="color: #007700">) . </span><span style="color: #DD0000">"/simple.string.hash"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$hash </span><span style="color: #007700">= </span><span style="color: #0000BB">QuickHashIntStringHash</span><span style="color: #007700">::</span><span style="color: #0000BB">loadFromFile</span><span style="color: #007700">(<br />    </span><span style="color: #0000BB">$file</span><span style="color: #007700">,<br />    </span><span style="color: #0000BB">QuickHashIntStringHash</span><span style="color: #007700">::</span><span style="color: #0000BB">DO_NOT_USE_ZEND_ALLOC<br /></span><span style="color: #007700">);<br />foreach( </span><span style="color: #0000BB">range</span><span style="color: #007700">( </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">0x0f </span><span style="color: #007700">) as </span><span style="color: #0000BB">$key </span><span style="color: #007700">)<br />{<br />    </span><span style="color: #0000BB">printf</span><span style="color: #007700">( </span><span style="color: #DD0000">"Key %3d (%2x) is %s\n"</span><span style="color: #007700">,<br />        </span><span style="color: #0000BB">$key</span><span style="color: #007700">, </span><span style="color: #0000BB">$key</span><span style="color: #007700">,<br />        </span><span style="color: #0000BB">$hash</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">exists</span><span style="color: #007700">( </span><span style="color: #0000BB">$key </span><span style="color: #007700">) ? </span><span style="color: #DD0000">'set' </span><span style="color: #007700">: </span><span style="color: #DD0000">'unset'<br />    </span><span style="color: #007700">);<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <div class="example-contents"><p>Résultat de l&#039;exemple ci-dessus est similaire à :</p></div>
   <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">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</pre>
</div>
   </div>
  </div>
 </div>



</div><?php manual_footer($setup); ?>