Class CVariableEntity#

Inheritance Relationships#

Base Type#

Derived Type#

Class Documentation#

class CVariableEntity : public CDeclarationEntity#

The variable declaration.

Subclassed by CCaseEntry

Public Functions

CVariableEntity(const CContextPtr &rptrContext, CEntityPtr ptrParent, bool bConst, bool bAnonymous)#

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.

  • bConst[in] When set, the variable is defined as const.

  • bAnonymous[in] When set, the variable is part of a struct and anonymous (unnamed and not declared) so its members are seen as members of the struct. For example, used with unions.

CVariableEntity(const CContextPtr &rptrContext, CEntityPtr ptrParent, const CTokenList &rlstTokenList, bool bConst, bool bAnonymous)#

Constructor using the provided token-list to process the code.

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.

  • rlstTokenList[in] Reference to the token list holding the tokens to process.

  • bConst[in] When set, the variable is defined as const.

  • bAnonymous[in] When set, the variable is part of a struct and anonymous (unnamed and not declared) so its members are seen as members of the struct. For example, used with unions.

virtual ~CVariableEntity() override = default#

Destructor.

inline virtual sdv::idl::EEntityType GetType() const override#

Get the type of the entity. Overload of CEntity::GetType.

Returns:

Returns the entity type.

virtual std::string GetDeclTypeStr(bool bResolveTypedef) const override#

Get the qualified type of the entity. Overload of CEntity::GetDeclTypeStr.

The qualified type consists of “<base type> <type identifier>”.

Attention

To get the qualified type including array sizes, use the GetDeclTypeStr of the CEntityValueNode class.

Parameters:

bResolveTypedef[in] When set, resolve the typedef type into the base type.

Returns:

Returns the type string.

virtual void Process() override#

Process the code. Overload of CEntity::Process.

inline virtual bool SupportAssignments() const override#

Does the entity support assignments? Overload of CDeclarationEntity::SupportAssignments.

Returns:

Returns ‘true’ when the entity supports assignments; ‘false’ otherwise.

inline virtual bool CanSupportComplexTypeAssignments() const override#

Can the entity be used for assignments of complex types? Overload of CDeclarationEntity::CanSupportComplexTypeAssignments.

Returns:

Returns ‘true’ when the entity defined as declaration; ‘false’ otherwise.

inline virtual bool SupportArrays() const override#

Does the entity support arrays? Overload of CDeclarationEntity::SupportArrays.

Returns:

Returns ‘true’ when the entity supports assignments; ‘false’ otherwise.

inline virtual bool IsReadOnly() const override#

Is the entity readonly? Overload of IEntityInfo::IsReadOnly.

Returns:

Returns ‘true’ when the entity defined as readonly; ‘false’ otherwise.

inline virtual bool RequiresAssignment() const override#

Does the entity require an assignment? Overload of CDeclarationEntity::RequiresAssignment.

Returns:

Returns ‘true’ when the entity requires an assignment; ‘false’ otherwise.

inline virtual bool SupportMultipleDeclarations() const override#

Does the entity support multiple declarations on one line of code? Overload of CDeclarationEntity::SupportMultipleDeclarations.

Returns:

Returns ‘true’ when the entity supports multiple declarations; ‘false’ otherwise.

inline virtual bool IsAnonymous() const override#

Is the entity anonymous when used in a struct/union (unnamed and not declared)? Overload of IDeclarationEntity::IsAnonymous.

Returns:

Returns ‘true’ when the entity is anonymous; ‘false’ otherwise.

inline void UseAsSwitchVariable()#

Enable the variable to be used in a union switch.

Protected Functions

inline void SetAnonymous()#

Set the variable as anonymous variable (unnamed and not declared).

inline virtual bool SupportInterface() const override#

Does the entity support an interface as base type (non-const variables, operations and parameters do)?

Returns whether the entity supports the an interface as base type base type. Default value is ‘false’.

Returns:

Returns ‘true’ when the entity supports interfaces as base type; ‘false’ otherwise.