thomascube
2010-04-01 1d773d71414316e0b9836a15c35576593427ee21
commit | author | age
47124c 1 <?php
T 2
3 /*
4  +-----------------------------------------------------------------------+
5  | program/include/rcube_result_set.php                                  |
6  |                                                                       |
7  | This file is part of the RoundCube Webmail client                     |
cbbef3 8  | Copyright (C) 2006-2009, RoundCube Dev. - Switzerland                 |
47124c 9  | Licensed under the GNU GPL                                            |
T 10  |                                                                       |
11  | PURPOSE:                                                              |
12  |   Class representing an address directory result set                  |
13  |                                                                       |
14  +-----------------------------------------------------------------------+
15  | Author: Thomas Bruederli <roundcube@gmail.com>                        |
16  +-----------------------------------------------------------------------+
17
638fb8 18  $Id$
47124c 19
T 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 add($rec)
43   {
44     $this->records[] = $rec;
45   }
46   
47   function iterate()
48   {
49     return $this->records[$this->current++];
50   }
51   
52   function first()
53   {
54     $this->current = 0;
55     return $this->records[$this->current++];
56   }
57   
58   // alias
59   function next()
60   {
61     return $this->iterate();
62   }
63   
64   function seek($i)
65   {
66     $this->current = $i;
67   }
68   
69 }