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

Enumeration class: the syntax kind associated with a program point (point), indicating the kind of source code statement from which the point was generated. More...

Public Member Functions

csint64 as_integer () const
 Get an integer representation of this. More...
 
std::string as_repr () const
 Get a representation of a point_syntax_kind object that includes information useful for debugging. More...
 
std::string as_string () const
 Get a simple string representation of a point_syntax_kind object. More...
 
int cmp (const point_syntax_kind &other) const
 Comparison function for point_syntax_kind, with respect to a stable overall ordering. More...
 
cs_hash_t hash () const
 Hash function for point_syntax_kind. More...
 
std::string name () const
 Get the name of a point_syntax_kind object. More...
 

Static Public Member Functions

static point_syntax_kind from_integer (csint64 _inner)
 Construct an instance from an integer representation. More...
 

Static Public Attributes

static const point_syntax_kind ASM
 An asm statement. More...
 
static const point_syntax_kind BREAK
 A break statement. More...
 
static const point_syntax_kind CASE
 A case label (in a switch statement). More...
 
static const point_syntax_kind CATCH
 The formal parameter of a catch clause. More...
 
static const point_syntax_kind CONTINUE
 A continue statement. More...
 
static const point_syntax_kind DO
 The controlling expression of a do-while statement. More...
 
static const point_syntax_kind ELSE
 An else label. More...
 
static const point_syntax_kind FOR
 An element of a for loop header: initialization clause, termination condition, or step clause. More...
 
static const point_syntax_kind GOTO
 A goto statement. More...
 
static const point_syntax_kind IF
 An if condition. More...
 
static const point_syntax_kind LABEL
 A statement label. More...
 
static const point_syntax_kind NONE
 All other program points. More...
 
static const point_syntax_kind RETURN
 A return statement or expression. More...
 
static const point_syntax_kind SWITCH
 The controlling expression of a switch statement. More...
 
static const point_syntax_kind THROW
 A throw expression. More...
 
static const point_syntax_kind TRY
 A try block header. More...
 
static const point_syntax_kind WHILE
 The controlling expression of a while statement. More...
 

Related Functions

(Note that these are not member functions.)

bool operator!= (const point_syntax_kind &a, const point_syntax_kind &b)
 Inequality operator for point_syntax_kind. More...
 
bool operator< (const point_syntax_kind &a, const point_syntax_kind &b)
 Less-than operator for point_syntax_kind. More...
 
std::ostream & operator<< (std::ostream &out, const point_syntax_kind &a)
 Print a representation of a point_syntax_kind object to the specified stream. More...
 
bool operator<= (const point_syntax_kind &a, const point_syntax_kind &b)
 Less-than-or-equal operator for point_syntax_kind. More...
 
bool operator== (const point_syntax_kind &a, const point_syntax_kind &b)
 Equality operator for point_syntax_kind. More...
 
bool operator> (const point_syntax_kind &a, const point_syntax_kind &b)
 Greater-than operator for point_syntax_kind. More...
 
bool operator>= (const point_syntax_kind &a, const point_syntax_kind &b)
 Greater-than-or-equal operator for point_syntax_kind. More...
 

Detailed Description

Enumeration class: the syntax kind associated with a program point (point), indicating the kind of source code statement from which the point was generated.

The "bodies" of code keywords do not have syntax kinds, only conditions, exprs, etc. In the code:

for (i = 0; i < 10; ++i)
j = i;

The syntax kinds and elements are as follows.

point point_syntax_kind point_syntax_element
i = 0 point_syntax_kind::FOR point_syntax_element::INIT
i < 10 point_syntax_kind::FOR point_syntax_element::COND
++i point_syntax_kind::FOR point_syntax_element::INCR
j = 1 point_syntax_kind::NONE point_syntax_element::NONE

Get a point's syntax kind with point::get_syntax_kind().

Not to be confused with syntax_kind, which is a property of a span within a source file instance.

Member Function Documentation

◆ as_integer()

csint64 cs::point_syntax_kind::as_integer ( ) const
inline

Get an integer representation of this.

Returns
An integer suitable for use with from_integer(). Invariant: For point_syntax_kind x, point_syntax_kind.from_integer(x.as_integer()) == x

◆ as_repr()

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

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

Returns
The string representation.

◆ as_string()

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

Get a simple string representation of a point_syntax_kind object.

Returns
The string representation.

◆ cmp()

int cs::point_syntax_kind::cmp ( const point_syntax_kind other) const
inline

Comparison function for point_syntax_kind, with respect to a stable overall ordering.

Parameters
otherThe point_syntax_kind object to compare against.
Returns
An integer N such that:
  • N==0 if the two objects compare equal
  • N<0 if this < other
  • N>0 if this > other

◆ from_integer()

static point_syntax_kind cs::point_syntax_kind::from_integer ( csint64  _inner)
inlinestatic

Construct an instance from an integer representation.

Parameters
[in]_innerThe integer representation, as returned by as_integer(). Invariant: For point_syntax_kind x, point_syntax_kind.from_integer(x.as_integer()) == x
Exceptions
cs::result::ERROR_INVALID_ARGUMENTif _inner is not a valid integer representation for a point_syntax_kind instance.

◆ hash()

cs_hash_t cs::point_syntax_kind::hash ( ) const
inline

Hash function for point_syntax_kind.

◆ name()

std::string cs::point_syntax_kind::name ( ) const
inline

Get the name of a point_syntax_kind object.

Returns
The name.

Friends And Related Function Documentation

◆ operator!=()

bool operator!= ( const point_syntax_kind a,
const point_syntax_kind b 
)
related

Inequality operator for point_syntax_kind.

Parameters
[in]aThe point_syntax_kind object to compare.
[in]bThe point_syntax_kind object to compare against.
Returns
false if a and b are equal according to point_syntax_kind::cmp(), true otherwise.

◆ operator<()

bool operator< ( const point_syntax_kind a,
const point_syntax_kind b 
)
related

Less-than operator for point_syntax_kind.

Parameters
[in]aThe point_syntax_kind object to compare.
[in]bThe point_syntax_kind object to compare against.
Returns
true if a < b according to point_syntax_kind::cmp() , false otherwise.

◆ operator<<()

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

Print a representation of a point_syntax_kind object to the specified stream.

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

◆ operator<=()

bool operator<= ( const point_syntax_kind a,
const point_syntax_kind b 
)
related

Less-than-or-equal operator for point_syntax_kind.

Parameters
[in]aThe point_syntax_kind object to compare.
[in]bThe point_syntax_kind object to compare against.
Returns
true if a <= b according to point_syntax_kind::cmp() , false otherwise.

◆ operator==()

bool operator== ( const point_syntax_kind a,
const point_syntax_kind b 
)
related

Equality operator for point_syntax_kind.

Parameters
[in]aThe point_syntax_kind object to compare.
[in]bThe point_syntax_kind object to compare against.
Returns
true if a and b are equal according to point_syntax_kind::cmp(), false otherwise.

◆ operator>()

bool operator> ( const point_syntax_kind a,
const point_syntax_kind b 
)
related

Greater-than operator for point_syntax_kind.

Parameters
[in]aThe point_syntax_kind object to compare.
[in]bThe point_syntax_kind object to compare against.
Returns
true if a > b according to point_syntax_kind::cmp() , false otherwise.

◆ operator>=()

bool operator>= ( const point_syntax_kind a,
const point_syntax_kind b 
)
related

Greater-than-or-equal operator for point_syntax_kind.

Parameters
[in]aThe point_syntax_kind object to compare.
[in]bThe point_syntax_kind object to compare against.
Returns
true if a >= b according to point_syntax_kind::cmp() , false otherwise.

Member Data Documentation

◆ ASM

const point_syntax_kind cs::point_syntax_kind::ASM
static

An asm statement.

◆ BREAK

const point_syntax_kind cs::point_syntax_kind::BREAK
static

A break statement.

◆ CASE

const point_syntax_kind cs::point_syntax_kind::CASE
static

A case label (in a switch statement).

◆ CATCH

const point_syntax_kind cs::point_syntax_kind::CATCH
static

The formal parameter of a catch clause.

◆ CONTINUE

const point_syntax_kind cs::point_syntax_kind::CONTINUE
static

A continue statement.

◆ DO

const point_syntax_kind cs::point_syntax_kind::DO
static

The controlling expression of a do-while statement.

◆ ELSE

const point_syntax_kind cs::point_syntax_kind::ELSE
static

An else label.

◆ FOR

const point_syntax_kind cs::point_syntax_kind::FOR
static

An element of a for loop header: initialization clause, termination condition, or step clause.

◆ GOTO

const point_syntax_kind cs::point_syntax_kind::GOTO
static

A goto statement.

◆ IF

const point_syntax_kind cs::point_syntax_kind::IF
static

An if condition.

◆ LABEL

const point_syntax_kind cs::point_syntax_kind::LABEL
static

A statement label.

◆ NONE

const point_syntax_kind cs::point_syntax_kind::NONE
static

All other program points.

◆ RETURN

const point_syntax_kind cs::point_syntax_kind::RETURN
static

A return statement or expression.

◆ SWITCH

const point_syntax_kind cs::point_syntax_kind::SWITCH
static

The controlling expression of a switch statement.

◆ THROW

const point_syntax_kind cs::point_syntax_kind::THROW
static

A throw expression.

◆ TRY

const point_syntax_kind cs::point_syntax_kind::TRY
static

A try block header.

◆ WHILE

const point_syntax_kind cs::point_syntax_kind::WHILE
static

The controlling expression of a while statement.


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