Grima  2018-08
Whispering into Alma's ear
Public Member Functions | Public Attributes | Protected Attributes | List of all members
ISO2709RecordSetIterator Class Reference
Inheritance diagram for ISO2709RecordSetIterator:
MARC21RecordSetIterator

Public Member Functions

  __construct ( $input)
 
  valid ()
 
  current ()
 
  key ()
 
  next ()
 
  rewind ()
 

Public Attributes

  $currentPosition
 
  $currentRecord
 
  $valid
 
  $RecordTerminator
 
  $prepend
 

Protected Attributes

  $input
 

Detailed Description

Definition at line 17 of file ISO2709.php.

Constructor & Destructor Documentation

◆ __construct()

ISO2709RecordSetIterator::__construct (   $input )

Definition at line 19 of file ISO2709.php.

References $input, and ISO2709\RecordTerminator.

19  {
20  if( is_string( $input ) ) $input = fopen( $input, "rb" );
21  if( !is_resource( $input ) ) throw new Exception("ISO2709RecordSetIterator requires a file resource, filename, or URL to be created");
22  $this->input = $input;
23  $this->recordClass = "ISO2709Record";
24  $this->RecordTerminator = ISO2709::RecordTerminator;
25  $this->prepend = "";
26  }
const RecordTerminator
Definition: ISO2709.php:121

Member Function Documentation

◆ current()

ISO2709RecordSetIterator::current ( )

Definition at line 28 of file ISO2709.php.

References $currentRecord.

28  {
29  return $this->currentRecord;
30  }

◆ key()

ISO2709RecordSetIterator::key ( )

Definition at line 31 of file ISO2709.php.

References $currentPosition.

31  {
33  }

◆ next()

ISO2709RecordSetIterator::next ( )

Definition at line 34 of file ISO2709.php.

References valid().

Referenced by rewind().

34  {
35  if( $this->currentRecord === null ) $this->currentRecord = new $this->recordClass();
36  $this->currentPosition++;
37  $string = stream_get_line( $this->input, 99999, $this->RecordTerminator );
38  $this->valid = true;
39  if( $string === false ) $this->valid = false;
40  else $this->currentRecord->loadFromString( $this->prepend . $string );
41  $this->prepend = "";
42  }

◆ rewind()

ISO2709RecordSetIterator::rewind ( )

Definition at line 43 of file ISO2709.php.

References next().

43  {
44  if($this->currentPosition !== null) rewind( $this->input );
45  $this->currentPosition = -1;
46  $this->currentRecord = new $this->recordClass();
47  $this->next();
48  }

◆ valid()

ISO2709RecordSetIterator::valid ( )

Definition at line 27 of file ISO2709.php.

References $valid.

Referenced by next().

27 { return $this->valid; }

Member Data Documentation

◆ $currentPosition

ISO2709RecordSetIterator::$currentPosition

Definition at line 18 of file ISO2709.php.

Referenced by key().

◆ $currentRecord

ISO2709RecordSetIterator::$currentRecord

Definition at line 18 of file ISO2709.php.

Referenced by current().

◆ $input

ISO2709RecordSetIterator::$input
protected

◆ $prepend

ISO2709RecordSetIterator::$prepend

Definition at line 18 of file ISO2709.php.

◆ $RecordTerminator

ISO2709RecordSetIterator::$RecordTerminator

Definition at line 18 of file ISO2709.php.

◆ $valid

ISO2709RecordSetIterator::$valid

Definition at line 18 of file ISO2709.php.

Referenced by valid().


The documentation for this class was generated from the following file: