A set of transformation rules to use with ClassName
.
More...
#include <ClassName.h>
Public Member Functions | |
size_t | size () const |
Return the number of defined rules. | |
void | add (const ClassName &pattern, const ClassName &replacement) |
Add a new transformation rule. | |
bool | applyTo (ClassName &cn) const |
Apply the set of transformation rules to a class name object. | |
std::string | apply (const std::string &name) const |
Apply transformations to a class name. |
A set of transformation rules to use with ClassName
.
Add a new transformation rule.
pattern | The pattern to match. | |
replacement | The expression with which to replace it. |
The pattern may contain variables that are then substituted into the replacement; for example, given a pattern of `A<$T, $T>` and a replacement of `B< $t>="">`, then `A<Foo<int>, Foo<int> >` would be transformed to `B<Foo<int> >'.
std::string CxxUtils::ClassName::Rules::apply | ( | const std::string & | name | ) | const |
Apply transformations to a class name.
name | The class name to transform. |
Returns the transformed class name.
This is just shorthand for calling `ClassNameapplyRules`.
bool CxxUtils::ClassName::Rules::applyTo | ( | ClassName & | cn | ) | const |
Apply the set of transformation rules to a class name object.
cn | The object to which the rules should be applied. Will be modified in place. |
All transformation rules are matched against cn
. If any match, the object is replaced with the replacement portion of the rule with match results substituted.
Returns true if any matches were made and false otherwise.