Skip to content

Commit a4c69f7

Browse files
committed
Rename getter from get_XXX to XXX
related to #66
1 parent d18074c commit a4c69f7

File tree

21 files changed

+144
-144
lines changed

21 files changed

+144
-144
lines changed

api/c/PE/Section.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace LIEF {
1919
namespace PE {
2020
void init_c_sections(Pe_Binary_t* c_binary, Binary* binary) {
2121

22-
it_sections sections = binary->get_sections();
22+
it_sections sections = binary->sections();
2323

2424
c_binary->sections = static_cast<Pe_Section_t**>(
2525
malloc((sections.size() + 1) * sizeof(Pe_Section_t**)));

api/python/Abstract/objects/pyBinary.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ void init_LIEF_Binary_class(py::module& m) {
5454
"Binary's name")
5555

5656
.def_property_readonly("header",
57-
&Binary::get_header,
57+
&Binary::header,
5858
"Binary's header")
5959

6060
.def_property_readonly("entrypoint",
6161
&Binary::entrypoint,
6262
"Binary's entrypoint")
6363

6464
.def_property_readonly("sections",
65-
static_cast<it_t<it_sections>>(&Binary::get_sections),
65+
static_cast<it_t<it_sections>>(&Binary::sections),
6666
"Return a list in **read only** of binary's abstract " RST_CLASS_REF(lief.Section) "",
6767
py::return_value_policy::reference_internal)
6868

@@ -73,7 +73,7 @@ void init_LIEF_Binary_class(py::module& m) {
7373

7474
.def_property_readonly("exported_functions",
7575
[] (const Binary& binary) {
76-
const std::vector<std::string>& exported_functions = binary.get_exported_functions();
76+
const std::vector<std::string>& exported_functions = binary.exported_functions();
7777
std::vector<py::object> exported_functions_encoded;
7878
exported_functions_encoded.reserve(exported_functions.size());
7979

@@ -89,7 +89,7 @@ void init_LIEF_Binary_class(py::module& m) {
8989

9090
.def_property_readonly("imported_functions",
9191
[] (const Binary& binary) {
92-
const std::vector<std::string>& imported_functions = binary.get_imported_functions();
92+
const std::vector<std::string>& imported_functions = binary.imported_functions();
9393
std::vector<py::object> imported_functions_encoded;
9494
imported_functions_encoded.reserve(imported_functions.size());
9595

@@ -104,7 +104,7 @@ void init_LIEF_Binary_class(py::module& m) {
104104

105105
.def_property_readonly("libraries",
106106
[] (const Binary& binary) {
107-
const std::vector<std::string>& imported_libraries = binary.get_imported_libraries();
107+
const std::vector<std::string>& imported_libraries = binary.imported_libraries();
108108
std::vector<py::object> imported_libraries_encoded;
109109
imported_libraries_encoded.reserve(imported_libraries.size());
110110

@@ -118,7 +118,7 @@ void init_LIEF_Binary_class(py::module& m) {
118118
"Return binary's imported libraries (name)")
119119

120120
.def_property_readonly("symbols",
121-
static_cast<it_t<it_symbols>>(&Binary::get_symbols),
121+
static_cast<it_t<it_symbols>>(&Binary::symbols),
122122
"Return a list in **read only** of binary's abstract " RST_CLASS_REF(lief.Symbol) "",
123123
py::return_value_policy::reference_internal)
124124

api/python/MachO/objects/pyBinary.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@ void init_MachO_Binary_class(py::module& m) {
7272
py::return_value_policy::reference)
7373

7474
.def_property_readonly("imported_symbols",
75-
static_cast<no_const_getter<it_imported_symbols>>(&Binary::get_imported_symbols),
75+
static_cast<no_const_getter<it_imported_symbols>>(&Binary::imported_symbols),
7676
"Return binary's " RST_CLASS_REF(lief.MachO.Symbol) " which are imported",
7777
py::return_value_policy::reference_internal)
7878

7979
.def_property_readonly("exported_symbols",
80-
static_cast<no_const_getter<it_exported_symbols>>(&Binary::get_exported_symbols),
80+
static_cast<no_const_getter<it_exported_symbols>>(&Binary::exported_symbols),
8181
"Return binary's " RST_CLASS_REF(lief.MachO.Symbol) " which are exported",
8282
py::return_value_policy::reference_internal)
8383

api/python/PE/objects/pyBinary.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void init_PE_Binary_class(py::module& m) {
3838
.def(py::init<const std::string &, PE_TYPE>())
3939

4040
.def_property_readonly("sections",
41-
static_cast<no_const_getter<it_sections>>(&Binary::get_sections),
41+
static_cast<no_const_getter<it_sections>>(&Binary::sections),
4242
"Return binary's " RST_CLASS_REF(lief.PE.Section) " sections",
4343
py::return_value_policy::reference)
4444

@@ -58,12 +58,12 @@ void init_PE_Binary_class(py::module& m) {
5858
py::return_value_policy::reference)
5959

6060
.def_property_readonly("virtual_size",
61-
&Binary::get_virtual_size,
61+
&Binary::virtual_size,
6262
"Binary size when mapped in memory.\n\n"
6363
"This value should matches :attr:`~lief.PE.OptionalHeader.sizeof_image`")
6464

6565
.def_property_readonly("sizeof_headers",
66-
&Binary::get_sizeof_headers,
66+
&Binary::sizeof_headers,
6767
"Size of all PE headers")
6868

6969
.def("rva_to_offset",
@@ -141,7 +141,7 @@ void init_PE_Binary_class(py::module& m) {
141141

142142

143143
.def_property_readonly("debug",
144-
static_cast<Debug& (Binary::*)(void)>(&Binary::get_debug),
144+
static_cast<Debug& (Binary::*)(void)>(&Binary::debug),
145145
"Return the " RST_CLASS_REF(lief.PE.Debug) " object",
146146
py::return_value_policy::reference)
147147

@@ -212,11 +212,11 @@ void init_PE_Binary_class(py::module& m) {
212212
py::return_value_policy::reference)
213213

214214
.def_property_readonly("resources_manager",
215-
static_cast<no_const_getter<ResourcesManager>>(&Binary::get_resources_manager),
215+
static_cast<no_const_getter<ResourcesManager>>(&Binary::resources_manager),
216216
"Return the " RST_CLASS_REF(lief.PE.ResourcesManager) " to manage resources")
217217

218218
.def_property_readonly("resources",
219-
static_cast<no_const_getter<ResourceNode&>>(&Binary::get_resources),
219+
static_cast<no_const_getter<ResourceNode&>>(&Binary::resources),
220220
"Return the " RST_CLASS_REF(lief.PE.ResourceNode) " tree",
221221
py::return_value_policy::reference)
222222

examples/cpp/abstract_reader.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -29,30 +29,30 @@ int main(int argc, char **argv) {
2929
std::unique_ptr<const LIEF::Binary> binary{LIEF::Parser::parse(argv[1])};
3030

3131
std::cout << "== Header ==" << std::endl;
32-
std::cout << binary->get_header() << std::endl;
32+
std::cout << binary->header() << std::endl;
3333

3434
std::cout << "== Sections ==" << std::endl;
35-
for (const LIEF::Section& s : binary->get_sections()) {
35+
for (const LIEF::Section& s : binary->sections()) {
3636
std::cout << s << std::endl;
3737
}
3838

3939
std::cout << "== Symbols ==" << std::endl;
40-
for (const LIEF::Symbol& s : binary->get_symbols()) {
40+
for (const LIEF::Symbol& s : binary->symbols()) {
4141
std::cout << s << std::endl;
4242
}
4343

4444
std::cout << "== Exported functions ==" << std::endl;
45-
for(const std::string& name : binary->get_exported_functions()) {
45+
for(const std::string& name : binary->exported_functions()) {
4646
std::cout << name << std::endl;
4747
}
4848

4949
std::cout << "== Imported functions ==" << std::endl;
50-
for(const std::string& name : binary->get_imported_functions()) {
50+
for(const std::string& name : binary->imported_functions()) {
5151
std::cout << name << std::endl;
5252
}
5353

5454
std::cout << "== Imported Libraries ==" << std::endl;
55-
for(const std::string& name : binary->get_imported_libraries()) {
55+
for(const std::string& name : binary->imported_libraries()) {
5656
std::cout << name << std::endl;
5757
}
5858

examples/cpp/macho_reader.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ void print_binary(const Binary* binary) {
7474

7575

7676
std::cout << "== Exported symbols ==" << std::endl;
77-
for (const Symbol& symbol : binary->get_exported_symbols()) {
77+
for (const Symbol& symbol : binary->exported_symbols()) {
7878
std::cout << symbol << std::endl;
7979
}
8080

8181
std::cout << "== Imported symbols ==" << std::endl;
82-
for (const Symbol& symbol : binary->get_imported_symbols()) {
82+
for (const Symbol& symbol : binary->imported_symbols()) {
8383
std::cout << symbol << std::endl;
8484
}
8585

examples/cpp/pe_reader.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ int main(int argc, char **argv) {
4949
}
5050

5151
std::cout << "== Sections ==" << std::endl;
52-
for (const Section& section : binary->get_sections()) {
52+
for (const Section& section : binary->sections()) {
5353
std::cout << section << std::endl;
5454
}
5555

@@ -87,13 +87,13 @@ int main(int argc, char **argv) {
8787

8888
if (binary->has_debug()) {
8989
std::cout << "== Debug ==" << std::endl;
90-
std::cout << binary->get_debug() << std::endl;
90+
std::cout << binary->debug() << std::endl;
9191
}
9292

9393

9494
if (binary->has_resources()) {
9595
std::cout << "== Resources ==" << std::endl;
96-
std::cout << binary->get_resources_manager() << std::endl;
96+
std::cout << binary->resources_manager() << std::endl;
9797
}
9898

9999

include/LIEF/Abstract/Binary.hpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ class DLL_PUBLIC Binary : public Visitable {
4646
EXE_FORMATS format(void) const;
4747

4848
//! @brief Return the abstract header of the binary
49-
Header get_header(void) const;
49+
Header header(void) const;
5050

5151
//! @brief Return list of symbols whose elements **can** be modified
52-
it_symbols get_symbols(void);
52+
it_symbols symbols(void);
5353

5454
//! @brief Return list of symbols whose elements **can't** be modified
55-
it_const_symbols get_symbols(void) const;
55+
it_const_symbols symbols(void) const;
5656

5757
//! @brief Check if a Symbol with the given name exists
5858
bool has_symbol(const std::string& name) const;
@@ -63,8 +63,8 @@ class DLL_PUBLIC Binary : public Visitable {
6363
Symbol& get_symbol(const std::string& name);
6464

6565
//! @brief Returns binary's sections
66-
it_sections get_sections(void);
67-
it_const_sections get_sections(void) const;
66+
it_sections sections(void);
67+
it_const_sections sections(void) const;
6868

6969
//! @brief Returns binary's relocations
7070
it_relocations relocations(void);
@@ -80,13 +80,13 @@ class DLL_PUBLIC Binary : public Visitable {
8080
uint64_t original_size(void) const;
8181

8282
//! @brief Return functions's name exported by the binary
83-
std::vector<std::string> get_exported_functions(void) const;
83+
std::vector<std::string> exported_functions(void) const;
8484

8585
//! @brief Return libraries which are imported by the binary
86-
std::vector<std::string> get_imported_libraries(void) const;
86+
std::vector<std::string> imported_libraries(void) const;
8787

8888
//! @brief Return functions's name imported by the binary
89-
std::vector<std::string> get_imported_functions(void) const;
89+
std::vector<std::string> imported_functions(void) const;
9090

9191
//! @brief Return the address of the given function name
9292
virtual uint64_t get_function_address(const std::string& func_name) const;

include/LIEF/MachO/Binary.hpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,15 @@ class DLL_PUBLIC Binary : public LIEF::Binary {
7878
static bool is_exported(const Symbol& symbol);
7979

8080
//! @brief Return binary's exported symbols
81-
it_exported_symbols get_exported_symbols(void);
82-
it_const_exported_symbols get_exported_symbols(void) const;
81+
it_exported_symbols exported_symbols(void);
82+
it_const_exported_symbols exported_symbols(void) const;
8383

8484
//! @brief Check if the given symbol is an imported one
8585
static bool is_imported(const Symbol& symbol);
8686

8787
//! @brief Return binary's imported symbols
88-
it_imported_symbols get_imported_symbols(void);
89-
it_const_imported_symbols get_imported_symbols(void) const;
88+
it_imported_symbols imported_symbols(void);
89+
it_const_imported_symbols imported_symbols(void) const;
9090

9191
//! @brief Return binary imported libraries (MachO::DylibCommand)
9292
it_libraries libraries(void);
@@ -121,7 +121,7 @@ class DLL_PUBLIC Binary : public LIEF::Binary {
121121
uint64_t imagebase(void) const;
122122

123123
//! @brief Return binary's loader (e.g. ``/usr/lib/dyld``)
124-
const std::string& get_loader(void) const;
124+
const std::string& loader(void) const;
125125

126126
//! @brief Check if a section with the given name exists
127127
bool has_section(const std::string& name) const;
@@ -251,10 +251,10 @@ class DLL_PUBLIC Binary : public LIEF::Binary {
251251
bool has_command(void) const;
252252

253253
template<class T>
254-
T& get_command(void);
254+
T& command(void);
255255

256256
template<class T>
257-
const T& get_command(void) const;
257+
const T& command(void) const;
258258

259259
template<class T>
260260
size_t count_commands(void) const;

include/LIEF/PE/Binary.hpp

+12-12
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ class DLL_PUBLIC Binary : public LIEF::Binary {
7777
const Section& section_from_rva(uint64_t virtual_address) const;
7878

7979
//! @brief Return binary's sections
80-
it_sections get_sections(void);
81-
it_const_sections get_sections(void) const;
80+
it_sections sections(void);
81+
it_const_sections sections(void) const;
8282

8383
// =======
8484
// Headers
@@ -98,10 +98,10 @@ class DLL_PUBLIC Binary : public LIEF::Binary {
9898

9999
//! @brief Compute the binary's virtual size.
100100
//! It should match with OptionalHeader::sizeof_image
101-
uint64_t get_virtual_size(void) const;
101+
uint64_t virtual_size(void) const;
102102

103103
//! @brief Compute the size of all headers
104-
uint32_t get_sizeof_headers(void) const;
104+
uint32_t sizeof_headers(void) const;
105105

106106
//! @brief Return a reference to the TLS object
107107
TLS& tls(void);
@@ -169,8 +169,8 @@ class DLL_PUBLIC Binary : public LIEF::Binary {
169169
const std::vector<Symbol>& symbols(void) const;
170170

171171
//! @brief Return resources as a tree
172-
ResourceNode& get_resources(void);
173-
const ResourceNode& get_resources(void) const;
172+
ResourceNode& resources(void);
173+
const ResourceNode& resources(void) const;
174174

175175
//! @brief Set a new resource tree
176176
void set_resources(const ResourceDirectory& resource);
@@ -179,8 +179,8 @@ class DLL_PUBLIC Binary : public LIEF::Binary {
179179
void set_resources(const ResourceData& resource);
180180

181181
//! @brief Return the ResourcesManager (class to manage resources more easily than the tree one)
182-
ResourcesManager get_resources_manager(void);
183-
const ResourcesManager get_resources_manager(void) const;
182+
ResourcesManager resources_manager(void);
183+
const ResourcesManager resources_manager(void) const;
184184

185185
// ==========================
186186
// Methods to manage sections
@@ -193,8 +193,8 @@ class DLL_PUBLIC Binary : public LIEF::Binary {
193193
const Section& get_section(const std::string& name) const;
194194

195195
//! @brief Return the section associated with import table
196-
const Section& get_import_section(void) const;
197-
Section& get_import_section(void);
196+
const Section& import_section(void) const;
197+
Section& import_section(void);
198198

199199
//! @brief Delete the section with the given name
200200
//!
@@ -232,8 +232,8 @@ class DLL_PUBLIC Binary : public LIEF::Binary {
232232
const DataDirectory& data_directory(DATA_DIRECTORY index) const;
233233

234234
//! @brief Return the Debug object
235-
Debug& get_debug(void);
236-
const Debug& get_debug(void) const;
235+
Debug& debug(void);
236+
const Debug& debug(void) const;
237237

238238
// =======
239239
// Overlay

0 commit comments

Comments
 (0)