mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-11-08 17:51:58 +00:00
chore: update ZoneCodeGenerator code style
This commit is contained in:
135 files changed
+4406
-4299
No files matched your search
@@ -2,13 +2,16 @@
|
||||
|
||||
#include "DeclarationModifier.h"
|
||||
#include "Domain/Evaluation/IEvaluation.h"
|
||||
#include "Utils/ClassUtils.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
class ArrayDeclarationModifier final : public DeclarationModifier
|
||||
{
|
||||
public:
|
||||
explicit ArrayDeclarationModifier(int size);
|
||||
|
||||
[[nodiscard]] DeclarationModifierType GetType() const override;
|
||||
|
||||
int m_size;
|
||||
|
||||
/**
|
||||
@@ -20,8 +23,4 @@ public:
|
||||
* \brief The array has a size that is given by \c m_size but only a certain dynamic amount is handled by generated count.
|
||||
*/
|
||||
std::unique_ptr<IEvaluation> m_dynamic_count_evaluation;
|
||||
|
||||
explicit ArrayDeclarationModifier(int size);
|
||||
|
||||
_NODISCARD DeclarationModifierType GetType() const override;
|
||||
};
|
||||
@@ -4,17 +4,6 @@
|
||||
class BaseTypeDefinition final : public DataDefinition
|
||||
{
|
||||
public:
|
||||
const unsigned m_size;
|
||||
|
||||
private:
|
||||
BaseTypeDefinition(std::string name, unsigned size);
|
||||
|
||||
public:
|
||||
_NODISCARD DataDefinitionType GetType() const override;
|
||||
_NODISCARD unsigned GetAlignment() const override;
|
||||
_NODISCARD bool GetForceAlignment() const override;
|
||||
_NODISCARD unsigned GetSize() const override;
|
||||
|
||||
static const BaseTypeDefinition* const FLOAT;
|
||||
static const BaseTypeDefinition* const DOUBLE;
|
||||
static const BaseTypeDefinition* const BOOL;
|
||||
@@ -32,4 +21,14 @@ public:
|
||||
|
||||
static const BaseTypeDefinition* const ALL_BASE_TYPES[];
|
||||
static const size_t ALL_BASE_TYPES_COUNT;
|
||||
|
||||
[[nodiscard]] DataDefinitionType GetType() const override;
|
||||
[[nodiscard]] unsigned GetAlignment() const override;
|
||||
[[nodiscard]] bool GetForceAlignment() const override;
|
||||
[[nodiscard]] unsigned GetSize() const override;
|
||||
|
||||
const unsigned m_size;
|
||||
|
||||
private:
|
||||
BaseTypeDefinition(std::string name, unsigned size);
|
||||
};
|
||||
@@ -25,13 +25,13 @@ public:
|
||||
DataDefinition& operator=(const DataDefinition& other) = default;
|
||||
DataDefinition& operator=(DataDefinition&& other) noexcept = default;
|
||||
|
||||
[[nodiscard]] virtual DataDefinitionType GetType() const = 0;
|
||||
[[nodiscard]] virtual unsigned GetAlignment() const = 0;
|
||||
[[nodiscard]] virtual bool GetForceAlignment() const = 0;
|
||||
[[nodiscard]] virtual unsigned GetSize() const = 0;
|
||||
|
||||
[[nodiscard]] std::string GetFullName() const;
|
||||
|
||||
std::string m_namespace;
|
||||
std::string m_name;
|
||||
|
||||
_NODISCARD virtual DataDefinitionType GetType() const = 0;
|
||||
_NODISCARD virtual unsigned GetAlignment() const = 0;
|
||||
_NODISCARD virtual bool GetForceAlignment() const = 0;
|
||||
_NODISCARD virtual unsigned GetSize() const = 0;
|
||||
|
||||
_NODISCARD std::string GetFullName() const;
|
||||
};
|
||||
@@ -18,5 +18,5 @@ public:
|
||||
DeclarationModifier& operator=(const DeclarationModifier& other) = default;
|
||||
DeclarationModifier& operator=(DeclarationModifier&& other) noexcept = default;
|
||||
|
||||
_NODISCARD virtual DeclarationModifierType GetType() const = 0;
|
||||
[[nodiscard]] virtual DeclarationModifierType GetType() const = 0;
|
||||
};
|
||||
@@ -14,26 +14,6 @@ DefinitionWithMembers::DefinitionWithMembers(std::string _namespace, std::string
|
||||
{
|
||||
}
|
||||
|
||||
// void DefinitionWithMembers::CalculateAlignment()
|
||||
//{
|
||||
// if (m_has_alignment_override)
|
||||
// {
|
||||
// m_flags |= FLAG_ALIGNMENT_FORCED;
|
||||
// m_alignment = m_alignment_override;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// m_alignment = 0;
|
||||
// for (const auto& member : m_members)
|
||||
// {
|
||||
// const auto memberAlignment = member->GetAlignment();
|
||||
// if (memberAlignment > m_alignment)
|
||||
// m_alignment = memberAlignment;
|
||||
// }
|
||||
// }
|
||||
// m_flags |= FLAG_ALIGNMENT_CALCULATED;
|
||||
// }
|
||||
|
||||
unsigned DefinitionWithMembers::GetAlignment() const
|
||||
{
|
||||
assert(m_flags & FLAG_FIELDS_CALCULATED);
|
||||
|
||||
@@ -13,6 +13,12 @@ public:
|
||||
static constexpr int FLAG_FIELDS_CALCULATING = 1 << 1;
|
||||
static constexpr int FLAG_ALIGNMENT_FORCED = 1 << 2;
|
||||
|
||||
DefinitionWithMembers(std::string _namespace, std::string name, unsigned pack);
|
||||
|
||||
[[nodiscard]] unsigned GetAlignment() const override;
|
||||
[[nodiscard]] bool GetForceAlignment() const override;
|
||||
[[nodiscard]] unsigned GetSize() const override;
|
||||
|
||||
unsigned m_flags;
|
||||
unsigned m_size;
|
||||
unsigned m_alignment;
|
||||
@@ -24,10 +30,4 @@ public:
|
||||
unsigned m_alignment_override;
|
||||
|
||||
std::vector<std::shared_ptr<Variable>> m_members;
|
||||
|
||||
DefinitionWithMembers(std::string _namespace, std::string name, unsigned pack);
|
||||
|
||||
_NODISCARD unsigned GetAlignment() const override;
|
||||
_NODISCARD bool GetForceAlignment() const override;
|
||||
_NODISCARD unsigned GetSize() const override;
|
||||
};
|
||||
@@ -10,15 +10,15 @@
|
||||
class EnumDefinition final : public DataDefinition
|
||||
{
|
||||
public:
|
||||
const BaseTypeDefinition* m_parent_type;
|
||||
std::vector<std::unique_ptr<EnumMember>> m_members;
|
||||
|
||||
EnumDefinition(std::string _namespace, std::string name, const BaseTypeDefinition* parentType);
|
||||
|
||||
_NODISCARD DataDefinitionType GetType() const override;
|
||||
_NODISCARD unsigned GetAlignment() const override;
|
||||
_NODISCARD bool GetForceAlignment() const override;
|
||||
_NODISCARD unsigned GetSize() const override;
|
||||
[[nodiscard]] DataDefinitionType GetType() const override;
|
||||
[[nodiscard]] unsigned GetAlignment() const override;
|
||||
[[nodiscard]] bool GetForceAlignment() const override;
|
||||
[[nodiscard]] unsigned GetSize() const override;
|
||||
|
||||
void AddEnumMember(EnumMember enumMember);
|
||||
|
||||
const BaseTypeDefinition* m_parent_type;
|
||||
std::vector<std::unique_ptr<EnumMember>> m_members;
|
||||
};
|
||||
@@ -5,9 +5,9 @@
|
||||
class EnumMember
|
||||
{
|
||||
public:
|
||||
std::string m_name;
|
||||
int m_value;
|
||||
|
||||
EnumMember();
|
||||
EnumMember(std::string name, int value);
|
||||
|
||||
std::string m_name;
|
||||
int m_value;
|
||||
};
|
||||
@@ -5,13 +5,13 @@
|
||||
class ForwardDeclaration final : public DataDefinition
|
||||
{
|
||||
public:
|
||||
const DataDefinitionType m_forwarded_type;
|
||||
const DataDefinition* m_definition;
|
||||
|
||||
ForwardDeclaration(std::string _namespace, std::string name, DataDefinitionType type);
|
||||
|
||||
_NODISCARD DataDefinitionType GetType() const override;
|
||||
_NODISCARD unsigned GetAlignment() const override;
|
||||
_NODISCARD bool GetForceAlignment() const override;
|
||||
_NODISCARD unsigned GetSize() const override;
|
||||
[[nodiscard]] DataDefinitionType GetType() const override;
|
||||
[[nodiscard]] unsigned GetAlignment() const override;
|
||||
[[nodiscard]] bool GetForceAlignment() const override;
|
||||
[[nodiscard]] unsigned GetSize() const override;
|
||||
|
||||
const DataDefinitionType m_forwarded_type;
|
||||
const DataDefinition* m_definition;
|
||||
};
|
||||
@@ -8,19 +8,19 @@
|
||||
|
||||
class PointerDeclarationModifier final : public DeclarationModifier
|
||||
{
|
||||
static const IEvaluation* const DEFAULT_COUNT;
|
||||
|
||||
static bool EvaluationIsArray(const IEvaluation* evaluation);
|
||||
|
||||
public:
|
||||
[[nodiscard]] DeclarationModifierType GetType() const override;
|
||||
[[nodiscard]] const IEvaluation* GetCountEvaluation() const;
|
||||
[[nodiscard]] const IEvaluation* GetCountEvaluationForArrayIndex(int index);
|
||||
|
||||
[[nodiscard]] bool CountEvaluationIsArray() const;
|
||||
[[nodiscard]] bool CountEvaluationIsArray(int index) const;
|
||||
[[nodiscard]] bool AnyCountEvaluationIsArray() const;
|
||||
|
||||
std::unique_ptr<IEvaluation> m_count_evaluation;
|
||||
std::vector<std::unique_ptr<IEvaluation>> m_count_evaluation_by_array_index;
|
||||
|
||||
_NODISCARD DeclarationModifierType GetType() const override;
|
||||
_NODISCARD const IEvaluation* GetCountEvaluation() const;
|
||||
_NODISCARD const IEvaluation* GetCountEvaluationForArrayIndex(int index);
|
||||
|
||||
_NODISCARD bool CountEvaluationIsArray() const;
|
||||
_NODISCARD bool CountEvaluationIsArray(int index) const;
|
||||
_NODISCARD bool AnyCountEvaluationIsArray() const;
|
||||
private:
|
||||
static const IEvaluation* const DEFAULT_COUNT;
|
||||
static bool EvaluationIsArray(const IEvaluation* evaluation);
|
||||
};
|
||||
@@ -7,5 +7,5 @@ class StructDefinition final : public DefinitionWithMembers
|
||||
public:
|
||||
StructDefinition(std::string _namespace, std::string name, int pack);
|
||||
|
||||
_NODISCARD DataDefinitionType GetType() const override;
|
||||
[[nodiscard]] DataDefinitionType GetType() const override;
|
||||
};
|
||||
@@ -13,21 +13,21 @@ public:
|
||||
static constexpr int FLAG_FIELDS_CALCULATED = 1 << 0;
|
||||
static constexpr int FLAG_ALIGNMENT_FORCED = 1 << 1;
|
||||
|
||||
unsigned m_flags;
|
||||
unsigned m_size;
|
||||
unsigned m_alignment;
|
||||
|
||||
explicit TypeDeclaration(const DataDefinition* type);
|
||||
|
||||
[[nodiscard]] unsigned GetSize() const;
|
||||
[[nodiscard]] unsigned GetAlignment() const;
|
||||
[[nodiscard]] bool GetForceAlignment() const;
|
||||
|
||||
std::vector<std::unique_ptr<DeclarationModifier>> m_declaration_modifiers;
|
||||
|
||||
bool m_is_const;
|
||||
bool m_has_custom_bit_size;
|
||||
|
||||
const DataDefinition* m_type;
|
||||
unsigned m_custom_bit_size;
|
||||
|
||||
std::vector<std::unique_ptr<DeclarationModifier>> m_declaration_modifiers;
|
||||
|
||||
_NODISCARD unsigned GetSize() const;
|
||||
_NODISCARD unsigned GetAlignment() const;
|
||||
_NODISCARD bool GetForceAlignment() const;
|
||||
unsigned m_flags;
|
||||
unsigned m_size;
|
||||
unsigned m_alignment;
|
||||
};
|
||||
@@ -6,14 +6,14 @@
|
||||
class TypedefDefinition final : public DataDefinition
|
||||
{
|
||||
public:
|
||||
TypedefDefinition(std::string _namespace, std::string name, std::unique_ptr<TypeDeclaration> typeDeclaration);
|
||||
|
||||
[[nodiscard]] DataDefinitionType GetType() const override;
|
||||
[[nodiscard]] unsigned GetAlignment() const override;
|
||||
[[nodiscard]] bool GetForceAlignment() const override;
|
||||
[[nodiscard]] unsigned GetSize() const override;
|
||||
|
||||
bool m_has_alignment_override;
|
||||
unsigned m_alignment_override;
|
||||
std::unique_ptr<TypeDeclaration> m_type_declaration;
|
||||
|
||||
TypedefDefinition(std::string _namespace, std::string name, std::unique_ptr<TypeDeclaration> typeDeclaration);
|
||||
|
||||
_NODISCARD DataDefinitionType GetType() const override;
|
||||
_NODISCARD unsigned GetAlignment() const override;
|
||||
_NODISCARD bool GetForceAlignment() const override;
|
||||
_NODISCARD unsigned GetSize() const override;
|
||||
};
|
||||
@@ -4,11 +4,8 @@
|
||||
|
||||
class UnionDefinition final : public DefinitionWithMembers
|
||||
{
|
||||
// protected:
|
||||
// void CalculateSize() override;
|
||||
|
||||
public:
|
||||
UnionDefinition(std::string _namespace, std::string name, int pack);
|
||||
|
||||
_NODISCARD DataDefinitionType GetType() const override;
|
||||
[[nodiscard]] DataDefinitionType GetType() const override;
|
||||
};
|
||||
@@ -9,14 +9,14 @@
|
||||
class Variable
|
||||
{
|
||||
public:
|
||||
Variable(std::string name, std::unique_ptr<TypeDeclaration> typeDeclaration);
|
||||
|
||||
[[nodiscard]] unsigned GetAlignment() const;
|
||||
[[nodiscard]] bool GetForceAlignment() const;
|
||||
|
||||
std::string m_name;
|
||||
bool m_has_alignment_override;
|
||||
unsigned m_alignment_override;
|
||||
unsigned m_offset;
|
||||
std::unique_ptr<TypeDeclaration> m_type_declaration;
|
||||
|
||||
Variable(std::string name, std::unique_ptr<TypeDeclaration> typeDeclaration);
|
||||
|
||||
_NODISCARD unsigned GetAlignment() const;
|
||||
_NODISCARD bool GetForceAlignment() const;
|
||||
};
|
||||
Reference in new issue
Block a user