Changeset 6983
- Timestamp:
- 09/02/07 05:56:34 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
doc/jaws2/en/books/internals/specialclasses/sections/accessible.xml
r6982 r6983 115 115 <sect2> 116 116 <title>Importing and exporting attributes</title> 117 <para> 118 Exporting and importing attributes is done with the 119 <methodname>exportAttributes</methodname> and 120 <methodname>importAttributes</methodname> methods. When attributes are 121 exported, an <type>array</type> indexed with the names of the attributes 122 is returned. When importing attributes, you need to give as argument an 123 indexed <type>array</type> containing the new attributes of the object. 124 </para> 125 126 <para> 127 <example> 128 <title>Attributes importation/exportation example</title> 129 <programlisting role="php"> 130 <![CDATA[ 131 class Example extends Jaws_Accessible 132 { 133 /* ... */ 134 } 135 136 $obj = new Example; 137 138 $obj->newprop = 'adamo'; 139 $obj->anoterprop = 'degero'; 140 141 $arr = $obj->exportAttributes(); 142 print_r($arr); 143 144 $scdobj = new Example; 145 $scdobj->importAttributes($arr); 146 ]]> 147 </programlisting> 148 149 &reftitle.example.output; 150 <screen> 151 <![CDATA[ 152 Array 153 ( 154 [newprop] => adamo 155 [anoterprop] => degero 156 ) 157 ]]> 158 </screen> 159 </example> 160 </para> 117 161 </sect2> 118 162 119 163 <sect2> 120 <title>Advanced usage: subsections</title> 164 <title>Advanced usage: hierarchical attributes</title> 165 <para> 166 </para> 121 167 </sect2> 122 168 123 169 <sect2> 124 170 <title>Advanced usage: iterator and attribute counting</title> 171 <para> 172 The <classname>Jaws_Accessible</classname> object extends the 173 <classname>IteratorAggregate</classname> class. When used in an iteration, 174 an object extending <classname>Jaws_Accessible</classname> will iterate 175 through all the attributes. 176 </para> 177 178 <para> 179 The class also extends <classname>Countable</classname>. When counting the 180 object with <methodname>count</methodname>, the number of attributes of the 181 object will be returned. 182 </para> 125 183 </sect2> 126 184
