IDL compiler front-end library
Public Member Functions | List of all members
AST::Union Class Reference

union definition. More...

#include <Union.h>

Inheritance diagram for AST::Union:
AST::ItemWithId AST::ContainerT< UnionElement > AST::ForwardDeclarable AST::NamedItem AST::Item AST::Location

Public Member Functions

const Typediscriminator_type () const noexcept
 
const Variantdefault_label () const noexcept
 
const UnionElementdefault_element () const noexcept
 
 operator const StructBase & () const noexcept
 
- Public Member Functions inherited from AST::ItemWithId
std::string repository_id () const
 
- Public Member Functions inherited from AST::NamedItem
const Identifiername () const noexcept
 
const ItemScopeparent () const noexcept
 
std::string qualified_name () const
 
ScopedName scoped_name () const
 
const Symbolsparent_scope () const noexcept
 
- Public Member Functions inherited from AST::Item
Kind kind () const noexcept
 
bool is_type () const noexcept
 
bool is_forward_decl () const noexcept
 
- Public Member Functions inherited from AST::Location
const std::filesystem::path & file () const noexcept
 
unsigned line () const noexcept
 
- Public Member Functions inherited from AST::ForwardDeclarable
bool has_forward_dcl () const
 

Additional Inherited Members

- Public Types inherited from AST::Item
enum class  Kind {
  ROOT , INCLUDE , NATIVE , TYPE_DEF ,
  CONSTANT , MODULE , MODULE_ITEMS , INTERFACE_DECL ,
  INTERFACE , OPERATION , PARAMETER , ATTRIBUTE ,
  EXCEPTION , STRUCT_DECL , STRUCT , MEMBER ,
  UNION_DECL , UNION , UNION_ELEMENT , ENUM ,
  ENUM_ITEM , VALUE_TYPE_DECL , VALUE_TYPE , VALUE_BOX ,
  STATE_MEMBER , VALUE_FACTORY
}
 The kind of item. More...
 
- Static Public Member Functions inherited from AST::ItemWithId
static const ItemWithIdcast (const NamedItem *item) noexcept
 

Detailed Description

union definition.

Invariant
kind () == Item::Kind::UNION
Examples
Printer.cpp.

Definition at line 71 of file Union.h.

Member Function Documentation

◆ discriminator_type()

const Type& AST::Union::discriminator_type ( ) const
inlinenoexcept
Returns
The discriminator type.

Definition at line 78 of file Union.h.

◆ default_label()

const Variant& AST::Union::default_label ( ) const
inlinenoexcept
Returns
Default discriminator value.

Default label is different from the all declared labels. If no such value exists, the returned variant will be empty. If union has the default label, default_label is always non empty.

Definition at line 88 of file Union.h.

◆ default_element()

const UnionElement* AST::Union::default_element ( ) const
inlinenoexcept
Returns
UnionElement for default label. If union does not have default label, returns nullptr.

Definition at line 95 of file Union.h.

◆ operator const StructBase &()

AST::Union::operator const StructBase & ( ) const
inlinenoexcept

For convenience, the Union may be casted to const StructBase.

Returns
const StructBase&

Definition at line 103 of file Union.h.


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