Cppcheck
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
TemplateSimplifier::TokenAndName Class Reference

Token and its full scopename. More...

#include <templatesimplifier.h>

Public Member Functions

 TokenAndName (Token *token, std::string scope)
 Constructor used for instantiations. More...
 
 TokenAndName (Token *token, std::string scope, const Token *nameToken, const Token *paramEnd)
 Constructor used for declarations. More...
 
 TokenAndName (const TokenAndName &other)
 
 ~TokenAndName ()
 
bool operator== (const TokenAndName &rhs) const
 
std::string dump (const std::vector< std::string > &fileNames) const
 
Tokentoken () const
 
void token (Token *token)
 
const std::string & scope () const
 
const std::string & name () const
 
const std::string & fullName () const
 
const TokennameToken () const
 
const TokenparamEnd () const
 
void paramEnd (const Token *end)
 
bool isClass () const
 
bool isFunction () const
 
bool isVariable () const
 
bool isAlias () const
 
bool isSpecialization () const
 
bool isPartialSpecialization () const
 
bool isForwardDeclaration () const
 
bool isVariadic () const
 
bool isFriend () const
 
const TokenaliasStartToken () const
 Get alias start token. More...
 
const TokenaliasEndToken () const
 Get alias end token. More...
 
bool isAliasToken (const Token *tok) const
 Is token an alias token? template < ... More...
 
bool isSameFamily (const TemplateSimplifier::TokenAndName &decl) const
 Is declaration the same family (class, function or variable). More...
 

Private Types

enum  {
  fIsClass = (1 << 0) , fIsFunction = (1 << 1) , fIsVariable = (1 << 2) , fIsAlias = (1 << 3) ,
  fIsSpecialization = (1 << 4) , fIsPartialSpecialization = (1 << 5) , fIsForwardDeclaration = (1 << 6) , fIsVariadic = (1 << 7) ,
  fIsFriend = (1 << 8) , fFamilyMask = (fIsClass | fIsFunction | fIsVariable)
}
 

Private Member Functions

void isClass (bool state)
 
void isFunction (bool state)
 
void isVariable (bool state)
 
void isAlias (bool state)
 
void isSpecialization (bool state)
 
void isPartialSpecialization (bool state)
 
void isForwardDeclaration (bool state)
 
void isVariadic (bool state)
 
void isFriend (bool state)
 
bool getFlag (unsigned int flag) const
 Get specified flag state. More...
 
void setFlag (unsigned int flag, bool state)
 Set specified flag state. More...
 

Private Attributes

TokenmToken
 
std::string mScope
 
std::string mName
 
std::string mFullName
 
const TokenmNameToken
 
const TokenmParamEnd
 
unsigned int mFlags
 

Detailed Description

Token and its full scopename.

Definition at line 71 of file templatesimplifier.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
fIsClass 
fIsFunction 
fIsVariable 
fIsAlias 
fIsSpecialization 
fIsPartialSpecialization 
fIsForwardDeclaration 
fIsVariadic 
fIsFriend 
fFamilyMask 

Definition at line 80 of file templatesimplifier.h.

Constructor & Destructor Documentation

◆ TokenAndName() [1/3]

TemplateSimplifier::TokenAndName::TokenAndName ( Token token,
std::string  scope 
)

Constructor used for instantiations.

Parameters
tokentemplate instantiation name token "name<...>"
scopefull qualification of template(scope)

Definition at line 98 of file templatesimplifier.cpp.

References Token::findClosingBracket(), isFunction(), mToken, Token::next(), Token::strAt(), and Token::templateSimplifierPointer().

◆ TokenAndName() [2/3]

TemplateSimplifier::TokenAndName::TokenAndName ( Token token,
std::string  scope,
const Token nameToken,
const Token paramEnd 
)

Constructor used for declarations.

Parameters
tokentemplate declaration token "template < ... >"
scopefull qualification of template(scope)
nameTokentemplate name token "template < ... > class name"
paramEndtemplate parameter end token ">"

Definition at line 114 of file templatesimplifier.cpp.

References Token::findClosingBracket(), Token::findmatch(), Token::findOpeningBracket(), isAlias(), isClass(), isForwardDeclaration(), isFriend(), isFunction(), isPartialSpecialization(), isSpecialization(), isVariable(), isVariadic(), Token::link(), Token::Match(), mFullName, mName, mNameToken, mParamEnd, mScope, mToken, Token::next(), Token::previous(), Token::simpleMatch(), Token::str(), Token::strAt(), InternalError::SYNTAX, Token::templateSimplifierPointer(), and Token::tokAt().

◆ TokenAndName() [3/3]

TemplateSimplifier::TokenAndName::TokenAndName ( const TokenAndName other)

Definition at line 230 of file templatesimplifier.cpp.

References mToken, and Token::templateSimplifierPointer().

◆ ~TokenAndName()

TemplateSimplifier::TokenAndName::~TokenAndName ( )

Definition at line 238 of file templatesimplifier.cpp.

Member Function Documentation

◆ aliasEndToken()

const Token * TemplateSimplifier::TokenAndName::aliasEndToken ( ) const

Get alias end token.

template < ... > using X = foo < ... >; ^

Returns
alias end token

Definition at line 258 of file templatesimplifier.cpp.

References Token::findsimplematch().

Referenced by TemplateSimplifier::printOut(), and TemplateSimplifier::simplifyTemplateAliases().

◆ aliasStartToken()

const Token * TemplateSimplifier::TokenAndName::aliasStartToken ( ) const

Get alias start token.

template < ... > using X = foo < ... >; ^

Returns
alias start token

Definition at line 251 of file templatesimplifier.cpp.

References Token::tokAt().

Referenced by TemplateSimplifier::printOut(), and TemplateSimplifier::simplifyTemplateAliases().

◆ dump()

std::string TemplateSimplifier::TokenAndName::dump ( const std::vector< std::string > &  fileNames) const

Definition at line 244 of file templatesimplifier.cpp.

References Token::Match(), and ErrorLogger::toxml().

◆ fullName()

const std::string& TemplateSimplifier::TokenAndName::fullName ( ) const
inline

◆ getFlag()

bool TemplateSimplifier::TokenAndName::getFlag ( unsigned int  flag) const
inlineprivate

Get specified flag state.

Parameters
flagflag to get state of
Returns
true if flag set or false in flag not set

Definition at line 126 of file templatesimplifier.h.

◆ isAlias() [1/2]

bool TemplateSimplifier::TokenAndName::isAlias ( ) const
inline

Definition at line 199 of file templatesimplifier.h.

Referenced by TokenAndName().

◆ isAlias() [2/2]

void TemplateSimplifier::TokenAndName::isAlias ( bool  state)
inlineprivate

◆ isAliasToken()

bool TemplateSimplifier::TokenAndName::isAliasToken ( const Token tok) const

Is token an alias token? template < ...

> using X = foo < ... >; ^

Parameters
toktoken to check
Returns
true if alias token, false if not

Definition at line 265 of file templatesimplifier.cpp.

References Token::next().

Referenced by TemplateSimplifier::simplifyTemplateAliases().

◆ isClass() [1/2]

bool TemplateSimplifier::TokenAndName::isClass ( ) const
inline

Definition at line 190 of file templatesimplifier.h.

Referenced by TokenAndName().

◆ isClass() [2/2]

void TemplateSimplifier::TokenAndName::isClass ( bool  state)
inlineprivate

◆ isForwardDeclaration() [1/2]

bool TemplateSimplifier::TokenAndName::isForwardDeclaration ( ) const
inline

Definition at line 208 of file templatesimplifier.h.

Referenced by TokenAndName().

◆ isForwardDeclaration() [2/2]

void TemplateSimplifier::TokenAndName::isForwardDeclaration ( bool  state)
inlineprivate

◆ isFriend() [1/2]

bool TemplateSimplifier::TokenAndName::isFriend ( ) const
inline

Definition at line 214 of file templatesimplifier.h.

Referenced by TokenAndName().

◆ isFriend() [2/2]

void TemplateSimplifier::TokenAndName::isFriend ( bool  state)
inlineprivate

◆ isFunction() [1/2]

bool TemplateSimplifier::TokenAndName::isFunction ( ) const
inline

Definition at line 193 of file templatesimplifier.h.

Referenced by TokenAndName().

◆ isFunction() [2/2]

void TemplateSimplifier::TokenAndName::isFunction ( bool  state)
inlineprivate

◆ isPartialSpecialization() [1/2]

bool TemplateSimplifier::TokenAndName::isPartialSpecialization ( ) const
inline

Definition at line 205 of file templatesimplifier.h.

Referenced by TokenAndName().

◆ isPartialSpecialization() [2/2]

void TemplateSimplifier::TokenAndName::isPartialSpecialization ( bool  state)
inlineprivate

Definition at line 108 of file templatesimplifier.h.

Referenced by TemplateSimplifier::printOut(), and specMatch().

◆ isSameFamily()

bool TemplateSimplifier::TokenAndName::isSameFamily ( const TemplateSimplifier::TokenAndName decl) const
inline

Is declaration the same family (class, function or variable).

Parameters
decldeclaration to compare to
Returns
true if same family, false if different family

Definition at line 249 of file templatesimplifier.h.

References mFlags.

Referenced by specMatch().

◆ isSpecialization() [1/2]

bool TemplateSimplifier::TokenAndName::isSpecialization ( ) const
inline

Definition at line 202 of file templatesimplifier.h.

Referenced by TokenAndName().

◆ isSpecialization() [2/2]

void TemplateSimplifier::TokenAndName::isSpecialization ( bool  state)
inlineprivate

◆ isVariable() [1/2]

bool TemplateSimplifier::TokenAndName::isVariable ( ) const
inline

Definition at line 196 of file templatesimplifier.h.

Referenced by TokenAndName().

◆ isVariable() [2/2]

void TemplateSimplifier::TokenAndName::isVariable ( bool  state)
inlineprivate

◆ isVariadic() [1/2]

bool TemplateSimplifier::TokenAndName::isVariadic ( ) const
inline

Definition at line 211 of file templatesimplifier.h.

Referenced by TokenAndName().

◆ isVariadic() [2/2]

void TemplateSimplifier::TokenAndName::isVariadic ( bool  state)
inlineprivate

◆ name()

const std::string& TemplateSimplifier::TokenAndName::name ( ) const
inline

◆ nameToken()

const Token* TemplateSimplifier::TokenAndName::nameToken ( ) const
inline

◆ operator==()

bool TemplateSimplifier::TokenAndName::operator== ( const TokenAndName rhs) const
inline

Definition at line 157 of file templatesimplifier.h.

References mFlags, mFullName, mName, mNameToken, mParamEnd, mScope, and mToken.

◆ paramEnd() [1/2]

const Token* TemplateSimplifier::TokenAndName::paramEnd ( ) const
inline

◆ paramEnd() [2/2]

void TemplateSimplifier::TokenAndName::paramEnd ( const Token end)
inline

Definition at line 186 of file templatesimplifier.h.

◆ scope()

const std::string& TemplateSimplifier::TokenAndName::scope ( ) const
inline

◆ setFlag()

void TemplateSimplifier::TokenAndName::setFlag ( unsigned int  flag,
bool  state 
)
inlineprivate

Set specified flag state.

Parameters
flagflag to set state
statenew state of flag

Definition at line 135 of file templatesimplifier.h.

◆ token() [1/2]

Token* TemplateSimplifier::TokenAndName::token ( ) const
inline

◆ token() [2/2]

void TemplateSimplifier::TokenAndName::token ( Token token)
inline

Definition at line 168 of file templatesimplifier.h.

Member Data Documentation

◆ mFlags

unsigned int TemplateSimplifier::TokenAndName::mFlags
private

Definition at line 78 of file templatesimplifier.h.

Referenced by isSameFamily(), and operator==().

◆ mFullName

std::string TemplateSimplifier::TokenAndName::mFullName
private

Definition at line 75 of file templatesimplifier.h.

Referenced by operator==(), and TokenAndName().

◆ mName

std::string TemplateSimplifier::TokenAndName::mName
private

Definition at line 74 of file templatesimplifier.h.

Referenced by operator==(), and TokenAndName().

◆ mNameToken

const Token* TemplateSimplifier::TokenAndName::mNameToken
private

Definition at line 76 of file templatesimplifier.h.

Referenced by operator==(), and TokenAndName().

◆ mParamEnd

const Token* TemplateSimplifier::TokenAndName::mParamEnd
private

Definition at line 77 of file templatesimplifier.h.

Referenced by operator==(), and TokenAndName().

◆ mScope

std::string TemplateSimplifier::TokenAndName::mScope
private

Definition at line 73 of file templatesimplifier.h.

Referenced by operator==(), and TokenAndName().

◆ mToken

Token* TemplateSimplifier::TokenAndName::mToken
private

Definition at line 72 of file templatesimplifier.h.

Referenced by operator==(), and TokenAndName().


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