CodeSonar C++ API
[For improved navigation, enable JavaScript.]
Public Member Functions | Friends | Related Functions | List of all members
cs::ast_bindings Class Reference

The result of an ast_pattern::match() query: bindings from ast_pattern variables to AST fields (ast_field). More...

Public Member Functions

std::string as_repr () const
 Get a representation of a ast_bindings object that includes information useful for debugging. More...
 
std::string as_string () const
 Get a simple string representation of a ast_bindings object. More...
 
bool contains (const std::string &name) const
 Check: does an ast_bindings object contain a binding for the specified ast_pattern variable? More...
 
std::vector< string_ast_field_pairitems () const
 Get the bindings from an ast_bindings object. More...
 
bool matched () const
 Check: does an ast_bindings object describe a valid pattern matching result? More...
 
bool operator! () const
 Check: is an ast_bindings object invalid? More...
 
ast_field operator[] (const std::string &name) const
 Get the ast_field that an ast_pattern variable is bound to. More...
 
size_t size () const
 Get the number of bindings in an ast_bindings object. More...
 

Friends

std::ostream & operator<< (std::ostream &out, const ast_bindings &a)
 

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &out, const ast_bindings &a)
 Print the bindings in an ast_bindings object to the specified stream. More...
 

Detailed Description

The result of an ast_pattern::match() query: bindings from ast_pattern variables to AST fields (ast_field).

Member Function Documentation

◆ as_repr()

std::string cs::ast_bindings::as_repr ( ) const
inline

Get a representation of a ast_bindings object that includes information useful for debugging.

Returns
The string representation.

◆ as_string()

std::string cs::ast_bindings::as_string ( ) const
inline

Get a simple string representation of a ast_bindings object.

Returns
The string representation.

◆ contains()

bool cs::ast_bindings::contains ( const std::string &  name) const
inline

Check: does an ast_bindings object contain a binding for the specified ast_pattern variable?

Parameters
[in]nameThe pattern variable name.
Returns
true if the ast_bindings object contains a binding for name, false otherwise.

◆ items()

std::vector<string_ast_field_pair> cs::ast_bindings::items ( ) const
inline

Get the bindings from an ast_bindings object.

Returns
The bindings, as a std::vector of string_ast_field_pair.

◆ matched()

bool cs::ast_bindings::matched ( ) const
inline

Check: does an ast_bindings object describe a valid pattern matching result?

Returns
true if the ast_bindings object describes a valid pattern matching result, false otherwise.

◆ operator!()

bool cs::ast_bindings::operator! ( ) const
inline

Check: is an ast_bindings object invalid?

Returns
true if the ast_bindings object does NOT describe a valid pattern matching result, false otherwise.

◆ operator[]()

ast_field cs::ast_bindings::operator[] ( const std::string &  name) const
inline

Get the ast_field that an ast_pattern variable is bound to.

Parameters
[in]nameThe pattern variable name.
Returns
The ast_field that name is bound to.
Exceptions
result::ELEMENT_NOT_PRESENTif there is no binding for name.

◆ size()

size_t cs::ast_bindings::size ( ) const
inline

Get the number of bindings in an ast_bindings object.

Returns
The number of bindings.

Friends And Related Function Documentation

◆ operator<<()

std::ostream & operator<< ( std::ostream &  out,
const ast_bindings a 
)
related

Print the bindings in an ast_bindings object to the specified stream.

Parameters
[in]outThe stream to print to.
[in]aThe ast_bindings object to print.
Returns
void

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