Class CUnionEntity#
Defined in File union_entity.h
Inheritance Relationships#
Base Types#
public CStructEntity
(Class CStructEntity)public sdv::idl::IUnionEntity
(Struct IUnionEntity)
Class Documentation#
-
class CUnionEntity : public CStructEntity, public sdv::idl::IUnionEntity#
The struct definition of an IDL file.
The struct section of the IDL file contains multiple declarations of members, as well as the definitions of structs and unions.
Public Functions
-
CUnionEntity(const CContextPtr &rptrContext, CEntityPtr ptrParent)#
Default constructor.
- Parameters:
rptrContext – [in] Reference to the smart pointer holding the parse context. Must not be NULL.
ptrParent – [in] Pointer to the parent class holding this entity. This must not be NULL.
-
virtual ~CUnionEntity() override = default#
Destructor.
-
virtual sdv::interface_t GetInterface(sdv::interface_id idInterface) override#
Get access to another interface. Overload of sdv::IInterfaceAccess::GetInterface.
- Parameters:
idInterface – [in] The interface id to get access to.
- Returns:
Returns a pointer to the interface or NULL when the interface is not supported.
-
virtual sdv::idl::IUnionEntity::ESwitchInterpret GetSwitchInterpretation() const override#
Return the switch interpretation. Overload of sdv::idl::IUnionEntity::GetSwitchInterpretation.
- Returns:
The interpretation of the switch case of this union.
-
virtual void GetSwitchType(sdv::idl::EDeclType &reType, sdv::IInterfaceAccess *&rpType) const#
Return type information for the switch case. If the switch case is type base, this is the type information that is used to select. If the switch case is variable based, this is the type of the variable. Overload of sdv::idl::IUnionEntity::GetSwitchType.
- Parameters:
reType – [out] Reference to the declaration type (either enum or an integral type).
rpType – [out] Reference to the type entity if existing.
-
virtual void GetSwitchVar(sdv::u8string &rssVarStr, sdv::IInterfaceAccess *&rpVarEntity, sdv::IInterfaceAccess *&rpVarContainer) const#
Get the switch variable information if the switch case is variable based. Will be empty/NULL when the switch case is type based. Overload of sdv::idl::IUnionEntity::GetSwitchVar.
- Parameters:
rssVarStr – [out] Reference to the string receiving the exact scoped declaration name of the switch variable if the interpretation is variable based. The variable name uses the scope separator ‘::’ to define the common parent definition and the member separator ‘.’ to define the variable declaration as member from the common parent.
rpVarEntity – [out] Reference to the variable entity if the interpretation is variable based.
rpVarContainer – [out] Reference to the variable entity of the container of both the switch variable and the union.
-
inline virtual sdv::idl::EEntityType GetType() const override#
Get the type of the entity. Overload of CEntity::GetType.
- Returns:
Returns the union type.
-
virtual std::string GetDeclTypeStr(bool bResolveTypedef) const override#
Get the declaration type of the entity as string. Overload of CEntity::GetDeclTypeStr.
- Parameters:
bResolveTypedef – [in] When set, resolve the typedef type into the base type.
- Returns:
Returns the declaration type string.
-
virtual void Process() override#
Process the code. Overload of CEntity::Process.
-
virtual void ProcessDefinitionAddendum() override#
Process the definition addendum.
Process the definition addendum following the definition statement before the content definition. The default implementation checks for an inheritance list.
-
void PostProcess()#
Postprocess the switch/case assignments.
-
virtual bool Supports(EDefinitionSupport eSupport) const override#
Request whether the definition supports the content. Overload of CDefintionEntity::Supports.
- Parameters:
eSupport – [in] The type of support that is requested.
- Returns:
Returns ‘true’ when the definition supports the content; ‘false’ otherwise.
-
inline virtual bool SupportsAnonymous() const override#
Does the entity support anonymous naming?
The default implementation is that anonymous naming is not supported.
Returns whether the entity supports inheritance.
- Returns:
Returns whether anonymous naming is supported.
-
virtual void CreateValueNode() override#
Create the content value node. Overload of CDefinitionEntity::CreateValueNode.
Create the value node and assign the value node to the ValueRef() reference..
-
virtual bool RequireDeclaration() const override#
Does the definition require a declaration? Overload of CDefinitionEntity::RequireDeclaration.
- Returns:
Returns whether a declaration is required.
-
virtual bool AllowAutoTransparentDeclaration() const override#
Does the definition allow automatic transparent declaration if not present? Overload of CDefinitionEntity::AllowAutoTransparentDeclaration.
When set an automatic transparent declaration is allowed without an explicit variable declaration. Currently this is only the case with unions with a variable based switch type.
- Returns:
Returns whether the definition allows an automatic transparent declaration.
-
void GetSwitchCaseType(sdv::idl::EDeclType &reType, CEntityPtr &rptrType, CValueNodePtr &rptrValue)#
Get switch case type.
- Parameters:
reType – [out] Reference to the base type of the switch variable.
rptrType – [out] Reference to the type definition of the switch variable. Can be null if the switch uses a basic type.
rptrValue – [out] Reference to the value node of the switch variable. Can be null if the switch is determined by a type.
-
CUnionEntity(const CContextPtr &rptrContext, CEntityPtr ptrParent)#