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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations)
Mon Mar 3 21:55:01 2003 UTC (21 years, 5 months ago) by joko
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +4 -1 lines
FILE REMOVED
refactored to Data::Container

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 * $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 DesignPattern::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 DesignPattern_Container {
60
61 var $_index;
62
63 /**
64 * The constructor ...
65 * ... just does nothing.
66 *
67 * @param registry
68 */
69 function DesignPattern_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 array_push($this->$name, &$args);
84 }
85
86 function &__slot($entity, $slot) {
87 $name = $this->__get_address($entity);
88 return $this->$name[$slot];
89 }
90
91 function &__last($entity) {
92 $name = $this->__get_address($entity);
93 $item = &$this->$name;
94 return $item[sizeof($item) - 1];
95 }
96
97 }
98
99 ?>

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