class_add_declaration.xsl
Weaving Rule that adds a declaration to a class
- srcML element:
src:class - advice type:
add - codeModifier type:
declaration
- Check if appropriate access modifiers exist, if not add an advice to the class so they are added the next time.
- If all access modifiers have been added, the add advices of the class are moved to the access modifier elements.
Example 1
Base Code
class Foo {
public:
}
Code Modifier
<codeModifier type="declaration">
<accessModifier type="public"/>
<text>int foo();</text>
</codeModifier>Modified Code
class Foo {
public:
int foo();
}
Example 2
Access modifier blocks are added by the weaver if needed.
Base Code
class Foo {
public:
int foo1();
}
Code Modifier
<codeModifier type="declaration">
<accessModifier type="private"/>
<text>int foo2();</text>
</codeModifier>Modified Code
class Foo {
public:
int foo1();
private:
int foo2();
}
Examples in AspectX Sample Library
- AddClassField
- CarSynchronizeWindows
- Profiling
- AddGetterMethod
- AddComplexGetterMethod
- AddAllGetterMethods
- Observer
- BaseParameter
- ParameterDatabaseByPointer
- PassiveToCyclical
- PassiveToSporadic
- ThreadSafety
- CarSynchronizeWindows
Examples in AspectX Test Suite
- AllFunctionDollarVariables
CVS Id:
Author:
ibirrer
Copyright:
2004, P&P Software GmbH
Match Templates Summary
Default copy template for class_add_declaration_move_declarations
src:public | src:private | src:protected (param: advicesmode: class_add_declaration_move_declarations) - source
Move advices to the appropriate access modifier element
Match Templates Detail
Default copy template for class_add_declaration_move_declarations
Parameters:
advices -
src:public | src:private | src:protected (param: advicesmode: class_add_declaration_move_declarations) - source
Move advices to the appropriate access modifier element
Parameters:
advices -
src:class[ax:advice[@type='add' and position() = 1]/ax:codeModifier[@type='declaration']] (mode: weaving) - source
This template does the following:
- Check if appropriate access modifiers exist, if not add an advice to the class so they are added the next time.
- If all access modifiers have been added, the add advices of the class are moved to the access modifier elements.