e0b2b57d52cd029d2de1b012e76774d933aa0696
[atutor.git] / mods / phpdoc2 / PhpDocumentor / phpDocumentor / LinkClasses.inc
1 <?php\r
2 /**\r
3  * Linking to element documentation is performed by the classes in this file.\r
4  *\r
5  * abstractLink descendants contain enough information to differentiate every\r
6  * documentable element, and so can be converted to a link string by\r
7  * {@link Converter::returnSee()}\r
8  * \r
9  * phpDocumentor :: automatic documentation generator\r
10  * \r
11  * PHP versions 4 and 5\r
12  *\r
13  * Copyright (c) 2002-2006 Gregory Beaver\r
14  * \r
15  * LICENSE:\r
16  * \r
17  * This library is free software; you can redistribute it\r
18  * and/or modify it under the terms of the GNU Lesser General\r
19  * Public License as published by the Free Software Foundation;\r
20  * either version 2.1 of the License, or (at your option) any\r
21  * later version.\r
22  * \r
23  * This library is distributed in the hope that it will be useful,\r
24  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
25  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
26  * Lesser General Public License for more details.\r
27  * \r
28  * You should have received a copy of the GNU Lesser General Public\r
29  * License along with this library; if not, write to the Free Software\r
30  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
31  *\r
32  * @package    phpDocumentor\r
33  * @subpackage Links\r
34  * @author     Gregory Beaver <cellog@php.net>\r
35  * @copyright  2002-2006 Gregory Beaver\r
36  * @license    http://www.opensource.org/licenses/lgpl-license.php LGPL\r
37  * @version    CVS: $Id: LinkClasses.inc,v 1.3 2006/04/30 22:18:13 cellog Exp $\r
38  * @filesource\r
39  * @link       http://www.phpdoc.org\r
40  * @link       http://pear.php.net/PhpDocumentor\r
41  * @since      1.2.0\r
42  */\r
43 \r
44 /**\r
45  * linking classes parent\r
46  * @package phpDocumentor\r
47  * @subpackage Links\r
48  */\r
49 class abstractLink\r
50 {\r
51     /**#@+ @var string */\r
52     var $path;\r
53     /**\r
54      * phpdoc alias _phpdoc_inc for phpdoc.inc\r
55      */\r
56     var $fileAlias = '';\r
57     /**\r
58      * element type linked to.\r
59      * can only be a documentable element\r
60      */\r
61     var $type = '';\r
62     var $name = '';\r
63     var $category = '';\r
64     var $package = '';\r
65     var $subpackage = '';\r
66     /**#@-*/\r
67 \r
68     /**\r
69      * @param string full path to file containing element\r
70      * @param string page name, as configured by {@link Parser::parse}\r
71      * @param string element name\r
72      * @param string package element is in\r
73      * @param string subpackage element is in\r
74      * @param string optional category that documentation is in\r
75      */\r
76     function addLink($path, $fileAlias, $name, $package, $subpackage, $category = false)\r
77     {\r
78         $this->path = $path;\r
79         $this->fileAlias = $fileAlias;\r
80         $this->name = $name;\r
81         $this->category = $category;\r
82         $this->package = $package;\r
83         $this->subpackage = $subpackage;\r
84     }\r
85 }\r
86 \r
87 /**\r
88  * procedural page link\r
89  * @package phpDocumentor\r
90  * @subpackage Links\r
91  */\r
92 class pageLink extends abstractLink\r
93 {\r
94     /** @var string */\r
95     var $type = 'page';\r
96 }\r
97 \r
98 /**\r
99  * function link\r
100  * @package phpDocumentor\r
101  * @subpackage Links\r
102  */\r
103 class functionLink extends abstractLink\r
104 {\r
105     /** @var string */\r
106     var $type = 'function';\r
107 }\r
108 \r
109 /**\r
110  * define link\r
111  * @package phpDocumentor\r
112  * @subpackage Links\r
113  */\r
114 class defineLink extends abstractLink\r
115 {\r
116     /** @var string */\r
117     var $type = 'define';\r
118 }\r
119 \r
120 /**\r
121  * global variable link\r
122  * @package phpDocumentor\r
123  * @subpackage Links\r
124  */\r
125 class globalLink extends abstractLink\r
126 {\r
127     /** @var string */\r
128     var $type = 'global';\r
129 }\r
130 \r
131 /**\r
132  * class link\r
133  * @package phpDocumentor\r
134  * @subpackage Links\r
135  */\r
136 class classLink extends abstractLink\r
137 {\r
138     /** @var string */\r
139     var $type = 'class';\r
140 }\r
141 \r
142 /**\r
143  * method link\r
144  * @package phpDocumentor\r
145  * @subpackage Links\r
146  */\r
147 class methodLink extends abstractLink\r
148 {\r
149     /** @var string */\r
150     var $type = 'method';\r
151     /** @var string */\r
152     var $class = '';\r
153     \r
154     /**\r
155      * @param string class name\r
156      * @param string full path to file containing element\r
157      * @param string page name, as configured by {@link Parser::parse}\r
158      * @param string element name\r
159      * @param string package element is in\r
160      * @param string subpackage element is in\r
161      */\r
162     function addLink($class, $path ,$fileAlias,$name,$package,$subpackage, $category = false)\r
163     {\r
164         $this->class = $class;\r
165         abstractLink::addLink($path, $fileAlias,$name,$package,$subpackage, $category);\r
166     }\r
167 }\r
168 \r
169 /**\r
170  * class variable link\r
171  * @package phpDocumentor\r
172  * @subpackage Links\r
173  */\r
174 class varLink extends methodLink\r
175 {\r
176     /** @var string */\r
177     var $type = 'var';\r
178 }\r
179 \r
180 /**\r
181  * class constant link\r
182  * @package phpDocumentor\r
183  * @subpackage Links\r
184  */\r
185 class constLink extends methodLink\r
186 {\r
187     /** @var string */\r
188     var $type = 'const';\r
189 }\r
190 \r
191 /**\r
192  * tutorial link\r
193  * @package phpDocumentor\r
194  * @subpackage Links\r
195  */\r
196 class tutorialLink extends abstractLink\r
197 {\r
198     /**#@+ @var string */\r
199     var $type = 'tutorial';\r
200     var $section = '';\r
201     var $title = false;\r
202     /**#@-*/\r
203     \r
204     /**\r
205      * @param string section/subsection name\r
206      * @param string full path to file containing element\r
207      * @param string page name, as configured by {@link Parser::parse}\r
208      * @param string element name\r
209      * @param string package element is in\r
210      * @param string subpackage element is in\r
211      * @param string title of tutorial\r
212      */\r
213     function addLink($section,$path,$name,$package,$subpackage,$title = false, $category = false)\r
214     {\r
215         $this->section = $section;\r
216         $this->title = $title;\r
217         parent::addLink($path,'',$name,$package,$subpackage, $category);\r
218     }\r
219 }\r
220 ?>