1 | /* |
2 | Copyright - 2021 - wwwouaiebe - Contact: https://www.ouaie.be/ |
3 | |
4 | This program is free software; |
5 | you can redistribute it and/or modify it under the terms of the |
6 | GNU General Public License as published by the Free Software Foundation; |
7 | either version 3 of the License, or any later version. |
8 | |
9 | This program is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | GNU General Public License for more details. |
13 | |
14 | You should have received a copy of the GNU General Public License |
15 | along with this program; if not, write to the Free Software |
16 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
17 | */ |
18 | /* |
19 | Changes: |
20 | - v1.0.0: |
21 | - created |
22 | Doc reviewed 20211111 |
23 | */ |
24 | /* ------------------------------------------------------------------------------------------------------------------------- */ |
25 | |
26 | /* ------------------------------------------------------------------------------------------------------------------------- */ |
27 | /** |
28 | Base class with properties needed to build the html files for classes/methods/properties/variables |
29 | */ |
30 | /* ------------------------------------------------------------------------------------------------------------------------- */ |
31 | |
32 | class VariableDoc { |
33 | |
34 | /** |
35 | The name found in ast |
36 | @type {?String} |
37 | */ |
38 | |
39 | name = null; |
40 | |
41 | /** |
42 | The path between the html file and theConfig.destDir ( something like '../../../', depending of the folders tree ) |
43 | @type {?String} |
44 | */ |
45 | |
46 | rootPath = null; |
47 | |
48 | /** |
49 | The file name in witch the class/method/property/variable is declared, including path since theConfig.destDir |
50 | @type {?String} |
51 | */ |
52 | |
53 | file = null; |
54 | |
55 | /** |
56 | The line at witch the class/method/property/variable is declared - found in ast |
57 | @type {?String} |
58 | */ |
59 | |
60 | line = null; |
61 | |
62 | /** |
63 | The doc found in the comments of the class/method/property/variable |
64 | @type {?CommentsDoc} |
65 | */ |
66 | |
67 | commentsDoc = null; |
68 | |
69 | /** |
70 | The constructor. Seal the object, so it's not possible to add new properties to the object |
71 | */ |
72 | |
73 | constructor ( ) { } |
74 | |
75 | } |
76 | |
77 | /* ------------------------------------------------------------------------------------------------------------------------- */ |
78 | /** |
79 | A class with properties needed to build the html files for methods/properties |
80 | */ |
81 | /* ------------------------------------------------------------------------------------------------------------------------- */ |
82 | |
83 | class MethodOrPropertyDoc extends VariableDoc { |
84 | |
85 | /** |
86 | A flag indicating that the method or property is static - found in ast |
87 | @type {?boolean} |
88 | */ |
89 | |
90 | static = null; |
91 | |
92 | /** |
93 | A flag indicating that the method is async |
94 | @type {?boolean} |
95 | */ |
96 | |
97 | async = null; |
98 | |
99 | /** |
100 | A flag indicating that the method or property is private - found in ast |
101 | @type {?boolean} |
102 | */ |
103 | |
104 | private = null; |
105 | |
106 | /** |
107 | The kind of method ( = 'get', 'set' or 'constructor' ) - found in ast |
108 | @type {?String} |
109 | */ |
110 | |
111 | kind = null; |
112 | |
113 | /** |
114 | The type ( = 'method' or 'property' ) - found in ast |
115 | @type {?String} |
116 | */ |
117 | |
118 | isA = null; |
119 | |
120 | /** |
121 | The params names found in ast |
122 | @type {?Array.<String>} |
123 | */ |
124 | |
125 | params = null; |
126 | } |
127 | |
128 | /* ------------------------------------------------------------------------------------------------------------------------- */ |
129 | /** |
130 | A class with properties needed to build the html files for classes |
131 | */ |
132 | /* ------------------------------------------------------------------------------------------------------------------------- */ |
133 | |
134 | class ClassDoc extends VariableDoc { |
135 | |
136 | /** |
137 | The super class name |
138 | @type {?String} |
139 | */ |
140 | |
141 | superClass = null; |
142 | |
143 | /** |
144 | The methods and properties of the class |
145 | @type {?Array.<methodOrPropertyDoc>} |
146 | */ |
147 | |
148 | methodsAndProperties = null; |
149 | |
150 | /** |
151 | The constructor |
152 | */ |
153 | |
154 | constructor ( ) { |
155 | super ( ); |
156 | } |
157 | } |
158 | |
159 | /* ------------------------------------------------------------------------------------------------------------------------- */ |
160 | /** |
161 | A class with properties to document params, type and returns |
162 | */ |
163 | /* ------------------------------------------------------------------------------------------------------------------------- */ |
164 | |
165 | class TypeDescription { |
166 | |
167 | /** |
168 | The name of the param |
169 | @type {String} |
170 | */ |
171 | |
172 | name = null; |
173 | |
174 | /** |
175 | The type of the param or return |
176 | @type {?String} |
177 | */ |
178 | |
179 | type = null; |
180 | |
181 | /** |
182 | The description of the param or return |
183 | @type {?String} |
184 | */ |
185 | |
186 | desc = null; |
187 | |
188 | /** |
189 | The constructor |
190 | */ |
191 | |
192 | constructor ( ) { |
193 | Object.seal ( this ); |
194 | } |
195 | |
196 | } |
197 | |
198 | /* ------------------------------------------------------------------------------------------------------------------------- */ |
199 | /** |
200 | A class with properties found in the comments and needed to build the html files for |
201 | classes/methods/properties/variables |
202 | */ |
203 | /* ------------------------------------------------------------------------------------------------------------------------- */ |
204 | |
205 | class CommentsDoc { |
206 | |
207 | /** |
208 | The description of the commented class/method/property/variable |
209 | @type {?String} |
210 | */ |
211 | |
212 | desc = null; |
213 | |
214 | /** |
215 | The sample of the commented class/method/property/variable |
216 | @type {?String} |
217 | */ |
218 | |
219 | sample = null; |
220 | |
221 | /** |
222 | The type of the commented variable |
223 | @type {?String} |
224 | */ |
225 | |
226 | type = null; |
227 | |
228 | /** |
229 | The params of the commented method |
230 | @type {?Array.<TypeDescription>} |
231 | */ |
232 | |
233 | params = null; |
234 | |
235 | /** |
236 | The returns type of the commented method |
237 | @type {TypeDescription} |
238 | */ |
239 | |
240 | returns = null; |
241 | |
242 | /** |
243 | A flag indicating that the class/method/property/variable have to be ignored |
244 | @type {Boolean} |
245 | */ |
246 | |
247 | ignore = null; |
248 | |
249 | /** |
250 | The constructor |
251 | */ |
252 | |
253 | constructor ( ) { |
254 | Object.seal ( this ); |
255 | } |
256 | |
257 | } |
258 | |
259 | export { VariableDoc, MethodOrPropertyDoc, ClassDoc, TypeDescription, CommentsDoc }; |
260 | |
261 | /* --- End of file --------------------------------------------------------------------------------------------------------- */ |
262 |