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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.10 - (hide annotations)
Mon Mar 10 23:25:04 2003 UTC (21 years, 4 months ago) by joko
Branch: MAIN
CVS Tags: HEAD
Changes since 1.9: +8 -1 lines
+ fixed metadata for phpDocumentor

1 joko 1.1 <?
2     /**
3 joko 1.5 * This file contains the DesignPattern::AdapterProxy namespace.
4 joko 1.1 *
5     * @author Andreas Motl <andreas.motl@ilo.de>
6 joko 1.2 * @package org.netfrag.glib
7 joko 1.6 * @name DesignPattern::AdapterProxy
8 joko 1.4 *
9 joko 1.10 */
10    
11    
12     /**
13 joko 1.4 * <b>Cvs-Log:</b>
14 joko 1.1 *
15 joko 1.4 * <pre>
16 joko 1.10 * $Id: AdapterProxy.php,v 1.9 2003/03/10 22:31:56 joko Exp $
17 joko 1.2 *
18     * $Log: AdapterProxy.php,v $
19 joko 1.10 * Revision 1.9 2003/03/10 22:31:56 joko
20     * + fixed metadata for phpDocumentor
21     *
22 joko 1.9 * Revision 1.8 2003/03/05 17:28:43 joko
23     * updated docu (phpDocumentor testing....)
24     *
25 joko 1.8 * Revision 1.7 2003/03/05 17:13:17 joko
26     * updated docu (phpDocumentor testing....)
27     *
28 joko 1.7 * Revision 1.6 2003/03/05 17:02:22 joko
29     * updated docu (phpDocumentor testing....)
30     *
31 joko 1.6 * Revision 1.5 2003/03/05 16:45:58 joko
32     * updated docu (phpDocumentor testing....)
33     *
34 joko 1.5 * Revision 1.4 2003/03/05 16:32:18 joko
35     * updated docu (phpDocumentor testing....)
36     *
37 joko 1.4 * Revision 1.3 2003/03/05 16:10:17 joko
38     * updated docu (phpDocumentor testing....)
39     *
40 joko 1.3 * Revision 1.2 2003/03/05 15:41:03 joko
41     * updated docu (phpDocumentor testing....)
42     *
43 joko 1.2 * Revision 1.1 2003/03/05 12:07:10 joko
44     * + initial commit
45 joko 1.1 *
46     * Revision 1.1 2003/03/03 22:11:08 joko
47     * + initial commit
48 joko 1.4 * </pre>
49 joko 1.1 *
50     *
51     */
52 joko 1.6 // cvs-log
53 joko 1.1
54    
55     /**
56 joko 1.4 * Make sure we have the required parent class
57     */
58     loadModule('DesignPattern::TransparentProxy');
59    
60    
61     /**
62 joko 1.5 * This tries to combine some DesignPatterns....
63 joko 1.1 *
64 joko 1.5 * It combines features from both the standard Proxy
65     * and the TransparentProxy adding some Adapter features.
66 joko 1.2 *
67 joko 1.7 * @name DesignPattern::AdapterProxy
68     * @subpackage DesignPattern
69     * @package org.netfrag.glib
70 joko 1.8 *
71 joko 1.7 * @link http://www.gnu.org/licenses/lgpl.txt
72 joko 1.2 * @license GNU LGPL (GNU Lesser General Public License)
73 joko 1.8 *
74 joko 1.7 * @link http://www.netfrag.org/~joko/
75     * @copyright (c) 2003 - All Rights reserved.
76     * @author Andreas Motl <andreas.motl@ilo.de>
77 joko 1.1 *
78 joko 1.7 * @todo Learn TransparentProxy to do procedural calls ... <br>
79     * ... instead of instantiating a component and even less code could be in here<br>
80 joko 1.3 * benefit: the TransparentProxy would be become even more powerful
81     * eeäähhh, to the master Proxy it goes......!!! This one calls the handler(s)!
82     *
83     */
84 joko 1.1 class DesignPattern_AdapterProxy extends DesignPattern_TransparentProxy {
85    
86     var $_adapter;
87     var $_adapter_module;
88     var $_adapter_options;
89    
90     function &get_adapter() {
91     return $this->_adapter;
92     }
93    
94     function &set_adapter(&$adapter) {
95     $this->_adapter = &$adapter;
96     }
97    
98     // move this code to php::call_func!!! and wrap here!!!
99     function &create_adapter($m, $f, $a, $options = array()) {
100    
101     // load required module
102     php::loadModule($m);
103    
104     // V0: call-handler tests
105     //$m::$f();
106     //$res = call_user_func(array($m, $f));
107     //call_user_func("$m::$f");
108     //$m->$f();
109    
110     // V1:
111     //$res = call_user_func( array( $m, $f ) );
112    
113     // V2:
114     //return call_user_func( array( $m, $f ), $a );
115    
116     if ($options[object]) {
117     $m = php::mkInstance($m);
118     }
119    
120     // V3:
121     $this->set_adapter( call_user_func( array( &$m, $f ), $a ) );
122     return $this->get_adapter();
123    
124     //print Dumper($res);
125     //exit;
126    
127     // FIXME: use TransparentProxy for this!
128     // V1:
129     //$this = $res;
130     // V2:
131     //$this->make_transparent();
132    
133     //return $res;
134    
135     }
136    
137     function set_adapter_module($name) {
138     $this->_adapter_module = $name;
139     }
140     function get_adapter_module() {
141     return $this->_adapter_module;
142     }
143     function set_adapter_options(&$options) {
144     $this->_adapter_options = &$options;
145     }
146     function get_adapter_options() {
147     return $this->_adapter_options;
148     }
149    
150     }
151    
152     ?>

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