16#ifndef LIEF_OAT_BINARY_H
17#define LIEF_OAT_BINARY_H
45 using dex_files_t = std::vector<std::unique_ptr<DEX::File>>;
46 using it_dex_files = ref_iterator<dex_files_t&, DEX::File*>;
47 using it_const_dex_files = const_ref_iterator<const dex_files_t&, const DEX::File*>;
49 using classes_t = std::unordered_map<std::string, Class*>;
50 using classes_list_t = std::vector<std::unique_ptr<Class>>;
51 using it_classes = ref_iterator<classes_list_t&, Class*>;
52 using it_const_classes = const_ref_iterator<const classes_list_t&, const Class*>;
54 using oat_dex_files_t = std::vector<std::unique_ptr<DexFile>>;
55 using it_oat_dex_files = ref_iterator<oat_dex_files_t&, DexFile*>;
56 using it_const_oat_dex_files = const_ref_iterator<const oat_dex_files_t&, const DexFile*>;
58 using methods_t = std::vector<std::unique_ptr<Method>>;
59 using it_methods = ref_iterator<methods_t&, Method*>;
60 using it_const_methods = const_ref_iterator<const methods_t&, const Method*>;
62 using dex2dex_info_t = std::unordered_map<const DEX::File*, DEX::dex2dex_info_t>;
67 const Header&
header()
const;
79 it_const_classes
classes()
const;
83 bool has_class(
const std::string& class_name)
const;
87 const Class*
get_class(
const std::string& class_name)
const;
93 const Class*
get_class(
size_t index)
const;
99 it_const_methods
methods()
const;
109 return vdex_ !=
nullptr;
112 static bool classof(
const LIEF::Binary* bin) {
113 return bin->
format() == Binary::FORMATS::OAT;
116 void accept(Visitor& visitor)
const override;
124 void add_class(std::unique_ptr<Class> cls);
128 dex_files_t dex_files_;
129 oat_dex_files_t oat_dex_files_;
132 classes_list_t classes_list_;
135 std::unique_ptr<VDEX::File> vdex_;
FORMATS format() const
Executable format (ELF, PE, Mach-O) of the underlying binary.
Definition Abstract/Binary.hpp:109
Class that represents a DEX file.
Definition DEX/File.hpp:39
Definition OAT/Binary.hpp:41
Class * get_class(const std::string &class_name)
it_dex_files dex_files()
Iterator over LIEF::DEX::File.
friend std::ostream & operator<<(std::ostream &os, const Binary &binary)
Binary(const Binary ©)=delete
void accept(Visitor &visitor) const override
Method associated with the visitor pattern.
Class * get_class(size_t index)
dex2dex_info_t dex2dex_info() const
const Class * get_class(size_t index) const
Return the LIEF::OAT::Class at the given index or a nullptr if it does not exist.
bool has_class(const std::string &class_name) const
Check if the current OAT has the given class.
const Class * get_class(const std::string &class_name) const
Return the LIEF::OAT::Class with the given name or a nullptr if the class can't be found.
it_oat_dex_files oat_dex_files()
Iterator over LIEF::OAT::DexFile.
it_const_oat_dex_files oat_dex_files() const
it_const_dex_files dex_files() const
std::string dex2dex_json_info()
it_const_methods methods() const
Iterator over LIEF::OAT::Method.
it_const_classes classes() const
Iterator over LIEF::OAT::Class.
Binary & operator=(const Binary ©)=delete
const Header & header() const
OAT Header.
bool has_vdex() const
Definition OAT/Binary.hpp:108
static bool classof(const LIEF::Binary *bin)
Definition OAT/Binary.hpp:112
Definition OAT/Class.hpp:36
Definition DexFile.hpp:36
Definition OAT/Method.hpp:34
Class to parse an OAT file to produce an OAT::Binary.
Definition OAT/Parser.hpp:38
Main class for the VDEX module which represents a VDEX file.
Definition VDEX/File.hpp:42
Definition DEX/Class.hpp:30
Definition ELF/Parser.hpp:32
Definition OAT/Binary.hpp:31
LIEF namespace.
Definition Abstract/Binary.hpp:36
#define LIEF_API
Definition visibility.h:41