/[cvs]/nfo/php/libs/org.netfrag.glib/Data/Container.php
ViewVC logotype

Annotation of /nfo/php/libs/org.netfrag.glib/Data/Container.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Mon Mar 3 21:27:28 2003 UTC (21 years, 4 months ago) by joko
Branch: MAIN
+ initial commit

1 joko 1.1 <?php
2    
3     /**
4     * This file contains the Data::Container class.
5     *
6     * @author Andreas Motl <andreas.motl@ilo.de>
7     * @package org.netfrag.glib
8     * @module Data::Container
9     *
10     */
11    
12     /**
13     * $Id: Container.php,v 1.2 2003/03/01 21:12:13 joko Exp $
14     *
15     * $Log: Container.php,v $
16     * Revision 1.2 2003/03/01 21:12:13 joko
17     * new core methods
18     *
19     * Revision 1.1 2003/03/01 16:51:50 joko
20     * + initial commit
21     *
22     * Revision 1.1 2003/03/01 15:31:18 joko
23     * + initial commit
24     *
25     *
26     */
27    
28    
29     /**
30     * ----
31     *
32     *
33     * @author Andreas Motl <andreas.motl@ilo.de>
34     * @copyright (c) 2003 - All Rights reserved.
35     * @license GNU LGPL (GNU Lesser General Public License)
36     *
37     * @author-url http://www.netfrag.org/~joko/
38     * @license-url http://www.gnu.org/licenses/lgpl.txt
39     *
40     * @package org.netfrag.glib
41     * @module Data::Container
42     *
43     */
44    
45     /**
46     * Todo:
47     *
48     * o xyz
49     * o bla, bli, blub
50     *
51     *
52     */
53    
54    
55     // isn't required by now:
56     //loadModule('DesignPattern::Object');
57     //class DesignPattern_MVC extends DesignPattern_Object {
58    
59     class Data_Container {
60    
61     var $_index;
62    
63     /**
64     * The constructor ...
65     * ... just does nothing.
66     *
67     * @param registry
68     */
69     function Data_Container() {
70     }
71    
72     function get_address($entity) {
73     return '_' . $entity;
74     }
75    
76     function &push() {
77     $args = &func_get_args();
78     $entity = array_shift($args);
79     $name = $this->get_address($entity);
80     // shrink array to single item?
81     if (sizeof($args) == 1) { $args = $args[0]; }
82     //$this->$entity[sizeof($this->$entity)] = &$args;
83     if (!is_array($this->$name)) {
84     php::array_cast_safe($this->$name);
85     }
86     array_push($this->$name, &$args);
87     }
88    
89     function &slot($entity, $slot) {
90     $name = $this->get_address($entity);
91     return $this->$name[$slot];
92     }
93    
94     function &last($entity) {
95     $name = $this->get_address($entity);
96     $item = &$this->$name;
97     return $item[sizeof($item) - 1];
98     }
99    
100     }
101    
102     ?>

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed