ATLAS Offline Software
|
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. More... | |
void | add (const ClassName &pattern, const ClassName &replacement) |
Add a new transformation rule. More... | |
void | add (ClassName &&pattern, ClassName &&replacement) |
Add a new transformation rule (move version). More... | |
bool | applyTo (ClassName &cn) const |
Apply the set of transformation rules to a class name object. More... | |
std::string | apply (const std::string &name) const |
Apply transformations to a class name. More... | |
Private Types | |
typedef std::pair< ClassName, ClassName > | pat_repl_t |
A pattern and replacement. More... | |
typedef std::multimap< std::string, pat_repl_t > | rulemap_t |
Map from the root of a pattern to the pattern, replacement pair. More... | |
Private Attributes | |
rulemap_t | m_rules |
A set of transformation rules to use with ClassName
.
Definition at line 129 of file CxxUtils/CxxUtils/ClassName.h.
|
private |
A pattern and replacement.
Definition at line 191 of file CxxUtils/CxxUtils/ClassName.h.
|
private |
Map from the root of a pattern to the pattern, replacement pair.
Definition at line 194 of file CxxUtils/CxxUtils/ClassName.h.
Add a new transformation rule (move version).
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> >’.
Definition at line 78 of file CxxUtils/Root/ClassName.cxx.
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> >’.
Definition at line 60 of file CxxUtils/Root/ClassName.cxx.
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 ClassName::applyRules
.
Definition at line 127 of file CxxUtils/Root/ClassName.cxx.
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.
Definition at line 99 of file CxxUtils/Root/ClassName.cxx.
size_t CxxUtils::ClassName::Rules::size | ( | ) | const |
Return the number of defined rules.
Definition at line 44 of file CxxUtils/Root/ClassName.cxx.
|
private |
Definition at line 195 of file CxxUtils/CxxUtils/ClassName.h.