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::syntax_kind Class Reference

Enumeration class: the kind of a span within a source file instance (sfileinst). 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 syntax_kind object that includes information useful for debugging. More...
 
std::string as_string () const
 Get a simple string representation of a syntax_kind object. More...
 
int cmp (const syntax_kind &other) const
 Comparison function for syntax_kind, with respect to a stable overall ordering. More...
 
cs_hash_t hash () const
 Hash function for syntax_kind. More...
 
std::string name () const
 Get the name of a syntax_kind object. More...
 

Static Public Member Functions

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

Static Public Attributes

static const syntax_kind COMMENT
 Code comment. More...
 
static const syntax_kind GRAYOUT
 Code present in the underlying source file but removed by the preprocessor for the compilation unit containing this instance. More...
 
static const syntax_kind INCLUDE
 Preprocessor include directive. More...
 
static const syntax_kind INCLUDE_DIRECTIVE
 Preprocessor include directive. More...
 
static const syntax_kind KEYWORD
 Programming language keyword. More...
 
static const syntax_kind LABEL
 Statement label. More...
 
static const syntax_kind MACRO
 Macro name. More...
 
static const syntax_kind OPCODE
 Assembly language opcode. More...
 
static const syntax_kind PREPROCESSOR
 Preprocessor directive. More...
 
static const syntax_kind STRING
 String literal. More...
 

Related Functions

(Note that these are not member functions.)

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

Detailed Description

Enumeration class: the kind of a span within a source file instance (sfileinst).

Corresponds to syntax coloring in the CodeSonar GUI. To iterate over the spans of a particular syntax kind within a particular source file instance, use a sfileinst_color_map_iterator initialized with sfileinst::color_map_iterator().

Not to be confused with point_syntax_kind, which is a property of a single point.

Member Function Documentation

◆ as_integer()

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

Get an integer representation of this.

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

◆ as_repr()

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

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

Returns
The string representation.

◆ as_string()

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

Get a simple string representation of a syntax_kind object.

Returns
The string representation.

◆ cmp()

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

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

Parameters
otherThe 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 syntax_kind cs::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 syntax_kind x, syntax_kind.from_integer(x.as_integer()) == x
Exceptions
cs::result::ERROR_INVALID_ARGUMENTif _inner is not a valid integer representation for a syntax_kind instance.

◆ hash()

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

Hash function for syntax_kind.

◆ name()

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

Get the name of a syntax_kind object.

Returns
The name.

Friends And Related Function Documentation

◆ operator!=()

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

Inequality operator for syntax_kind.

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

◆ operator<()

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

Less-than operator for syntax_kind.

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

◆ operator<<()

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

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

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

◆ operator<=()

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

Less-than-or-equal operator for syntax_kind.

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

◆ operator==()

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

Equality operator for syntax_kind.

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

◆ operator>()

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

Greater-than operator for syntax_kind.

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

◆ operator>=()

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

Greater-than-or-equal operator for syntax_kind.

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

Member Data Documentation

◆ COMMENT

const syntax_kind cs::syntax_kind::COMMENT
static

Code comment.

◆ GRAYOUT

const syntax_kind cs::syntax_kind::GRAYOUT
static

Code present in the underlying source file but removed by the preprocessor for the compilation unit containing this instance.

◆ INCLUDE

const syntax_kind cs::syntax_kind::INCLUDE
static

Preprocessor include directive.

◆ INCLUDE_DIRECTIVE

const syntax_kind cs::syntax_kind::INCLUDE_DIRECTIVE
static

Preprocessor include directive.

◆ KEYWORD

const syntax_kind cs::syntax_kind::KEYWORD
static

Programming language keyword.

◆ LABEL

const syntax_kind cs::syntax_kind::LABEL
static

Statement label.

◆ MACRO

const syntax_kind cs::syntax_kind::MACRO
static

Macro name.

◆ OPCODE

const syntax_kind cs::syntax_kind::OPCODE
static

Assembly language opcode.

◆ PREPROCESSOR

const syntax_kind cs::syntax_kind::PREPROCESSOR
static

Preprocessor directive.

◆ STRING

const syntax_kind cs::syntax_kind::STRING
static

String literal.


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