|
1 <!-- |
|
2 This file provides macro definitions that can create files and classes. |
|
3 They set up a hierarchy of location names which may be referenced by |
|
4 clients. |
|
5 |
|
6 This depends on the CommonMacros.inc file. |
|
7 |
|
8 2.1 Source file |
|
9 This is the location used for the main source file. It is not owned. |
|
10 2.1.1 System includes region |
|
11 Owned region for #include <...>, which are grouped together |
|
12 2.1.2 User includes region |
|
13 Owned region for #include "...", which must follow all system includes |
|
14 2.1.3 Constants region |
|
15 Owned region for literals, etc. |
|
16 2.2 Header file |
|
17 2.2.1 System includes region |
|
18 Owned region for #include <...> |
|
19 Typically used for child components which can be added or removed as design time, or the base class declarations used in the baseClassInfo property. |
|
20 Note: S60 style guide recommends against too many #includes " use forwards instead " but they are required if you need to declare a class requiring a base class from the header. |
|
21 2.2.2 Added includes region |
|
22 Non-owned region for #include <...> |
|
23 This provides decls needed for non-owned methods or non-deletable components and methods. |
|
24 Typically used for system headers providing declarations needed for event handlers but not by the normal class declaration. We cannot delete these #includes automatically since event handler stubs are not deleted automatically. |
|
25 2.2.3 User includes region |
|
26 Not needed, in S60 practice. Typically the main source file includes any needed user includes. This one may be needed if any components generate classes based on other classes defined by components. |
|
27 2.2.4 Forward declarations region |
|
28 Owned region for forward class and struct declarations used where a class is only referenced with a pointer or reference. The source file must include the actual header #include. |
|
29 2.2.5 Class |
|
30 Non-owned class declaration for the primary class generated by a component. These are grouped by access specifier first, to avoid a lot of repeated accessor usage (a violation of S60 coding conventions, and ugly in general). |
|
31 2.2.5.1 Public access region |
|
32 Non-owned location decorated with a "public:" accessor. This has a "unique-prototypes" filter. |
|
33 Usually contains non-owned NewL(), NewLC(), destructor declarations. |
|
34 2.2.5.1.1 Owned methods region |
|
35 Owned section for methods that other generated classes may wish to use, esp. static constructor methods, e.g. for transient components; or getters/setters for instance variables. |
|
36 This has a "unique-prototypes" filter. |
|
37 2.2.5.1.2 Owned types region |
|
38 Owned section for types that other generated classes may wish to use, esp. enums. |
|
39 2.2.5.2 Protected access region |
|
40 Non-owned location decorated with a "protected:" accessor. This has a "unique-prototypes" filter. |
|
41 This will contain base class method overrides. These are non-owned because the definitions are non-owned, which is because the user may have already overridden the method, and we don"t want to destroy/conflict with their changes. |
|
42 Note that unlike S60, we do not need a special region for overridden methods here, because the protected access region itself can be the target. |
|
43 2.2.5.3 Private access region |
|
44 Non-owned location decorated with a "private:" accessor. This has a "unique-prototypes" filter. |
|
45 Usually contains non-owned constructor. |
|
46 2.2.5.3.1 Instance variables region |
|
47 Owned |
|
48 2.2.5.3.2 Generated methods region |
|
49 Owned declarations for methods used by the implementation, e.g. listbox utilities. |
|
50 This has a "unique-prototypes" filter. |
|
51 2.2.5.3.3 Generated types region |
|
52 Owned declarations for types used by the implementation, e.g. inner classes. |
|
53 |
|
54 --> |
|
55 |
|
56 <!-- |
|
57 |
|
58 --> |
|
59 <defineMacro id="SourceFileTemplate" |
|
60 help="Defines the basic structure for a source file. |
|
61 |
|
62 This defines a file with system includes, user includes, and constants."> |
|
63 <macroArgument name="Dir" optional="true" default="${src}" |
|
64 help="Project-relative directory for file"/> |
|
65 |
|
66 <macroArgument name="FileName" optional="true" default="${instanceName$title}.cpp" |
|
67 help="Filename, inside $(Dir), to create"/> |
|
68 |
|
69 <macroArgument name="HeaderFileName" optional="true" default="${instanceName$title}.h" |
|
70 help="Filename of associated header to #include, or blank for no #include" /> |
|
71 |
|
72 <macroArgument name="LocationPrefix" optional="true" default="SOURCE" |
|
73 help="String which is prefixed to the location ids defined by this macro." /> |
|
74 |
|
75 <macroArgument name="InitialFileHeadContent" optional="true" default="" |
|
76 help="optional stock text for the source file (before system includes, user includes, |
|
77 constants). $p$ |
|
78 NOTE: one-time text, should not depend on modifiable properties $p$ |
|
79 NOTE: does not need to specify default source file template (comments), which is automatic."/> |
|
80 |
|
81 <macroArgument name="RealizeSystemIncludes" optional="true" default="true" |
|
82 help="flag that can be used to avoid generating the system includes section unless it is used. |
|
83 $p$ |
|
84 NOTE: due to issues with the source generator, this shouldn't be set 'false' unless |
|
85 you really expect there to be no system includes ever defined, otherwise, the section |
|
86 will appear out of order when generated." /> |
|
87 |
|
88 |
|
89 <macroArgument name="SystemIncludesRegionName" optional="true" default="Generated System Includes" |
|
90 help="name of the generated section for system includes"/> |
|
91 |
|
92 <macroArgument name="InitialSystemIncludesContent" optional="true" default="" |
|
93 help="optional stock text for the system includes" /> |
|
94 |
|
95 <macroArgument name="RealizeUserIncludes" optional="true" default="true" |
|
96 help="flag that can be used to avoid generating the user includes section unless it is used. |
|
97 $p$ |
|
98 NOTE: due to issues with the source generator, this shouldn't be set 'false' unless |
|
99 you really expect there to be no user includes ever defined, otherwise, the section |
|
100 will appear out of order when generated." /> |
|
101 |
|
102 <macroArgument name="UserIncludesRegionName" optional="true" default="Generated User Includes" |
|
103 help="name of the generated section for user includes"/> |
|
104 |
|
105 <macroArgument name="InitialUserIncludesContent" optional="true" default="" |
|
106 help="optional stock text for the user includes"/> |
|
107 |
|
108 <macroArgument name="RealizeConstants" optional="true" default="true" |
|
109 help="flag that can be used to avoid generating the constants section unless it is used. |
|
110 $p$ |
|
111 NOTE: due to issues with the source generator, this shouldn't be set 'false' unless |
|
112 you really expect there to be no constants ever defined, otherwise, the section |
|
113 will appear out of order when generated."/> |
|
114 |
|
115 <macroArgument name="ConstantsRegionName" optional="true" default="Generated Constants" |
|
116 help="name of the generated section for constants" /> |
|
117 |
|
118 <macroArgument name="InitialConstantsContent" optional="true" default="" |
|
119 help="optional stock text for the constants" /> |
|
120 |
|
121 <macroArgument name="InitialFileTailContent" optional="true" default="" |
|
122 help="optional stock text for the source file (after system includes, user includes, |
|
123 constants) which appears at the very end of the file. |
|
124 $p$ |
|
125 NOTE: one-time text, should not depend on modifiable properties |
|
126 $p$ |
|
127 NOTE: this really comes at the very end during initial file generation |
|
128 (unless you emit other templates with mode="at-end"), so if you simply |
|
129 want content after these sections but before other templates you add, |
|
130 just create templates for location="$(LocationPrefix)_FILE". " |
|
131 /> |
|
132 |
|
133 <!--====================================================================--> |
|
134 |
|
135 <defineLocation id="$(LocationPrefix)_FILE" |
|
136 domain="cpp" dir="$(Dir)" |
|
137 file="$(FileName)" |
|
138 owned="false" |
|
139 location=""> |
|
140 |
|
141 <template>$(InitialFileHeadContent)</template> |
|
142 |
|
143 </defineLocation> |
|
144 |
|
145 <defineLocation id="$(LocationPrefix)_OWNED_SYSTEM_INCLUDES" |
|
146 baseLocation="$(LocationPrefix)_FILE" |
|
147 location="region($(SystemIncludesRegionName))" |
|
148 filter="unique-includes" |
|
149 owned="true" |
|
150 realize="$(RealizeSystemIncludes)"> |
|
151 <template>$(InitialSystemIncludesContent)</template> |
|
152 </defineLocation> |
|
153 |
|
154 <defineLocation id="$(LocationPrefix)_OWNED_USER_INCLUDES" |
|
155 baseLocation="$(LocationPrefix)_FILE" |
|
156 location="region($(UserIncludesRegionName))" |
|
157 filter="unique-includes" |
|
158 owned="true" |
|
159 realize="$(RealizeUserIncludes)" > |
|
160 <template><![CDATA[$(InitialUserIncludesContent) |
|
161 <% if ($(HeaderFileName::as-string).length > 0) { %>#include "$(HeaderFileName)"<% } %> |
|
162 ]]> </template> |
|
163 </defineLocation> |
|
164 |
|
165 <defineLocation id="$(LocationPrefix)_OWNED_CONSTANTS" |
|
166 baseLocation="$(LocationPrefix)_FILE" |
|
167 location="region($(ConstantsRegionName))" |
|
168 owned="true" |
|
169 realize="$(RealizeConstants)"> |
|
170 <template>$(InitialConstantsContent)</template> |
|
171 </defineLocation> |
|
172 |
|
173 <template location="$(LocationPrefix)_FILE" mode="at-end"> |
|
174 $(InitialFileTailContent) |
|
175 </template> |
|
176 |
|
177 </defineMacro> |
|
178 |
|
179 |
|
180 |
|
181 |
|
182 <defineMacro id="HeaderFileTemplate" |
|
183 help=" |
|
184 Defines the basic structure for a header file. |
|
185 $p$ |
|
186 This defines a file with an include guard, system includes, user includes, |
|
187 event handler includes (non-owned but modifiable), constants, |
|
188 and forward declarations. |
|
189 "> |
|
190 <macroArgument name="Dir" optional="true" default="${inc}" |
|
191 help="Project-relative directory for file"/> |
|
192 |
|
193 <macroArgument name="FileName" optional="true" default="${instanceName$title}.h" |
|
194 help="Filename, inside $(Dir), to create" /> |
|
195 |
|
196 <macroArgument name="IncludeGuardMacro" optional="true" default="${instanceName$upper}_H" |
|
197 help="Include guard macro (#ifndef ...) to use" /> |
|
198 |
|
199 <macroArgument name="LocationPrefix" optional="true" default="HEADER" |
|
200 help="String which is prefixed to the location ids defined by this macro." /> |
|
201 |
|
202 <macroArgument name="InitialFileHeadContent" optional="true" default="" |
|
203 help="optional stock text for the top of the header file. |
|
204 |
|
205 NOTE: one-time text, should not depend on modifiable properties |
|
206 |
|
207 NOTE: does not need to specify header file template (comments) or #ifdef guards. "/> |
|
208 |
|
209 <macroArgument name="RealizeEventHandlerIncludes" optional="true" default="true" |
|
210 help="flag that can be used to avoid generating the section unless it is used. |
|
211 $p$ |
|
212 NOTE: due to issues with the source generator, this shouldn't be set 'false' unless |
|
213 you really expect there to be no event handler includes ever defined, otherwise, the section |
|
214 will appear out of order when generated." /> |
|
215 |
|
216 <macroArgument name="InitialEventHandlerIncludesContent" optional="true" default="" |
|
217 help="optional stock text for the event handler includes. |
|
218 $p$ |
|
219 NOTE: one-time text, should not depend on modifiable properties"/> |
|
220 |
|
221 |
|
222 <macroArgument name="RealizeOwnedSystemIncludes" optional="true" default="true" |
|
223 help="flag that can be used to avoid generating the system includes section unless it is used. |
|
224 $p$ |
|
225 NOTE: due to issues with the source generator, this shouldn't be set 'false' unless |
|
226 you really expect there to be no system includes ever defined, otherwise, the section |
|
227 will appear out of order when generated." /> |
|
228 |
|
229 |
|
230 <macroArgument name="OwnedSystemIncludesRegionName" optional="true" default="Generated System Includes" |
|
231 help="name of the generated section for system includes" /> |
|
232 |
|
233 <macroArgument name="RealizeOwnedUserIncludes" optional="true" default="true" |
|
234 help="flag that can be used to avoid generating the user includes section unless it is used. |
|
235 $p$ |
|
236 NOTE: due to issues with the source generator, this shouldn't be set 'false' unless |
|
237 you really expect there to be no user includes ever defined, otherwise, the section |
|
238 will appear out of order when generated." /> |
|
239 |
|
240 <macroArgument name="OwnedUserIncludesRegionName" optional="true" default="Generated User Includes" |
|
241 help="name of the generated section for user includes" /> |
|
242 |
|
243 <macroArgument name="InitialOwnedSystemIncludesContent" optional="true" default="" |
|
244 help="optional stock text for the added system includes" /> |
|
245 |
|
246 <macroArgument name="InitialOwnedUserIncludesContent" optional="true" default="" |
|
247 help="optional stock text for the user includes." /> |
|
248 |
|
249 <macroArgument name="RealizeOwnedConstants" optional="true" default="true" |
|
250 help="flag that can be used to avoid generating the constants section unless it is used. |
|
251 $p$ |
|
252 NOTE: due to issues with the source generator, this shouldn't be set 'false' unless |
|
253 you really expect there to be no constants ever defined, otherwise, the section |
|
254 will appear out of order when generated." /> |
|
255 |
|
256 <macroArgument name="InitialOwnedConstantsContent" optional="true" default="" |
|
257 help="optional stock text for the constants" /> |
|
258 |
|
259 <macroArgument name="RealizeOwnedForwardDeclarations" optional="true" default="true" |
|
260 help="flag that can be used to avoid generating the forward declarations section unless it is used. |
|
261 $p$ |
|
262 NOTE: due to issues with the source generator, this shouldn't be set 'false' unless |
|
263 you really expect there to be no forward decls ever defined, otherwise, the section |
|
264 will appear out of order when generated." /> |
|
265 |
|
266 <macroArgument name="InitialOwnedForwardDeclarationsContent" optional="true" default="" |
|
267 help="optional stock text for the forward declarations" /> |
|
268 |
|
269 <macroArgument name="RealizeOwnedTypedefs" optional="true" default="true" |
|
270 help="flag that can be used to avoid generating the typedefs section unless it is used. |
|
271 $p$ |
|
272 NOTE: due to issues with the source generator, this should't be set 'false' unless |
|
273 you really expect there to be no typedefs ever defined, otherwise, the section |
|
274 will appear out of order when generated."/> |
|
275 |
|
276 <macroArgument name="OwnedTypedefsRegionName" optional="true" default="Generated Typedefs" |
|
277 help="name of the generated section for owned typedefs"/> |
|
278 |
|
279 <macroArgument name="InitialOwnedTypedefsContent" optional="true" default="" |
|
280 help="optional stock text for the initial typedefs" /> |
|
281 |
|
282 <macroArgument name="InitialFileTailContent" optional="true" default="" |
|
283 help="optional stock text for the end of the header file. |
|
284 $p$ |
|
285 NOTE: one-time text, should not depend on modifiable properties |
|
286 $p$ |
|
287 NOTE: this really comes at the very end during initial file generation |
|
288 (unless you emit other templates with mode="at-end"), so if you simply |
|
289 want content after these sections but before other templates you add, |
|
290 just create templates for location="$(LocationPrefix)HEADER_FILE". |
|
291 "/> |
|
292 |
|
293 <!--====================================================================--> |
|
294 |
|
295 <defineLocation id="$(LocationPrefix)_FILE" |
|
296 domain="cpp" dir="$(Dir)" |
|
297 file="$(FileName)" |
|
298 owned="false" |
|
299 location=""> |
|
300 |
|
301 <template><![CDATA[ |
|
302 #ifndef $(IncludeGuardMacro) |
|
303 #define $(IncludeGuardMacro) |
|
304 $(InitialFileHeadContent) |
|
305 ]]> </template> |
|
306 |
|
307 </defineLocation> |
|
308 |
|
309 <defineLocation id="$(LocationPrefix)_OWNED_SYSTEM_INCLUDES" |
|
310 baseLocation="$(LocationPrefix)_FILE" |
|
311 location="region($(OwnedSystemIncludesRegionName))" |
|
312 filter="unique-includes" |
|
313 owned="true" |
|
314 realize="$(RealizeOwnedSystemIncludes)"> |
|
315 <template>$(InitialOwnedSystemIncludesContent)</template> |
|
316 </defineLocation> |
|
317 |
|
318 <defineLocation id="$(LocationPrefix)_EVENT_HANDLER_INCLUDES" |
|
319 baseLocation="$(LocationPrefix)_FILE" |
|
320 location="region(Event Handler Includes)" |
|
321 filter="unique-includes" |
|
322 owned="false" |
|
323 realize="$(RealizeEventHandlerIncludes)"> |
|
324 <template>$(InitialEventHandlerIncludesContent)</template> |
|
325 </defineLocation> |
|
326 |
|
327 <defineLocation id="$(LocationPrefix)_OWNED_USER_INCLUDES" |
|
328 baseLocation="$(LocationPrefix)_FILE" |
|
329 location="region($(OwnedUserIncludesRegionName))" |
|
330 filter="unique-includes" |
|
331 owned="true" |
|
332 realize="$(RealizeOwnedUserIncludes)" > |
|
333 <template>$(InitialOwnedUserIncludesContent)</template> |
|
334 </defineLocation> |
|
335 |
|
336 <defineLocation id="$(LocationPrefix)_OWNED_TYPEDEFS" |
|
337 baseLocation="$(LocationPrefix)_FILE" |
|
338 location="region($(OwnedTypedefsRegionName))" |
|
339 owned="true" |
|
340 realize="$(RealizeOwnedTypedefs)" > |
|
341 <template>$(InitialOwnedTypedefsContent)</template> |
|
342 </defineLocation> |
|
343 |
|
344 <defineLocation id="$(LocationPrefix)_OWNED_CONSTANTS" |
|
345 baseLocation="$(LocationPrefix)_FILE" |
|
346 location="region(Generated Constants)" |
|
347 owned="true" |
|
348 realize="$(RealizeOwnedConstants)"> |
|
349 <template>$(InitialOwnedConstantsContent)</template> |
|
350 </defineLocation> |
|
351 |
|
352 <defineLocation id="$(LocationPrefix)_OWNED_FORWARD_DECLARATIONS" |
|
353 baseLocation="$(LocationPrefix)_FILE" |
|
354 location="region(Generated Forward Declarations)" |
|
355 owned="true" |
|
356 realize="$(RealizeOwnedForwardDeclarations)"> |
|
357 <template>$(InitialOwnedForwardDeclarationsContent)</template> |
|
358 </defineLocation> |
|
359 |
|
360 <template location="$(LocationPrefix)_FILE" mode="at-end"><![CDATA[ |
|
361 $(InitialFileTailContent) |
|
362 #endif // $(IncludeGuardMacro) |
|
363 ]]> </template> |
|
364 |
|
365 </defineMacro> |
|
366 |
|
367 |
|
368 <defineMacro id="ClassTemplate" |
|
369 help="Defines the basic structure for a class with public, protected, and private regions, |
|
370 with owned sections therein for common purposes. |
|
371 " > |
|
372 <macroArgument name="LocationPrefix" optional="true" default="" |
|
373 help="String which is prefixed to the location ids defined by this macro. |
|
374 Useful when one component defines multiple files."/> |
|
375 |
|
376 <macroArgument name="BaseLocation" optional="true" default="HEADER_FILE" |
|
377 help="name of the base location in which to place the class, defaults to HEADER_FILE" /> |
|
378 |
|
379 <macroArgument name="ClassName" optional="true" default="${className}" |
|
380 help="name of the class to generate" /> |
|
381 |
|
382 <macroArgument name="BaseClassName" |
|
383 help="name of the base class, from which this class derives " /> |
|
384 |
|
385 <macroArgument name="BaseClassAccessor" optional="true" default="public" |
|
386 help="accessor for the base class, from which this class derives" /> |
|
387 |
|
388 <macroArgument name="ExtraBaseClasses" optional="true" |
|
389 help="extra interface classes, separated by commas" /> |
|
390 |
|
391 <macroArgument name="ClassComment" optional="true" default="" |
|
392 help="optional text for the class comment" /> |
|
393 |
|
394 <macroArgument name="InitialClassHeadContent" optional="true" default="" |
|
395 help="optional text for the start of the class |
|
396 $p$ |
|
397 NOTE: one-time code, should not depend on modifiable properties" /> |
|
398 |
|
399 <!-- public: --> |
|
400 |
|
401 <macroArgument name="InitialPublicHeadContent" optional="true" default="" |
|
402 help="optional text for the start of the public section (follows "public:") |
|
403 $p$ |
|
404 NOTE: one-time code, should not depend on modifiable properties" /> |
|
405 |
|
406 <macroArgument name="RealizePublicOwnedTypes" optional="true" default="true" |
|
407 help="flag that can be used to avoid generating the public types section unless it is used. |
|
408 $p$ |
|
409 NOTE: if InitialPublicOwnedTypesContent is set, this flag is ignored." /> |
|
410 |
|
411 <macroArgument name="InitialPublicOwnedTypesContent" optional="true" default="" |
|
412 help="optional text for the public owned types section" /> |
|
413 |
|
414 <macroArgument name="RealizePublicOwnedMethods" optional="true" default="true" |
|
415 help="flag that can be used to avoid generating the public owned methods section unless it is used. |
|
416 $p$ |
|
417 NOTE: if InitialPublicOwnedMethodsContent is set, this flag is ignored." /> |
|
418 |
|
419 <macroArgument name="InitialPublicOwnedMethodsContent" optional="true" default="" |
|
420 help="optional text for the public owned methods section " /> |
|
421 |
|
422 <macroArgument name="InitialPublicTailContent" optional="true" default="" |
|
423 help="optional text for the end of the public section (follows "public:") |
|
424 $p$ |
|
425 NOTE: one-time code, should not depend on modifiable properties |
|
426 $p$ |
|
427 NOTE: content appears at the end of all initially generated public content. |
|
428 " /> |
|
429 |
|
430 <!-- protected: --> |
|
431 |
|
432 <macroArgument name="InitialProtectedHeadContent" optional="true" default="" |
|
433 help="optional text for the start of the protected section (follows "protected:") |
|
434 $p$ |
|
435 NOTE: one-time code, should not depend on modifiable properties" /> |
|
436 |
|
437 <macroArgument name="RealizeProtectedOverriddenMethods" optional="true" default="true" |
|
438 help="flag that can be used to avoid generating the protected overridden methods section unless it is used."/> |
|
439 |
|
440 <macroArgument name="InitialProtectedOverriddenMethodsContent" optional="true" default="" |
|
441 help="optional text for the the protected overridden methods section"/> |
|
442 |
|
443 <macroArgument name="RealizeProtectedUserHandlers" optional="true" default="true" |
|
444 help="flag that can be used to avoid generating the protected user handlers section |
|
445 unless it is used. This is used for the prototypes for the user-editable |
|
446 event handler methods."/> |
|
447 |
|
448 <macroArgument name="InitialProtectedUserHandlersContent" optional="true" default="" |
|
449 help="optional text for the protected user handlers section"/> |
|
450 |
|
451 |
|
452 <macroArgument name="InitialProtectedTailContent" optional="true" default="" |
|
453 help="optional text for the end of the protected section |
|
454 $p$ |
|
455 NOTE: one-time code, should not depend on modifiable properties |
|
456 $p$ |
|
457 NOTE: content appears at the end of all initially generated protected content."/> |
|
458 |
|
459 <!-- private: --> |
|
460 |
|
461 <macroArgument name="InitialPrivateHeadContent" optional="true" default="" |
|
462 help="optional text for the start of the private section (follows "private:") |
|
463 $p$ |
|
464 NOTE: one-time code, should not depend on modifiable properties"/> |
|
465 |
|
466 <macroArgument name="RealizePrivateOwnedTypes" optional="true" default="true" |
|
467 help="flag that can be used to avoid generating the private owned types section unless it is used. |
|
468 $p$ |
|
469 NOTE: if InitialPrivateOwnedTypesContent is set, this flag is ignored."/> |
|
470 |
|
471 <macroArgument name="InitialPrivateOwnedTypesContent" optional="true" default="" |
|
472 help="optional text for the the private types section"/> |
|
473 |
|
474 <macroArgument name="RealizePrivateOwnedInstanceVariables" optional="true" default="true" |
|
475 help="flag that can be used to avoid generating the private instance variables section unless it is used."/> |
|
476 |
|
477 <macroArgument name="InitialPrivateOwnedInstanceVariablesContent" optional="true" default="" |
|
478 help=" optional text for the the private instance variables section"/> |
|
479 |
|
480 <macroArgument name="RealizePrivateOwnedMethods" optional="true" default="true" |
|
481 help="flag that can be used to avoid generating the private owned methods section unless it is used."/> |
|
482 |
|
483 <macroArgument name="InitialPrivateOwnedMethodsContent" optional="true" default="" |
|
484 help="optional text for the the private methods section"/> |
|
485 |
|
486 <macroArgument name="InitialPrivateTailContent" optional="true" default="" |
|
487 help="optional text for the end of the private section |
|
488 $p$ |
|
489 NOTE: one-time code, should not depend on modifiable properties |
|
490 $p$ |
|
491 NOTE: content appears at the end of all initially generated private content."/> |
|
492 |
|
493 <!--=========================--> |
|
494 |
|
495 <macroArgument name="InitialClassTailContent" optional="true" default="" |
|
496 help="optional text for the end of the class |
|
497 $p$ |
|
498 NOTE: one-time code, should not depend on modifiable properties" |
|
499 /> |
|
500 |
|
501 <!--====================================================================--> |
|
502 |
|
503 <defineLocation id="$(LocationPrefix)CLASS" |
|
504 owned="false" |
|
505 location="class($(ClassName))" |
|
506 baseLocation="$(BaseLocation)"> |
|
507 |
|
508 <template> |
|
509 $(ClassComment) |
|
510 class $(ClassName) : $(BaseClassAccessor) $(BaseClassName) |
|
511 { |
|
512 }; |
|
513 </template> |
|
514 |
|
515 </defineLocation> |
|
516 |
|
517 <template location="$(LocationPrefix)CLASS"> |
|
518 $(InitialClassHeadContent) |
|
519 </template> |
|
520 |
|
521 <defineLocation id="$(LocationPrefix)CLASS_BASES" |
|
522 baseLocation="$(LocationPrefix)CLASS" |
|
523 owned="false" |
|
524 filter="unique-bases" |
|
525 location="bases()"> |
|
526 </defineLocation> |
|
527 |
|
528 <template location="$(LocationPrefix)CLASS_BASES"><![CDATA[<% |
|
529 if ($(ExtraBaseClasses::is-defined)) { |
|
530 %>, $(ExtraBaseClasses)<% } |
|
531 %> ]]></template> |
|
532 |
|
533 <!-- the filter allows the location to accept new content --> |
|
534 <defineLocation id="$(LocationPrefix)CLASS_PUBLIC" |
|
535 baseLocation="$(LocationPrefix)CLASS" |
|
536 location="region(Public Section)" |
|
537 owned="false" |
|
538 filter="unique-prototypes" |
|
539 realize="true"> |
|
540 <template><![CDATA[ |
|
541 public:<% contrib.indentAdjust(-1); %>]]> |
|
542 </template> |
|
543 <template location="$(LocationPrefix)CLASS_PUBLIC"> |
|
544 $(InitialPublicHeadContent) |
|
545 </template> |
|
546 <template location="$(LocationPrefix)CLASS_PUBLIC" mode="at-end">$(InitialPublicTailContent) |
|
547 </template> |
|
548 </defineLocation> |
|
549 |
|
550 |
|
551 <defineLocation id="$(LocationPrefix)CLASS_PUBLIC_OWNED_TYPES" |
|
552 baseLocation="$(LocationPrefix)CLASS_PUBLIC" |
|
553 location="region(Generated Types)" |
|
554 owned="true" |
|
555 filter="unique-prototypes" |
|
556 realize="$(RealizePublicOwnedTypes)"> |
|
557 <template>$(InitialPublicOwnedTypesContent) |
|
558 </template> |
|
559 </defineLocation> |
|
560 |
|
561 <defineLocation id="$(LocationPrefix)CLASS_PUBLIC_OWNED_METHODS" |
|
562 baseLocation="$(LocationPrefix)CLASS_PUBLIC" |
|
563 location="region(Generated Methods)" |
|
564 owned="true" |
|
565 filter="unique-prototypes" |
|
566 realize="$(RealizePublicOwnedMethods)"> |
|
567 <template>$(InitialPublicOwnedMethodsContent) |
|
568 </template> |
|
569 </defineLocation> |
|
570 |
|
571 <!-- the filter allows the location to accept new content --> |
|
572 <defineLocation id="$(LocationPrefix)CLASS_PROTECTED" |
|
573 baseLocation="$(LocationPrefix)CLASS" |
|
574 location="region(Protected Section)" |
|
575 owned="false" |
|
576 filter="unique-prototypes" |
|
577 realize="true"> |
|
578 <template><![CDATA[ |
|
579 protected:<% contrib.indentAdjust(-1); %>]]> |
|
580 </template> |
|
581 <template location="$(LocationPrefix)CLASS_PROTECTED"> |
|
582 $(InitialProtectedHeadContent) |
|
583 </template> |
|
584 <template location="$(LocationPrefix)CLASS_PROTECTED" mode="at-end">$(InitialProtectedTailContent) |
|
585 </template> |
|
586 </defineLocation> |
|
587 |
|
588 |
|
589 <defineLocation id="$(LocationPrefix)CLASS_PROTECTED_OVERRIDDEN_METHODS" |
|
590 baseLocation="$(LocationPrefix)CLASS_PROTECTED" |
|
591 location="region(Overridden Methods)" |
|
592 owned="true" |
|
593 filter="unique-prototypes" |
|
594 realize="$(RealizeProtectedOverriddenMethods)"> |
|
595 <template>$(InitialProtectedOverriddenMethodsContent) |
|
596 </template> |
|
597 </defineLocation> |
|
598 |
|
599 <defineLocation id="$(LocationPrefix)CLASS_PROTECTED_USER_HANDLERS" |
|
600 baseLocation="$(LocationPrefix)CLASS_PROTECTED" |
|
601 location="region(User Handlers)" |
|
602 owned="false" |
|
603 filter="unique-prototypes" |
|
604 realize="$(RealizeProtectedUserHandlers)"> |
|
605 <template>$(InitialProtectedUserHandlersContent) |
|
606 </template> |
|
607 </defineLocation> |
|
608 |
|
609 <!-- the filter allows the location to accept new content --> |
|
610 <defineLocation id="$(LocationPrefix)CLASS_PRIVATE" |
|
611 baseLocation="$(LocationPrefix)CLASS" |
|
612 location="region(Private Section)" |
|
613 owned="false" |
|
614 filter="unique-prototypes" |
|
615 realize="true"> |
|
616 <template><![CDATA[ |
|
617 private:<% contrib.indentAdjust(-1);%> |
|
618 ]]> </template> |
|
619 <template location="$(LocationPrefix)CLASS_PRIVATE"> |
|
620 $(InitialPrivateHeadContent) |
|
621 </template> |
|
622 <template location="$(LocationPrefix)CLASS_PRIVATE" mode="at-end">$(InitialPrivateTailContent) |
|
623 </template> |
|
624 </defineLocation> |
|
625 |
|
626 |
|
627 <defineLocation id="$(LocationPrefix)CLASS_PRIVATE_OWNED_TYPES" |
|
628 baseLocation="$(LocationPrefix)CLASS_PRIVATE" |
|
629 location="region(Generated Types)" |
|
630 owned="true" |
|
631 filter="unique-prototypes" |
|
632 realize="$(RealizePrivateOwnedTypes)"> |
|
633 <template>$(InitialPrivateOwnedTypesContent) |
|
634 </template> |
|
635 </defineLocation> |
|
636 |
|
637 <defineLocation id="$(LocationPrefix)CLASS_PRIVATE_OWNED_INSTANCE_VARIABLES" |
|
638 baseLocation="$(LocationPrefix)CLASS_PRIVATE" |
|
639 location="region(Generated Instance Variables)" |
|
640 owned="true" |
|
641 filter="unique-prototypes" |
|
642 realize="$(RealizePrivateOwnedInstanceVariables)"> |
|
643 <template>$(InitialPrivateOwnedInstanceVariablesContent) |
|
644 </template> |
|
645 </defineLocation> |
|
646 |
|
647 <defineLocation id="$(LocationPrefix)CLASS_PRIVATE_OWNED_METHODS" |
|
648 baseLocation="$(LocationPrefix)CLASS_PRIVATE" |
|
649 location="region(Generated Methods)" |
|
650 owned="true" |
|
651 filter="unique-prototypes" |
|
652 realize="$(RealizePrivateOwnedMethods)"> |
|
653 <template>$(InitialPrivateOwnedMethodsContent) |
|
654 </template> |
|
655 </defineLocation> |
|
656 |
|
657 <template location="$(LocationPrefix)CLASS" mode="at-end">$(InitialClassTailContent) |
|
658 </template> |
|
659 |
|
660 </defineMacro> |
|
661 |
|
662 |
|
663 |
|
664 |
|
665 <defineMacro id="AddCppIncludes" |
|
666 help="Generate #includes for a space-separated list of headers. |
|
667 $p$ |
|
668 Note: you cannot use variable substitution, script escapes, etc. in the list. |
|
669 Instead, just write explicit contributions for the include, e.g. <template location="MAIN_OWNED_SYSTEM_INCLUDES"> ... "> |
|
670 |
|
671 <macroArgument name="Headers" |
|
672 help="a space-separated list of header files "/> |
|
673 |
|
674 <macroArgument name="Location" optional="true" |
|
675 help="location where includes should go (either this or Phase should be set)"/> |
|
676 |
|
677 <macroArgument name="Phase" optional="true" |
|
678 help="phase where includes should go (either this or Location should be set)"/> |
|
679 |
|
680 <macroArgument name="IsUser" optional="true" default="false" |
|
681 help=""User" or <system> includes?" /> |
|
682 |
|
683 <inline><![CDATA[ |
|
684 var headers = $(Headers::as-string).split(" "); |
|
685 var prefix, suffix; |
|
686 if ($(IsUser)) { |
|
687 prefix = "#include \""; |
|
688 suffix = "\"\n"; |
|
689 } else { |
|
690 prefix = "#include <"; |
|
691 suffix = ">\n"; |
|
692 } |
|
693 for (var h in headers) { |
|
694 var contrib = null; |
|
695 if ($(Location::is-defined)) { |
|
696 contrib = Engine.createContributionForLocation($(Location::as-string)); |
|
697 } else { |
|
698 contrib = Engine.createContributionForPhase($(Phase::as-string)); |
|
699 } |
|
700 contrib.setText(prefix + headers[h] + suffix); |
|
701 contribs.add(contrib); |
|
702 } |
|
703 ]]> |
|
704 </inline> |
|
705 </defineMacro> |
|
706 |
|
707 <defineMacro id="ResolvePhases" |
|
708 help="This macro fixes up phase -> location mappings on the current contributions, |
|
709 or optionally, another list. |
|
710 $p$ |
|
711 The mappings are Phase=Location pairs separated |
|
712 by spaces. |
|
713 $p$ |
|
714 This may be called multiple times."> |
|
715 |
|
716 <macroArgument name="Mappings" |
|
717 help="A space-separated list of Phase=Location mappings."/> |
|
718 |
|
719 <macroArgument name="ContribsList" optional="true" default="contribs" |
|
720 help="The array or list of IContribution upon which to apply the fixups."/> |
|
721 |
|
722 <inline><![CDATA[ |
|
723 var mappings = $(Mappings::as-string).split(" "); |
|
724 for (var entry in mappings) { |
|
725 var info = entry.split("="); |
|
726 Engine.assignLocationsForPhase($(ContribsList), info[0], info[1]); |
|
727 } |
|
728 ]]> </inline> |
|
729 |
|
730 </defineMacro> |
|
731 |