mirror of
https://github.com/lief-project/LIEF
synced 2026-06-08 15:30:44 +00:00
Re-scope Mach-O enums
This commit is contained in:
@@ -24,35 +24,53 @@
|
||||
|
||||
#include "MachO/pyMachO.hpp"
|
||||
#include "pyIterator.hpp"
|
||||
#include "enums_wrapper.hpp"
|
||||
|
||||
namespace LIEF::MachO::py {
|
||||
|
||||
template<>
|
||||
void create<ExportInfo>(nb::module_& m) {
|
||||
nb::class_<ExportInfo, Object>(m, "ExportInfo",
|
||||
nb::class_<ExportInfo, Object> cls(m, "ExportInfo",
|
||||
R"delim(
|
||||
Class that provides an interface over the Dyld export info
|
||||
|
||||
This class does not represent a structure that exists in the Mach-O format
|
||||
specification but provides a *view* on an entry of the Dyld export trie.
|
||||
)delim"_doc)
|
||||
)delim"_doc);
|
||||
|
||||
enum_<ExportInfo::KIND>(cls, "KIND")
|
||||
#define PY_ENUM(x) to_string(x), x
|
||||
.value(PY_ENUM(ExportInfo::KIND::REGULAR))
|
||||
.value(PY_ENUM(ExportInfo::KIND::THREAD_LOCAL_KIND))
|
||||
.value(PY_ENUM(ExportInfo::KIND::ABSOLUTE_KIND))
|
||||
#undef PY_ENUM
|
||||
;
|
||||
|
||||
enum_<ExportInfo::FLAGS>(cls, "FLAGS", nb::is_arithmetic())
|
||||
#define PY_ENUM(x) to_string(x), x
|
||||
.value(PY_ENUM(ExportInfo::FLAGS::WEAK_DEFINITION))
|
||||
.value(PY_ENUM(ExportInfo::FLAGS::REEXPORT))
|
||||
.value(PY_ENUM(ExportInfo::FLAGS::STUB_AND_RESOLVER))
|
||||
#undef PY_ENUM
|
||||
;
|
||||
|
||||
cls
|
||||
.def_prop_ro("node_offset",
|
||||
nb::overload_cast<>(&ExportInfo::node_offset, nb::const_),
|
||||
"Original offset in the export Trie"_doc)
|
||||
|
||||
.def_prop_ro("kind",
|
||||
nb::overload_cast<>(&ExportInfo::kind, nb::const_),
|
||||
"The export's kind: regular, thread local, absolute, ... (" RST_CLASS_REF(lief.MachO.EXPORT_SYMBOL_KINDS) ")"_doc)
|
||||
"The export's kind: regular, thread local, absolute, ... (" RST_CLASS_REF(lief.MachO.ExportInfo.KIND) ")"_doc)
|
||||
|
||||
.def_prop_ro("flags_list",
|
||||
nb::overload_cast<>(&ExportInfo::flags_list, nb::const_),
|
||||
"Return flags as a list of " RST_CLASS_REF(lief.MachO.EXPORT_SYMBOL_KINDS) ""_doc)
|
||||
"Return flags as a list of " RST_CLASS_REF(lief.MachO.ExportInfo.FLAGS) ""_doc)
|
||||
|
||||
.def_prop_rw("flags",
|
||||
nb::overload_cast<>(&ExportInfo::flags, nb::const_),
|
||||
nb::overload_cast<uint64_t>(&ExportInfo::flags),
|
||||
"Some information (" RST_CLASS_REF(lief.MachO.EXPORT_SYMBOL_FLAGS) ") about the export (like weak export, reexport, ...)"_doc)
|
||||
"Some information (" RST_CLASS_REF(lief.MachO.ExportInfo.FLAGS) ") about the export (like weak export, reexport, ...)"_doc)
|
||||
|
||||
.def_prop_rw("address",
|
||||
nb::overload_cast<>(&ExportInfo::address, nb::const_),
|
||||
@@ -76,7 +94,7 @@ void create<ExportInfo>(nb::module_& m) {
|
||||
|
||||
.def("has",
|
||||
&ExportInfo::has,
|
||||
"Check if the flag " RST_CLASS_REF(lief.MachO.EXPORT_SYMBOL_FLAGS) " given in first parameter is present"_doc,
|
||||
"Check if the flag " RST_CLASS_REF(lief.MachO.ExportInfo.FLAGS) " given in first parameter is present"_doc,
|
||||
"flag"_a)
|
||||
|
||||
.def_prop_ro("symbol",
|
||||
|
||||
Reference in New Issue
Block a user