|
| 1 | +<?xml version="1.0" encoding="utf-8"?> |
| 2 | +<!-- EN-Revision: 434557c58ba28213b97f39bc7ca1e59dc8f6cae9 Maintainer: siwa32 Status: ready --> |
| 3 | +<!-- CREDITS: siwa32 --> |
| 4 | +<refentry xml:id="splobjectstorage.seek" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"> |
| 5 | + <refnamediv> |
| 6 | + <refname>SplObjectStorage::seek</refname> |
| 7 | + <refpurpose>位置を移動する</refpurpose> |
| 8 | + </refnamediv> |
| 9 | + |
| 10 | + <refsect1 role="description"> |
| 11 | + &reftitle.description; |
| 12 | + <methodsynopsis role="SplObjectStorage"> |
| 13 | + <modifier>public</modifier> <type>void</type><methodname>SplObjectStorage::seek</methodname> |
| 14 | + <methodparam><type>int</type><parameter>offset</parameter></methodparam> |
| 15 | + </methodsynopsis> |
| 16 | + |
| 17 | + <simpara> |
| 18 | + イテレータ内の指定した位置に移動します。 |
| 19 | + </simpara> |
| 20 | + </refsect1> |
| 21 | + |
| 22 | + <refsect1 role="parameters"> |
| 23 | + &reftitle.parameters; |
| 24 | + <variablelist> |
| 25 | + <varlistentry> |
| 26 | + <term><parameter>offset</parameter></term> |
| 27 | + <listitem> |
| 28 | + <simpara> |
| 29 | + 移動先の位置。 |
| 30 | + </simpara> |
| 31 | + </listitem> |
| 32 | + </varlistentry> |
| 33 | + </variablelist> |
| 34 | + </refsect1> |
| 35 | + |
| 36 | + <refsect1 role="returnvalues"> |
| 37 | + &reftitle.returnvalues; |
| 38 | + <simpara> |
| 39 | + &return.void; |
| 40 | + </simpara> |
| 41 | + </refsect1> |
| 42 | + |
| 43 | + <refsect1 role="errors"> |
| 44 | + &reftitle.errors; |
| 45 | + <simpara> |
| 46 | + <parameter>offset</parameter> に移動できない場合は、 |
| 47 | + <classname>OutOfBoundsException</classname> をスローします。 |
| 48 | + </simpara> |
| 49 | + </refsect1> |
| 50 | + |
| 51 | + <refsect1 role="examples"> |
| 52 | + &reftitle.examples; |
| 53 | + <example xml:id="splobjectstorage.seek.example.basic"> |
| 54 | + <title><methodname>SplObjectStorage::seek</methodname> の例</title> |
| 55 | + <simpara> |
| 56 | + イテレータの 2 番目の位置に移動します。 |
| 57 | + </simpara> |
| 58 | + <programlisting role="php"> |
| 59 | +<![CDATA[ |
| 60 | +<?php |
| 61 | +class Test { |
| 62 | + public function __construct(public string $marker) {} |
| 63 | +} |
| 64 | +
|
| 65 | +$a = new Test("a"); |
| 66 | +$b = new Test("b"); |
| 67 | +$c = new Test("c"); |
| 68 | +
|
| 69 | +$storage = new SplObjectStorage(); |
| 70 | +$storage[$a] = "first"; |
| 71 | +$storage[$b] = "second"; |
| 72 | +$storage[$c] = "third"; |
| 73 | +
|
| 74 | +$storage->seek(2); |
| 75 | +var_dump($storage->key()); |
| 76 | +var_dump($storage->current()); |
| 77 | +?> |
| 78 | +]]> |
| 79 | + </programlisting> |
| 80 | + &example.outputs; |
| 81 | + <screen> |
| 82 | +<![CDATA[ |
| 83 | +int(2) |
| 84 | +object(Test)#3 (1) { |
| 85 | + ["marker"]=> |
| 86 | + string(1) "c" |
| 87 | +} |
| 88 | +]]> |
| 89 | + </screen> |
| 90 | + </example> |
| 91 | + </refsect1> |
| 92 | + |
| 93 | + <refsect1 role="seealso"> |
| 94 | + &reftitle.seealso; |
| 95 | + <simplelist> |
| 96 | + <member><classname>SeekableIterator</classname></member> |
| 97 | + </simplelist> |
| 98 | + </refsect1> |
| 99 | + |
| 100 | +</refentry> |
| 101 | +<!-- Keep this comment at the end of the file |
| 102 | +Local variables: |
| 103 | +mode: sgml |
| 104 | +sgml-omittag:t |
| 105 | +sgml-shorttag:t |
| 106 | +sgml-minimize-attributes:nil |
| 107 | +sgml-always-quote-attributes:t |
| 108 | +sgml-indent-step:1 |
| 109 | +sgml-indent-data:t |
| 110 | +indent-tabs-mode:nil |
| 111 | +sgml-parent-document:nil |
| 112 | +sgml-default-dtd-file:"~/.phpdoc/manual.ced" |
| 113 | +sgml-exposed-tags:nil |
| 114 | +sgml-local-catalogs:nil |
| 115 | +sgml-local-ecat-files:nil |
| 116 | +End: |
| 117 | +vim600: syn=xml fen fdm=syntax fdl=2 si |
| 118 | +vim: et tw=78 syn=sgml |
| 119 | +vi: ts=1 sw=1 |
| 120 | +--> |
0 commit comments