|
ATLAS Offline Software
|
Go to the documentation of this file.
14 #ifndef CXXUTILS_CLASSNAME_H
15 #define CXXUTILS_CLASSNAME_H
108 :
public std::runtime_error
119 :
public std::runtime_error
186 std::string
apply (
const std::string&
name)
const;
194 typedef std::multimap<std::string, pat_repl_t>
rulemap_t;
200 typedef std::map<std::string, ClassName>
match_t;
263 const std::string&
name()
const;
387 void parse (
const std::string&
name, std::string::size_type&
pos);
402 std::string::size_type&
pos);
496 #endif // not CXXUTILS_CLASSNAME_H
void add(const ClassName &pattern, const ClassName &replacement)
Add a new transformation rule.
size_t size() const
Return the number of defined rules.
bool isConst() const
Get the const flag for this expression.
const std::string & name() const
Return the root name of the expression.
void subst(const match_t &matches)
Substitute variables into this expression.
void swap(ClassName &other)
Swap this expression with another one.
ExcBadClassName(const std::string &name)
Exception to signal a malformed class name.
void setConst()
Set the const flag for this expression.
Exception to signal a missing variable.
ExcMissingVariable(const std::string &var)
Exception to signal a missing variable.
void parse(const std::string &name, std::string::size_type &pos)
Parse a string into a ClassName.
bool m_const
Is this expression const?
void parseNamespace(const std::string &name, std::string::size_type &pos)
Parse a namespace qualification.
bool applyTo(ClassName &cn) const
Apply the set of transformation rules to a class name object.
void skipSpaces(const std::string &name, std::string::size_type &pos)
Skip past spaces in a string.
size_t ntargs() const
Return number of template arguments.
Recursively separate out template arguments in a C++ class name.
bool operator!=(const ClassName &other) const
Test two expressions for inequality.
std::vector< ClassName > m_namespace
The containing namespace.
std::vector< ClassName > m_targs
The template arguments for this name.
bool operator==(const ClassName &other) const
Test two expressions for equality.
void parseTemplateArgs(const std::string &name, std::string::size_type &pos)
Parse the template part of a name.
std::string fullName() const
Return the full name of the expression.
std::string apply(const std::string &name) const
Apply transformations to a class name.
A set of transformation rules to use with ClassName.
const ClassName & targ(size_t i) const
Return one template argument.
bool match1(const ClassName &pattern, bool topLevel, match_t &matches) const
Match this expression against a pattern.
std::multimap< std::string, pat_repl_t > rulemap_t
Map from the root of a pattern to the pattern, replacement pair.
bool applyRules1(const Rules &rules)
Apply a set of transformation rules to this object.
std::pair< ClassName, ClassName > pat_repl_t
A pattern and replacement.
void applyRules(const Rules &rules)
Apply a set of transformation rules to this object.
Exception to signal a malformed class name.
std::map< std::string, ClassName > match_t
Map used to hold variable assignments from matching.
ClassName()
Default constructor.
std::string parsePrimary(const std::string &name, std::string::size_type &pos)
Parse a primary part of the class name.
ClassName substCopy(const match_t &matches) const
Return a copy of this expression with variables substituted.
std::string m_name
The primary name part of this expression.
std::string qualifiedName() const
Return the namespace-qualified name of the expression.
bool match(const ClassName &pattern, match_t &matches) const
Match this expression against a pattern.