libabigail
Public Types | Public Member Functions | List of all members
integral_type Class Reference

The internal representation of an integral type. More...

#include <abg-ir-priv.h>

Public Types

enum  base_type {
  INT_BASE_TYPE , CHAR_BASE_TYPE , BOOL_BASE_TYPE , DOUBLE_BASE_TYPE ,
  FLOAT_BASE_TYPE , CHAR16_T_BASE_TYPE , CHAR32_T_BASE_TYPE , WCHAR_T_BASE_TYPE
}
 The possible base types of integral types. We might have forgotten many of these, so do not hesitate to add new ones. More...
 
enum  modifiers_type {
  NO_MODIFIER , SIGNED_MODIFIER , UNSIGNED_MODIFIER , SHORT_MODIFIER ,
  LONG_MODIFIER , LONG_LONG_MODIFIER
}
 The modifiers of the base types above. Several modifiers can be combined for a given base type. The presence of modifiers is usually modelled by a bitmap of modifiers. More...
 

Public Member Functions

 integral_type ()
 Default constructor of the integral_type. More...
 
 integral_type (base_type, modifiers_type)
 Constructor of the integral_type. More...
 
 integral_type (const string &name)
 Constructor of the integral_type. More...
 
base_type get_base_type () const
 Getter of the base type of the integral_type. More...
 
modifiers_type get_modifiers () const
 Getter of the modifiers bitmap of the integral_type. More...
 
 operator string () const
 Convert the current instance of integral_type into its string representation. More...
 
bool operator== (const integral_type &) const
 Equality operator for the integral_type. More...
 
void set_modifiers (modifiers_type)
 Setter of the modifiers bitmap of the integral_type. More...
 
string to_string (bool internal=false) const
 Return the string representation of the current instance of integral_type. More...
 

Detailed Description

The internal representation of an integral type.

This is a "utility type" used internally to canonicalize the name of fundamental integral types, so that "unsignd long" and "long unsined int" end-up having the same name.

Definition at line 45 of file abg-ir-priv.h.

Member Enumeration Documentation

◆ base_type

enum base_type

The possible base types of integral types. We might have forgotten many of these, so do not hesitate to add new ones.

If you do add new ones, please also consider updating functions parse_base_integral_type and integral_type::to_string.

Enumerator
INT_BASE_TYPE 

The "int" base type.

CHAR_BASE_TYPE 

The "char" base type.

BOOL_BASE_TYPE 

The "bool" base type in C++ or "_Bool" in C11.

DOUBLE_BASE_TYPE 

The "double" base type.

FLOAT_BASE_TYPE 

The "float" base type.

CHAR16_T_BASE_TYPE 

The "char16_t base type.

CHAR32_T_BASE_TYPE 

The "char32_t" base type.

WCHAR_T_BASE_TYPE 

The "wchar_t" base type.

Definition at line 53 of file abg-ir-priv.h.

◆ modifiers_type

The modifiers of the base types above. Several modifiers can be combined for a given base type. The presence of modifiers is usually modelled by a bitmap of modifiers.

If you add a new modifier, please consider updating functions parse_integral_type_modifier and integral_type::to_string.

Enumerator
SIGNED_MODIFIER 

The "signed" modifier.

UNSIGNED_MODIFIER 

The "unsigned" modier.

SHORT_MODIFIER 

The "short" modifier.

LONG_MODIFIER 

The "long" modifier.

LONG_LONG_MODIFIER 

The "long long" modifier.

Definition at line 79 of file abg-ir-priv.h.

Constructor & Destructor Documentation

◆ integral_type() [1/3]

Default constructor of the integral_type.

Definition at line 16404 of file abg-ir.cc.

◆ integral_type() [2/3]

integral_type ( const string &  type_name)

Constructor of the integral_type.

Parameters
thename of the integral type to parse to initialize the current instance of integral_type.

Definition at line 16422 of file abg-ir.cc.

◆ integral_type() [3/3]

Constructor of the integral_type.

Parameters
bthe base type of the integral type.
mthe modifiers of the integral type.

Definition at line 16414 of file abg-ir.cc.

Member Function Documentation

◆ get_base_type()

integral_type::base_type get_base_type ( ) const

Getter of the base type of the integral_type.

Returns
the base type of the integral_type.

Definition at line 16434 of file abg-ir.cc.

◆ get_modifiers()

integral_type::modifiers_type get_modifiers ( ) const

Getter of the modifiers bitmap of the integral_type.

Returns
the modifiers bitmap of the integral_type.

Definition at line 16441 of file abg-ir.cc.

◆ operator string()

operator string ( ) const

Convert the current instance of integral_type into its string representation.

Returns
the string representation of the current instance of integral_type.

Definition at line 16523 of file abg-ir.cc.

◆ operator==()

bool operator== ( const integral_type other) const

Equality operator for the integral_type.

Parameters
otherthe other integral type to compare against.
Returns
true iff other equals the current instance of integral_type.

Definition at line 16458 of file abg-ir.cc.

◆ set_modifiers()

void set_modifiers ( modifiers_type  m)

Setter of the modifiers bitmap of the integral_type.

Parameters
mthe new modifiers.

Definition at line 16448 of file abg-ir.cc.

◆ to_string()

string to_string ( bool  internal = false) const

Return the string representation of the current instance of integral_type.

Parameters
internalif true the string representation is to be used for internal purposes. In general, it means it's for type canonicalization purposes.
Returns
the string representation of the current instance of integral_type.

Definition at line 16471 of file abg-ir.cc.


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