Refactored include/ClassFormat.h to use std::any instead of attempting to cast from a base type

This commit is contained in:
calcium 2024-08-19 20:01:25 -04:00
parent 8ee4302862
commit b1f95ef1b4

View File

@ -2,6 +2,7 @@
#define __JAVA_PARSER_CLASS_FORMAT_H
#include <SpecTypes.h>
#include <any>
#include <cstdlib>
#include <vector>
#include <ConstantPoolTags/Tags.h>
@ -57,30 +58,36 @@ enum class ACCESS_FLAGS
};
} // namespace Method
typedef struct
struct attribute_info
{
u2 attribute_name_index;
u4 attribute_length;
std::vector<u1> 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<attribute_info> attributes;
} method_info;
};
typedef struct
struct field_info
{
u2 access_flags;
u2 name_index;
u2 descriptor_index;
u2 attributes_count;
std::vector<attribute_info> attributes;
} field_info;
};
struct JavaClassFormat
{
@ -88,7 +95,7 @@ struct JavaClassFormat
u2 minor;
u2 major;
u2 constant_pool_count;
std::vector<ConstantPoolTags::ConstantPool> constant_pool;
std::vector<std::any> constant_pool;
u2 access_flags;
u2 this_class;
u2 super_class;