ATLAS Offline Software
Loading...
Searching...
No Matches
CxxUtils::Rules Class Reference

A set of transformation rules to use with ClassName. More...

#include <ClassName.h>

Collaboration diagram for CxxUtils::Rules:

Public Member Functions

size_t size () const
 Return the number of defined rules.
bool applyTo (ClassName &cn) const
 Add a new transformation rule.
std::string apply (const std::string &name) const
 Apply transformations to a class name.

Private Types

typedef std::pair< ClassName, ClassNamepat_repl_t
 A pattern and replacement.
typedef std::multimap< std::string, pat_repl_trulemap_t
 Map from the root of a pattern to the pattern, replacement pair.

Private Attributes

rulemap_t m_rules

Detailed Description

A set of transformation rules to use with ClassName.

Definition at line 129 of file CxxUtils/CxxUtils/ClassName.h.

Member Typedef Documentation

◆ pat_repl_t

typedef std::pair<ClassName, ClassName> CxxUtils::Rules::pat_repl_t
private

A pattern and replacement.

Definition at line 191 of file CxxUtils/CxxUtils/ClassName.h.

◆ rulemap_t

typedef std::multimap<std::string, pat_repl_t> CxxUtils::Rules::rulemap_t
private

Map from the root of a pattern to the pattern, replacement pair.

Definition at line 194 of file CxxUtils/CxxUtils/ClassName.h.

Member Function Documentation

◆ apply()

std::string CxxUtils::Rules::apply ( const std::string & name) const

Apply transformations to a class name.

Parameters
nameThe class name to transform.

Returns the transformed class name.

This is just shorthand for calling ClassName::applyRules.

◆ applyTo()

bool CxxUtils::Rules::applyTo ( ClassName & cn) const

Add a new transformation rule.

Parameters
patternThe pattern to match.
replacementThe 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> >'. */ void add (const ClassName& pattern, const ClassName& replacement);

/**

Add a new transformation rule (move version).

Parameters
patternThe pattern to match.
replacementThe 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> >'. */ void add (ClassName&& pattern, ClassName&& replacement);

/**

Apply the set of transformation rules to a class name object.

Parameters
cnThe 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.

◆ size()

size_t CxxUtils::Rules::size ( ) const

Return the number of defined rules.

Member Data Documentation

◆ m_rules

rulemap_t CxxUtils::Rules::m_rules
private

Definition at line 195 of file CxxUtils/CxxUtils/ClassName.h.


The documentation for this class was generated from the following file: