mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-10 23:08:05 -05:00
parse struct and union sequences
This commit is contained in:
@ -13,6 +13,10 @@ class DeclarationModifier
|
||||
public:
|
||||
DeclarationModifier() = default;
|
||||
virtual ~DeclarationModifier() = default;
|
||||
DeclarationModifier(const DeclarationModifier& other) = default;
|
||||
DeclarationModifier(DeclarationModifier&& other) noexcept = default;
|
||||
DeclarationModifier& operator=(const DeclarationModifier& other) = default;
|
||||
DeclarationModifier& operator=(DeclarationModifier&& other) noexcept = default;
|
||||
|
||||
_NODISCARD virtual DeclarationModifierType GetType() const = 0;
|
||||
};
|
@ -26,7 +26,7 @@ public:
|
||||
const unsigned m_pack;
|
||||
unsigned m_alignment_override;
|
||||
|
||||
std::vector<std::unique_ptr<Variable>> m_members;
|
||||
std::vector<std::shared_ptr<Variable>> m_members;
|
||||
|
||||
DefinitionWithMembers(std::string _namespace, std::string name, unsigned pack);
|
||||
|
||||
|
@ -20,11 +20,11 @@ void TypeDeclaration::CalculateSize()
|
||||
{
|
||||
auto currentSize = m_type->GetSize();
|
||||
|
||||
for(auto i = m_declaration_modifiers.size(); i > 0; i--)
|
||||
for (auto i = m_declaration_modifiers.size(); i > 0; i--)
|
||||
{
|
||||
const auto& declarationModifier = m_declaration_modifiers[i - 1];
|
||||
|
||||
switch(declarationModifier->GetType())
|
||||
|
||||
switch (declarationModifier->GetType())
|
||||
{
|
||||
case DeclarationModifierType::POINTER:
|
||||
currentSize = POINTER_SIZE;
|
||||
|
@ -1,5 +1,13 @@
|
||||
#include "Variable.h"
|
||||
|
||||
Variable::Variable(std::string name, std::unique_ptr<TypeDeclaration> typeDeclaration)
|
||||
: m_name(std::move(name)),
|
||||
m_has_alignment_override(false),
|
||||
m_alignment_override(0),
|
||||
m_type_declaration(std::move(typeDeclaration))
|
||||
{
|
||||
}
|
||||
|
||||
unsigned Variable::GetAlignment()
|
||||
{
|
||||
if (m_has_alignment_override)
|
||||
|
@ -13,6 +13,8 @@ public:
|
||||
unsigned m_alignment_override;
|
||||
std::unique_ptr<TypeDeclaration> m_type_declaration;
|
||||
|
||||
Variable(std::string name, std::unique_ptr<TypeDeclaration> typeDeclaration);
|
||||
|
||||
unsigned GetAlignment();
|
||||
bool GetForceAlignment();
|
||||
};
|
||||
|
Reference in New Issue
Block a user