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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations)
Sat Mar 1 21:12:13 2003 UTC (21 years, 7 months ago) by joko
Branch: MAIN
Changes since 1.1: +27 -4 lines
new core methods

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

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