#include "struct_entity.h" #include "../exception.h" #include "../logger.h" #include "typedef_entity.h" #include "variable_entity.h" #include CStructEntity::CStructEntity(const CContextPtr& rptrContext, CEntityPtr ptrParent) : CDefinitionEntity(rptrContext, ptrParent) {} std::string CStructEntity::GetDeclTypeStr(bool /*bResolveTypedef*/) const { return std::string("struct ") + GetScopedName(); } void CStructEntity::Process() { // The definition and declaration can be defined: // struct ; --> forward declaration // struct {...}; --> struct definition // struct : {...}; --> struct definition with inheritance // ; --> struct variable declaration // = {...}; --> struct variable declaration and assignment // struct ; --> struct variable declaration // struct = {...}; --> struct variable declaration and assignment // struct {...} ; --> struct definition and variable declaration // struct : {...} ; --> struct definition with inheritance and variable declaration // struct {...} = {...}; --> struct definition, variable declaration and assignment // struct : {...} = {...}; --> struct definition with inheritance, variable declaration and assignment // struct {...} ; --> anonymous struct definition and variable declaration // struct : {...} ; --> anonymous struct definition with inheritance and variable declaration // struct {...} = {...}; --> anonymous struct definition, variable declaration and assignment // struct : {...} = {...}; --> anonymous struct definition with inheritance, variable declaration and assignment // typedef ; // typedef struct { ... } ; // typedef ; // typedef struct { ... } ; // typedef struct { ... } ; // const struct = {...}; // const = {...}; // const struct {...} = {...}; // The declaration is as follows: // ; // struct ; // struct { ... } ; CDefinitionEntity::Process(); } bool CStructEntity::Supports(EDefinitionSupport eSupport) const { switch (eSupport) { case EDefinitionSupport::support_variable: return true; case EDefinitionSupport::support_const_variable: return true; case EDefinitionSupport::support_typedef: return true; case EDefinitionSupport::support_struct: return true; case EDefinitionSupport::support_union: return true; case EDefinitionSupport::support_enum: return true; default: return false; } } void CStructEntity::CreateValueNode() { // Create a compound type value node for this definition. ValueRef() = std::make_shared(shared_from_this(), nullptr); }