KeyFilter Class Reference
[Example classes]

Regular expression filter for string iterators. More...

Inheritance diagram for KeyFilter:

Inheritance graph
{IniGroups\n||+ __construct()\l+ current()\l+ key()\l}
[legend]
List of all members.

Public Member Functions

 __construct (Iterator $it, $regex)
 accept ()
 getRegex ()

Protected Member Functions

 __clone ()

Private Attributes

 $regex

Detailed Description

Regular expression filter for string iterators.

Author:
Marcus Boerger
Version:
1.1
Instances of this class act as a filter around iterators whose elements are strings. In other words you can put an iterator into the constructor and the instance will only return elements which match the given regular expression.

Definition at line 22 of file keyfilter.inc.


Constructor & Destructor Documentation

KeyFilter::__construct ( Iterator it,
regex 
)

Constructs a filter around an iterator whose elemnts are strings.

If the given iterator is of type spl_sequence then its rewind() method is called.

Parameters:
it Object that implements at least spl_forward
regex Regular expression used as a filter.

Definition at line 35 of file keyfilter.inc.

References $it, and $regex.

00036     {
00037         parent::__construct($it);
00038         $this->regex = $regex;
00039     }


Member Function Documentation

KeyFilter::__clone (  )  [protected]

hidden __clone

Definition at line 58 of file keyfilter.inc.

00059     {
00060         // disallow clone 
00061     }

KeyFilter::accept (  ) 

Returns:
whether the current key mathes the regular expression

Definition at line 43 of file keyfilter.inc.

00044     {
00045         return ereg($this->regex, $this->getInnerIterator()->key());
00046     }

KeyFilter::getRegex (  ) 

Returns:
regular expression used as filter

Definition at line 50 of file keyfilter.inc.

00051     {
00052         return $this->regex;
00053     }


Member Data Documentation

KeyFilter::$regex [private]

For internal use only.

regular exoression used as filter

Definition at line 25 of file keyfilter.inc.

Referenced by __construct().


The documentation for this class was generated from the following file:
Generated on Thu Apr 26 01:06:16 2007 for SPL-StandardPHPLibrary by  doxygen 1.5.2