]> git.donarmstrong.com Git - roundcube.git/blob - program/include/rcube_result_set.php
cf023d6363946b46849e34174a9528d95667ab59
[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-2010, The Roundcube Dev Team                       |
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 4834 2011-06-03 11:03:13Z alec $
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
37     function __construct($c=0, $f=0)
38     {
39         $this->count = (int)$c;
40         $this->first = (int)$f;
41     }
42
43     function add($rec)
44     {
45         $this->records[] = $rec;
46     }
47
48     function iterate()
49     {
50         return $this->records[$this->current++];
51     }
52
53     function first()
54     {
55         $this->current = 0;
56         return $this->records[$this->current++];
57     }
58
59     // alias for iterate()
60     function next()
61     {
62         return $this->iterate();
63     }
64
65     function seek($i)
66     {
67         $this->current = $i;
68     }
69
70 }