| Cvs documentation | Contained in the Cvs distribution. |
Cvs::Result::StatusList - Result list for cvs status command
Iterator class for Cvs::Result::StatusItem classes.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Copyright (C) 2003 - Olivier Poitrey
| Cvs documentation | Contained in the Cvs distribution. |
package Cvs::Result::StatusList; use strict; use base qw(Cvs::Result::Base);
sub init { my $self = shift->SUPER::init(@_); $self->{items} = []; $self->{index} = -1; $self->{last} = -1; return $self; } sub push { my($self, $item) = @_; push(@{$self->{items}}, $item); return ++$self->{last}; }
sub as_next { my($self) = @_; return $self->{index} < $self->{last}; }
sub next { my($self) = @_; return $self->{items}->[++$self->{index}]; }
sub as_prev { my($self) = @_; return $self->index > 0; }
sub prev { my($self) = @_; return unless $self->as_prev; $self->{items}->[--$self->{index}]; }
sub current { my($self) = @_; $self->{items}->[$self->{index}]; }
sub last { my($self) = @_; $self->{items}->[$self->{last}]; }
sub count { my($self) = @_; return scalar @{$self->{items}}; }
sub first { my($self) = @_; $self->{items}->[0]; }
sub index {shift->{index}}
sub rewind {shift->{index} = -1} 1;