alecpl
2010-09-25 e019f2d0f2dc2fbfa345ab5d7ae85e67bfdd76b8
commit | author | age
47124c 1 <?php
T 2
3 /*
4  +-----------------------------------------------------------------------+
5  | program/include/rcube_result_set.php                                  |
6  |                                                                       |
e019f2 7  | This file is part of the Roundcube Webmail client                     |
A 8  | Copyright (C) 2006-2010, 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 /**
e019f2 24  * Roundcube result set class.
47124c 25  * Representing an address directory result set.
T 26  *
27  * @package Addressbook
28  */
29 class rcube_result_set
30 {
2eb794 31     var $count = 0;
A 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     }
47124c 47   
2eb794 48     function iterate()
A 49     {
50         return $this->records[$this->current++];
51     }
47124c 52   
2eb794 53     function first()
A 54     {
55         $this->current = 0;
56         return $this->records[$this->current++];
57     }
47124c 58   
2eb794 59     // alias for iterate()
A 60     function next()
61     {
62         return $this->iterate();
63     }
47124c 64   
2eb794 65     function seek($i)
A 66     {
67         $this->current = $i;
68     }
47124c 69   
2eb794 70 }