Package pygccxml :: Package declarations :: Module templates

Module templates

source code

template instantiation parser

This module implements all functionality necessary to parse C++ template instantiations.In other words this module is able to extract next information from the string like this std::vector<int> .

This module also defines few convenience function like split and join.

Functions
 
is_instantiation(decl_string)
returns True if decl_string is template instantiation and False otherwise
source code
 
name(decl_string)
returns name of instantiated template
source code
 
args(decl_string)
returns list of template arguments
source code
 
split(decl_string)
returns (name, [arguments] )
source code
 
split_recursive(decl_string)
returns [(name, [arguments])]
source code
 
join(name, args)
returns name< argument_1, argument_2, ..., argument_n >
source code
 
normalize(decl_string)
returns decl_string, which contains "normalized" spaces
source code
Function Details

is_instantiation(decl_string)

source code 

returns True if decl_string is template instantiation and False otherwise

Parameters:
  • decl_string (str) - string that should be checked for pattern presence
Returns:
bool

name(decl_string)

source code 

returns name of instantiated template

Parameters:
  • decl_string (str)
Returns:
str

args(decl_string)

source code 

returns list of template arguments

Parameters:
  • decl_string (str)
Returns:
[str]

normalize(decl_string)

source code 

returns decl_string, which contains "normalized" spaces

this functionality allows to implement comparison of 2 different string which are actually same: x::y< z > and x::y<z>