Changeset 6953

Show
Ignore:
Timestamp:
08/29/07 22:16:34 (1 year ago)
Author:
nicobn
Message:

More work on the Registry documentation

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • doc/jaws2/en/books/internals/coress/sections/registry/normalkeys.xml

    r6944 r6953  
    143143 <sect4> 
    144144  <title>Access a subkey</title> 
     145  <para> 
     146   There exists two methods to access a key. You can either get it directly get 
     147   it from its parent or get as an object property through magic methods. 
     148  </para> 
     149   
     150  <sect5> 
     151   <title>Parent key subkeys access</title> 
     152   <para> 
     153    To access a subkey with its parent's object, you have to use the following  
     154    method. 
     155   </para> 
     156    
     157   <para> 
     158    <methodsynopsis> 
     159     <classname>Jaws_Registry_Key</classname><methodname>Jaws::getSubkey</methodname> 
     160     <methodparam><type>string</type><parameter>$name</parameter></methodparam> 
     161    </methodsynopsis> 
     162   </para> 
     163      
     164   <para> 
     165    <variablelist> 
     166     <varlistentry> 
     167      <term><parameter>$name</parameter></term> 
     168      <listitem>The name of the subkey to access</listitem> 
     169     </varlistentry> 
     170    </variablelist> 
     171   </para>    
     172  </sect5> 
     173   
     174  <sect5> 
     175   <title>Magic methods</title> 
     176    
     177   <para> 
     178    The <classname>Jaws_Registry_Key</classname> class implements magic methods 
     179    that make it possible to access a registry key as a class property of its 
     180    parent. This makes the following syntax valid: 
     181   </para> 
     182 
     183   <para> 
     184    <example> 
     185     <programlisting role="php">     
     186<![CDATA[ 
     187echo 'Value: '. Jaws::$Registry->jaws->foo->bar->getValue() . PHP_EOL; 
     188echo 'Type: '. Jaws::$Registry->jaws->foo->bar->getType() . PHP_EOL; 
     189]]> 
     190     </programlisting> 
     191    </example> 
     192   </para> 
     193   
     194   <para> 
     195    This example prints the value of the <literal>\jaws\foo\bar</literal> key 
     196    along with its type. 
     197   </para> 
     198  </sect5> 
     199 </sect4> 
     200 
     201 <sect4> 
     202  <title>Set the value of a subkey</title> 
     203   
     204  <para> 
     205   You can set a key's value by using a method or by setting the value of a  
     206   property with the same name as the subkey on its parent. 
     207  </para> 
     208   
     209  <sect5> 
     210   <title><classname>Jaws_Registry_Key</classname> method</title> 
     211   <para> 
     212    <methodsynopsis> 
     213     <classname>void</classname><methodname>Jaws_Registry_Key::setValue</methodname> 
     214     <methodparam><type>mixed</type><parameter>$newvalue</parameter></methodparam> 
     215    </methodsynopsis> 
     216   </para> 
     217      
     218   <para> 
     219    <variablelist> 
     220     <varlistentry> 
     221      <term><parameter>$newvalue</parameter></term> 
     222      <listitem>The new value of the key</listitem> 
     223     </varlistentry> 
     224    </variablelist> 
     225   </para> 
     226  </sect5> 
     227 
     228  <sect5> 
     229   <title>Magic methods</title> 
     230   <para> 
     231    Because the <classname>Jaws_Registry_Key</classname> overloads the set and 
     232    get operations, it is possible to set a key's value simply by using the key 
     233    as a property of its parent, as described in the previous sections. The 
     234    only difference is that you don't have to set the value with the 
     235    <methodname>setValue</methodname> method; you can assign it directly to the 
     236    property. The following example illustrates this. 
     237   </para> 
     238    
     239   <para> 
     240    <example> 
     241     <programlisting role="php">     
     242<![CDATA[ 
     243Jaws::$Registry->jaws->foo->bar = 'newvalue'; 
     244echo Jaws::$Registry->jaws->foo->bar; 
     245]]> 
     246     </programlisting> 
     247    </example> 
     248   </para> 
     249    
     250   <para> 
     251    This will print the new value of the key, <literal>newvalue</literal>. 
     252   </para> 
     253  </sect5> 
    145254 </sect4> 
    146255    
     
    150259   To create a key, the  
    151260   <methodname>Jaws_Registry_Key::createSubkey</methodname> method must be 
    152    used.  
     261   used. This method must be used on folder keys only, otherwise it will fail. 
    153262  </para> 
    154263 
     
    157266   <para> 
    158267    <methodsynopsis> 
    159      <classname>Jaws_Registry_Key</classname><methodname>Jaws::createSubkey</methodname> 
     268     <classname>Jaws_Registry_Key</classname> 
     269     <methodname>Jaws_Registry_Key::createSubkey</methodname> 
    160270     <methodparam><type>string</type><parameter>$name</parameter></methodparam> 
    161271     <methodparam><type>integer</type><parameter>$type</parameter></methodparam> 
     
    192302   </example> 
    193303  </para> 
     304   
     305  <para> 
     306   The previous example will create the <literal>\jaws\foo</literal> key. 
     307  </para> 
    194308 </sect4> 
    195309    
    196310 <sect4> 
    197311  <title>Delete a key</title> 
    198  </sect4> 
    199     
     312  <para> 
     313   To delete a key from the database, you must explicitly call the 
     314   <methodname>Jaws::deleteKey</methodname> method on the key itself. 
     315  </para> 
     316   
     317  <sect5> 
     318   &reftitle.prototype; 
     319   <para> 
     320    <methodsynopsis> 
     321     <type>void</type>><methodname>Jaws::deleteKey</methodname> 
     322     <void /> 
     323    </methodsynopsis> 
     324   </para>      
     325  </sect5> 
     326     
     327  <para>  
     328   Here is an example of usage. 
     329   <example> 
     330    <programlisting role="php">     
     331<![CDATA[ 
     332$key = Jaws::$Registry->getRootKey('jaws')->getKey('foo'); 
     333$key->deleteKey(); 
     334]]> 
     335    </programlisting> 
     336   </example> 
     337  </para> 
     338 
     339  <para> 
     340   The previous example will delete the <literal>\jaws\foo</literal> key. 
     341  </para> 
     342 </sect4> 
     343 
    200344 <sect4> 
    201345  <title>Move a key</title> 
  • doc/jaws2/en/entities/titles.ent

    r6940 r6953  
    1212<!ENTITY reftitle.internals          "<title>Internals</title>"> 
    1313<!ENTITY reftitle.subsystem.synopsis "<title>Subsystem synopsis</title>"> 
     14<!ENTITY reftitle.prototype          "<title>Method prototype</title>">