Class CDefinitionEntity#

Inheritance Relationships#

Base Types#

Derived Types#

Class Documentation#

class CDefinitionEntity : public CEntity, public sdv::idl::IDefinitionEntity#

The base for definition entity definitions within an IDL file (struct, union, exception, interface, enum).

The definition entity definitions all have a similar setup with small differences in detail. Consider the following structures:

struct <name | anonymous> : <inheritance list> { <member list> }
union <name | anonymous> switch(<type>) { <case member list> }
interface <name> : <inheritance list> { <member list> }
exception <name> { <member list> }
enum <name> : <type> { <item list> }
The following generalized structure applies to all complex structures:
keyword name
prefix keyword name postfix { definition }
The first statement is a forward declaration. The second represents the type definition. The prefix is used to provide a specific interpretation to the definition. The keyword defines the type of definition (can be struct, union, interface, exception, enum). The name is the defined name of the definition. For types that allow anonymous names, this part is optionally. The postfix allows the specification of additional information needed for the definition (inheritynce list, switch list). The definition defines the content of the type. Some declarations might start as a type definition (e.g. struct, union, enum) followed with a declaration. For example:
struct <def_name> { <definition> } <decl_name>
struct { <definition> } <decl_name>
In the first statement, the struct is defined and declared in one statement. In the second statement, an anonymous struct is defined and declared in one statement.

Subclassed by CEnumEntity, CInterfaceEntity, CModuleEntity, CStructEntity

Public Functions

CDefinitionEntity(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 ~CDefinitionEntity() override = default#

Destructor.

virtual sdv::interface_t GetInterface(sdv::interface_id idInterface) override#

Get access to another interface. Overload of 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 void ProcessContent()#

Process the content of the definition.

Process the content of the definition. This function parses through the content until a closing curly bracket has been detected. First the function checks for prefixes. Then the function determines whether the statement is a declaration or a definition. It then creates the corresponding entity and let the entity process itself.

virtual void Process() override#

Process the code. Overload of CEntity::Process.

virtual void ProcessDefinitionAddendum()#

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 CreateInheritanceValueChildNodes()#

Create a values for inherited child nodes.

inline virtual bool IsUnnamed() const override#

Does the entity have an Unnamed definition. Overload of IDefinitionEntity::Unnamed.

Returns:

Returns ‘true’ when the definition supports unnamed definition; ‘false’ otherwise.

virtual bool Supports(EDefinitionSupport eSupport) const = 0#

Request whether the definition supports the content. This function must be implemented by the derived entity.

Parameters:

eSupport[in] The type of support that is requested.

Returns:

Returns ‘true’ when the definition supports the content; ‘false’ otherwise.

inline virtual bool SupportsChildren() const override#

Does the entity support children? Overload of CEntity::SupportsChildren.

Complex types support children per default.

Returns:

Returns whether the entity supports children (which is the case).

inline virtual bool SupportsInheritance() const#

Does the entity support inheritance?

The default implementation is that inheritance is not supported.

Returns:

Returns whether the entity supports inheritance (which is not the case).

inline virtual bool SupportsAnonymous() const#

Does the entity support anonymous naming?

The default implementation is that anonymous naming is not supported.

Returns:

Returns whether the entity supports inheritance (which is not the case).

inline virtual bool SupportContentAttributes() const#

Does the complex entity support attributes in its content?

The default implementation doesn’t support attributes (they are specific to interfaces).

Returns:

Returns whether the entity supports attributes (which is not the case).

inline virtual bool SupportContentOperations() const#

Does the complex entity support operations in its content?

The default implementation doesn’t support operations (they are specific to interfaces).

Returns:

Returns whether the entity supports operations (which is not the case).

inline virtual bool RequireContentDefinition() const#

Does the definition entity require a content definition?

In certain cases, it is required that the content definition is following the definition statement. For example, when an inheritance list is provided. The default implementation checks the m_bRequiresContent variable.

Returns:

Returns whether the content definition should be defined following the definition statement.

inline virtual bool RequireDeclaration() const#

Does the definition require a declaration?

In certain cases, it is required that the definition is followed by a declaration. For example, when the definition was made anonymously or when the definition is dependent on a variable within the same struct (e.g. with unions).

Returns:

Returns whether the definition requires a declaration.

inline virtual bool AllowAutoTransparentDeclaration() const#

Does the definition allow automatic transparent declaration if not present?

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.

virtual sdv::idl::IEntityIterator *GetChildren() override#

Get child entity iterator if children are available and supported by the definition. Overload of sdv::idl::IDefinitionEntity::GetChildren.

Returns:

Returns a pointer to the child entity iterator or NULL when not available.

virtual sdv::idl::IEntityIterator *GetInheritance() override#

Get inheritance entity iterator if the definition was inheriting from other entities. Overload of sdv::idl::IDefinitionEntity::GetInheritance.

Returns:

Returns a pointer to the inheritance entity iterator or NULL when not available.

virtual void CalcHash(CHashObject &rHash) const override#

Calculate the hash of this entity and all encapsulated entities. Overload of CBaseEntity::CalcHash.

Parameters:

rHash[inout] Hash object to be filled with data.

const CEntityList GetDeclMembers() const#

Get the declaration members.

Returns:

List of declaration members.

Protected Functions

CDefinitionEntity(CParser &rParser, const CContextPtr &rptrContext)#

Root entity constructor (name is ‘root’ and no parent).

Parameters:
  • rParser[in] Reference to the parser.

  • rptrContext[in] Reference to the smart pointer holding the parse context. Must not be NULL.

virtual void AddChild(CEntityPtr ptrChild) override#

Add the child to the children list. Called by CreateChild function. Overload of CEntity::AddChild.

Parameters:

ptrChild[in] Pointer to the child entity to add.

virtual std::pair<CEntityPtr, bool> FindLocal(const std::string &rssName, bool bDeclaration) const override#

Find the entity locally by looking in the entity children map and the entity children maps of all the chained entities. The search is done case-insensitive. Overload of CEntity::FindLocal.

Parameters:
  • rssName[in] Reference to the string object containing the name of the entity to search for.

  • bDeclaration[in] When set, the name belongs to a declaration; otherwise it belongs to a definition. Needed to allow the reuse of names between declarations and definitions.

Returns:

Returns a pair object containing an entity pointer if the entity exists or a NULL pointer if not as well as a boolean that indicates that the entity was from an inherited entity.

inline virtual void CreateValueNode()#

Create the content value node. Overridable when supporting content values.

When supporting value assignments, create the value node and assign the value node to the ValueRef() reference. For definitions that do not support value assignments, do nothing (default).

Protected Attributes

CEntityVector m_vecInheritance#

List of base entities in the order of appearance.

CEntityList m_lstTypeMembers#

List of typedef member declarations and type definitions.

CEntityList m_lstConstMembers#

List of const member declarations.

CEntityList m_lstDeclMembers#

List of variable member declarations.

CEntityList m_lstAttributesOperation#

List with attributes and operations.

bool m_bRequiresContent = false#

When set, the definition statement requires content to follow.

bool m_bAnonymousDefinition = false#

When set, the entity has an anonymous generated name.

CEntityIterator m_iteratorChildren#

Children iterator.

CEntityIterator m_iteratorInheritance#

Inheritance iterator.