From b1f95ef1b41510e6989bb99ff75a34619962ee1a Mon Sep 17 00:00:00 2001 From: calcium Date: Mon, 19 Aug 2024 20:01:25 -0400 Subject: [PATCH] Refactored include/ClassFormat.h to use std::any instead of attempting to cast from a base type --- include/ClassFormat.h | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/include/ClassFormat.h b/include/ClassFormat.h index bf2968b..b388af6 100644 --- a/include/ClassFormat.h +++ b/include/ClassFormat.h @@ -2,6 +2,7 @@ #define __JAVA_PARSER_CLASS_FORMAT_H #include +#include #include #include #include @@ -57,30 +58,36 @@ enum class ACCESS_FLAGS }; } // namespace Method -typedef struct +struct attribute_info { u2 attribute_name_index; u4 attribute_length; std::vector info; -} attribute_info; +}; -typedef struct +struct BaseAttribute +{ + u2 attribute_name_index; + u4 attribute_length; +}; + +struct method_info { u2 access_flags; u2 name_index; u2 descriptor_index; u2 attributes_count; std::vector attributes; -} method_info; +}; -typedef struct +struct field_info { u2 access_flags; u2 name_index; u2 descriptor_index; u2 attributes_count; std::vector attributes; -} field_info; +}; struct JavaClassFormat { @@ -88,7 +95,7 @@ struct JavaClassFormat u2 minor; u2 major; u2 constant_pool_count; - std::vector constant_pool; + std::vector constant_pool; u2 access_flags; u2 this_class; u2 super_class;