9#ifndef KUNAI_DEX_PARSER_ANNOTATIONS_HPP
10#define KUNAI_DEX_PARSER_ANNOTATIONS_HPP
12#include "Kunai/Utils/kunaistream.hpp"
13#include "Kunai/DEX/parser/fields.hpp"
14#include "Kunai/DEX/parser/methods.hpp"
18#include <unordered_map>
28 std::uint32_t method_idx;
30 std::uint32_t annotations_off;
36 : method_idx(method_idx), annotations_off(annotations_off)
53 return annotations_off;
57 using parameterannotation_t = std::unique_ptr<ParameterAnnotation>;
63 std::uint32_t method_idx;
65 std::uint32_t annotations_off;
71 : method_idx(method_idx), annotations_off(annotations_off)
86 return annotations_off;
90 using methodannotation_t = std::unique_ptr<MethodAnnotation>;
96 std::uint32_t field_idx;
98 std::uint32_t annotations_off;
105 : field_idx(field_idx), annotations_off(annotations_off)
122 return annotations_off;
126 using fieldannotation_t = std::unique_ptr<FieldAnnotation>;
132 std::uint32_t class_annotations_off;
134 std::vector<fieldannotation_t> field_annotations;
136 std::unordered_map<std::uint32_t, FieldAnnotation*> field_annotations_by_id;
138 std::vector<methodannotation_t> method_annotations;
140 std::unordered_map<std::uint32_t, MethodAnnotation*> method_annotations_by_id;
142 std::vector<parameterannotation_t> parameter_annotations;
144 std::unordered_map<std::uint32_t, ParameterAnnotation*> parameter_annotations_by_id;
159 return field_annotations;
167 return field_annotations;
180 return method_annotations;
188 return method_annotations;
201 return parameter_annotations;
209 return parameter_annotations;
Class with all the previos annotations.
Definition annotations.hpp:130
std::vector< methodannotation_t > & get_method_annotations()
Get a reference to all method annotations from the annotation directory.
Definition annotations.hpp:186
AnnotationDirectoryItem()=default
Constructor of AnnotationDirectoryItem.
std::vector< fieldannotation_t > & get_field_annotations()
Get a reference to all the field annotations from the annotation directory.
Definition annotations.hpp:165
MethodAnnotation * get_method_annotation_by_id(std::uint32_t idx)
Get a pointer to method annotation.
const std::vector< fieldannotation_t > & get_field_annotations() const
Get a constant reference to all the field annotations from the annotation directory.
Definition annotations.hpp:157
~AnnotationDirectoryItem()=default
Destructor of AnnotationDirectoryItem.
FieldAnnotation * get_field_annotation_by_id(std::uint32_t idx)
Get a pointer to a field annotation.
void parse_annotation_directory_item(stream::KunaiStream *stream)
Parse the annotation directory item.
std::vector< parameterannotation_t > & get_parameter_annotations()
Get a reference to all the parameter annotations from the annotation directory.
Definition annotations.hpp:207
ParameterAnnotation * get_parameter_annotation_by_id(std::uint32_t idx)
Get a pointer to a parameter annotation.
const std::vector< parameterannotation_t > & get_parameter_annotations() const
Get a constant reference to all the parameter annotations from the annotation directory.
Definition annotations.hpp:199
const std::vector< methodannotation_t > & get_method_annotations() const
Get a constant reference to all method annotations from the annotation directory.
Definition annotations.hpp:178
Information for the list of annotations for the fields.
Definition annotations.hpp:94
~FieldAnnotation()=default
Destructor of FieldAnnotation.
std::uint32_t get_field_idx() const
Get the field idx of the annotation.
Definition annotations.hpp:113
std::uint32_t get_annotations_off() const
Get the offset of the annotation.
Definition annotations.hpp:120
FieldAnnotation(std::uint32_t field_idx, std::uint32_t annotations_off)
Constructor of FieldAnnotation.
Definition annotations.hpp:104
Information for the list of annotations for the methods.
Definition annotations.hpp:61
MethodAnnotation(std::uint32_t method_idx, std::uint32_t annotations_off)
Constructor of MethodAnnotations.
Definition annotations.hpp:70
std::uint32_t get_annotations_off() const
Obtain the offset of the annotations.
Definition annotations.hpp:84
std::uint32_t get_method_idx() const
Obtain the method idx of the current method annotation.
Definition annotations.hpp:78
~MethodAnnotation()=default
Destructor of the method annotations.
Information for the list of annotations for the parameters.
Definition annotations.hpp:26
~ParameterAnnotation()=default
Destructor of ParameterAnnotation.
ParameterAnnotation(std::uint32_t method_idx, std::uint32_t annotations_off)
Constructor of ParameterAnnotation.
Definition annotations.hpp:35
std::uint32_t get_annotations_off() const
Get the offset to the annotations.
Definition annotations.hpp:51
std::uint32_t get_method_idx() const
Get the MethodIDX value.
Definition annotations.hpp:44
Class to manage an input file stream given for the analysis.
Definition kunaistream.hpp:20
utilities
Definition analysis.hpp:23