<
aspect xmlns:cpp="
http://www.sdml.info/srcML/cpp"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsl="
http://www.w3.org/1999/XSL/Transform"
xmlns="
http://control.ee.ethz.ch/XWeaver/AspectX"
xmlns:src="
http://www.sdml.info/srcML/src"
xsi:schemaLocation="
http://control.ee.ethz.ch/XWeaver/AspectX ../../../../src/xsd/aspectX.xsd"
name="
AddClassComment_2">
<
description>
Sample aspect program to modify a class comment. This aspect program defines a text fragment that can be
added to the comment of a set of target classes. The target classes are defined through a name pattern. The target classes are
those whose name begins with the string "DC_Dummy".
A related aspect program (<
code>
AddClassComment_1</
code>
) shows an alternative way to modify class comments.
<
author>
A. Pasetti</
author>
<
see>
AddClassComment_1</
see>
</
description>
<
pointcut name="
targetClass"
type="
src:class"
constraint="
starts-with(src:name,'DC_Dummy')">
<
description>
Points to the target classes whose comment should be modified. The target classes are
identified as follows. In srcML, classes are described by a "class" element which have a subelement called "name" which
holds the name of the class. The target classes are identified using an XPath expression that identifies all class elements with
a name that starts with the string "DC_Dummy". </
description>
</
pointcut>
<
pointcut name="
targetClassComment"
type="
src:comment">
<
description>
Points to the comments that must be modified. These comments are defined as the comments that are
followed by the <
code>
targetClass</
code>
pointcut. </
description>
<
restriction type="
followedBy">
<
pointcutRef type="
src:class"
ref="
targetClass" />
</
restriction>
</
pointcut>
<
advice name="
addClassComment"
type="
end">
<
description>
Add a comment at the end of the comment of the target class. A CDATA section is used in order to allow use of
HTML tags in the comment text. Aspect program <
code>
AddClassComment_1</
code>
shows an alternative way to express the HTML tag.</
description>
<
pointcutRef ref="
targetClassComment"
type="
src:comment" />
<
codeModifier type="
comment">
<
text>
<p>
This comment fragment was automatically inserted by an aspect program. The name of the aspect
program is: <code>AddClassComment_2</code>.</
text>
</
codeModifier>
</
advice>
</
aspect>
v