]> git.donarmstrong.com Git - roundcube.git/blob - program/include/rcube_result_set.php
Imported Upstream version 0.2~alpha
[roundcube.git] / program / include / rcube_result_set.php
1 <?php
2
3 /*
4  +-----------------------------------------------------------------------+
5  | program/include/rcube_result_set.php                                  |
6  |                                                                       |
7  | This file is part of the RoundCube Webmail client                     |
8  | Copyright (C) 2006-2008, RoundCube Dev. - Switzerland                 |
9  | Licensed under the GNU GPL                                            |
10  |                                                                       |
11  | PURPOSE:                                                              |
12  |   Class representing an address directory result set                  |
13  |                                                                       |
14  +-----------------------------------------------------------------------+
15  | Author: Thomas Bruederli <roundcube@gmail.com>                        |
16  +-----------------------------------------------------------------------+
17
18  $Id: rcube_result_set.php 328 2006-08-30 17:41:21Z thomasb $
19
20 */
21
22
23 /**
24  * RoundCube result set class.
25  * Representing an address directory result set.
26  *
27  * @package Addressbook
28  */
29 class rcube_result_set
30 {
31   var $count = 0;
32   var $first = 0;
33   var $current = 0;
34   var $records = array();
35   
36   function __construct($c=0, $f=0)
37   {
38     $this->count = (int)$c;
39     $this->first = (int)$f;
40   }
41   
42   function rcube_result_set($c=0, $f=0)
43   {
44     $this->__construct($c, $f);
45   }
46   
47   function add($rec)
48   {
49     $this->records[] = $rec;
50   }
51   
52   function iterate()
53   {
54     return $this->records[$this->current++];
55   }
56   
57   function first()
58   {
59     $this->current = 0;
60     return $this->records[$this->current++];
61   }
62   
63   // alias
64   function next()
65   {
66     return $this->iterate();
67   }
68   
69   function seek($i)
70   {
71     $this->current = $i;
72   }
73   
74 }