CodeSonar C++ API
Public Member Functions | Static Public Member Functions | Static Public Attributes | Related Symbols | List of all members
cs::xr_kind Class Reference

Enumeration class: describes the kind of a (non-keyword) token. More...

Public Member Functions

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

Static Public Member Functions

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

Static Public Attributes

static const xr_kind BUILTIN
 [C++ / GNU C only] builtin: the name of a __builtin_*() function.
 
static const xr_kind ENUM
 enum: an individual enum symbol.
 
static const xr_kind FIELD
 field: a field name in an aggregate.
 
static const xr_kind FILE
 file: a file name (including extension).
 
static const xr_kind FUNC
 a (non-static) function name.
 
static const xr_kind FUNC_STATIC
 a static function name.
 
static const xr_kind LABEL
 label: an identifier used as a label.
 
static const xr_kind MACRO
 macro: a macro name.
 
static const xr_kind METHOD
 a (non-static) method method name.
 
static const xr_kind METHOD_STATIC
 a static method name.
 
static const xr_kind NAMESPACE
 [C++ only] namespace: a namespace name.
 
static const xr_kind STRINGLIT
 A string literal.
 
static const xr_kind TAG
 tag: a type tag.
 
static const xr_kind TLT
 [C++ only] template type parameter: the name of a type parameter for a template.
 
static const xr_kind TLV
 [C++ only] template value parameter: the name of a value parameter for a template.
 
static const xr_kind TYPE
 type: a type name.
 
static const xr_kind VAR_GLOBAL
 a global variable name.
 
static const xr_kind VAR_LOCAL
 a local variable name.
 
static const xr_kind VAR_LOCAL_STATIC
 a locally-scoped static variable name.
 
static const xr_kind VAR_PARAMETER
 a parameter name.
 
static const xr_kind VAR_STATIC
 a static variable name.
 

Related Symbols

(Note that these are not member symbols.)

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

Detailed Description

Enumeration class: describes the kind of a (non-keyword) token.

The range of kinds associated with C and C++ programs includes type, namespace, function, variable, and so on.

Member Function Documentation

◆ as_integer()

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

Get an integer representation of this.

Returns
An integer suitable for use with from_integer().

Invariant: For xr_kind x, xr_kind.from_integer(x.as_integer()) == x

◆ as_repr()

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

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

Returns
The string representation.

◆ as_string()

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

Get a simple string representation of a xr_kind object.

Returns
The string representation.

◆ cmp()

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

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

Parameters
otherThe xr_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 xr_kind cs::xr_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 xr_kind x, xr_kind.from_integer(x.as_integer()) == x

Exceptions
cs::result::ERROR_INVALID_ARGUMENTif _inner is not a valid integer representation for a xr_kind instance.

◆ hash()

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

Hash function for xr_kind.


◆ name()

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

Get the name of a xr_kind object.

Returns
The name.

Friends And Related Symbol Documentation

◆ operator!=()

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

Inequality operator for xr_kind.

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

◆ operator<()

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

Less-than operator for xr_kind.

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

◆ operator<<()

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

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

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

◆ operator<=()

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

Less-than-or-equal operator for xr_kind.

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

◆ operator==()

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

Equality operator for xr_kind.

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

◆ operator>()

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

Greater-than operator for xr_kind.

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

◆ operator>=()

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

Greater-than-or-equal operator for xr_kind.

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

Member Data Documentation

◆ BUILTIN

const xr_kind xr_kind::BUILTIN
static

[C++ / GNU C only] builtin: the name of a __builtin_*() function.

◆ ENUM

const xr_kind xr_kind::ENUM
static

enum: an individual enum symbol.

◆ FIELD

const xr_kind xr_kind::FIELD
static

field: a field name in an aggregate.

◆ FILE

const xr_kind xr_kind::FILE
static

file: a file name (including extension).

◆ FUNC

const xr_kind xr_kind::FUNC
static

◆ FUNC_STATIC

const xr_kind xr_kind::FUNC_STATIC
static

a static function name.

◆ LABEL

const xr_kind xr_kind::LABEL
static

label: an identifier used as a label.

◆ MACRO

const xr_kind xr_kind::MACRO
static

macro: a macro name.

◆ METHOD

const xr_kind xr_kind::METHOD
static

a (non-static) method method name.

◆ METHOD_STATIC

const xr_kind xr_kind::METHOD_STATIC
static

a static method name.

◆ NAMESPACE

const xr_kind xr_kind::NAMESPACE
static

[C++ only] namespace: a namespace name.

◆ STRINGLIT

const xr_kind xr_kind::STRINGLIT
static

◆ TAG

const xr_kind xr_kind::TAG
static

tag: a type tag.

◆ TLT

const xr_kind xr_kind::TLT
static

[C++ only] template type parameter: the name of a type parameter for a template.

◆ TLV

const xr_kind xr_kind::TLV
static

[C++ only] template value parameter: the name of a value parameter for a template.

◆ TYPE

const xr_kind xr_kind::TYPE
static

type: a type name.

◆ VAR_GLOBAL

const xr_kind xr_kind::VAR_GLOBAL
static

a global variable name.

◆ VAR_LOCAL

const xr_kind xr_kind::VAR_LOCAL
static

a local variable name.

◆ VAR_LOCAL_STATIC

const xr_kind xr_kind::VAR_LOCAL_STATIC
static

◆ VAR_PARAMETER

const xr_kind xr_kind::VAR_PARAMETER
static

a parameter name.

◆ VAR_STATIC

const xr_kind xr_kind::VAR_STATIC
static

a static variable name.


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