mirror of
https://github.com/wiiu-env/WUMSLoader.git
synced 2026-09-27 12:27:06 -05:00
Use std::shared_ptr
This commit is contained in:
@@ -27,6 +27,14 @@
|
||||
#include "HookData.h"
|
||||
#include "FunctionSymbolData.h"
|
||||
|
||||
struct FunctionSymbolDataComparator {
|
||||
bool operator()(const std::shared_ptr<FunctionSymbolData>& lhs,
|
||||
const std::shared_ptr<FunctionSymbolData>& rhs) const
|
||||
{
|
||||
return (uint32_t) lhs->getAddress() < (uint32_t) rhs->getAddress();
|
||||
}
|
||||
};
|
||||
|
||||
class ModuleData {
|
||||
public:
|
||||
ModuleData() = default;
|
||||
@@ -55,47 +63,47 @@ public:
|
||||
this->endAddress = _endAddress;
|
||||
}
|
||||
|
||||
void addRelocationData(const RelocationData &relocation_data) {
|
||||
void addRelocationData(const std::shared_ptr<RelocationData> &relocation_data) {
|
||||
relocation_data_list.push_back(relocation_data);
|
||||
}
|
||||
|
||||
[[nodiscard]] const std::vector<RelocationData> &getRelocationDataList() const {
|
||||
[[nodiscard]] const std::vector<std::shared_ptr<RelocationData>> &getRelocationDataList() const {
|
||||
return relocation_data_list;
|
||||
}
|
||||
|
||||
void addExportData(const ExportData &data) {
|
||||
void addExportData(const std::shared_ptr<ExportData> &data) {
|
||||
export_data_list.push_back(data);
|
||||
}
|
||||
|
||||
[[nodiscard]] const std::vector<ExportData> &getExportDataList() const {
|
||||
[[nodiscard]] const std::vector<std::shared_ptr<ExportData>> &getExportDataList() const {
|
||||
return export_data_list;
|
||||
}
|
||||
|
||||
void addHookData(const HookData &data) {
|
||||
void addHookData(const std::shared_ptr<HookData> &data) {
|
||||
hook_data_list.push_back(data);
|
||||
}
|
||||
|
||||
[[nodiscard]] const std::vector<HookData> &getHookDataList() const {
|
||||
[[nodiscard]] const std::vector<std::shared_ptr<HookData>> &getHookDataList() const {
|
||||
return hook_data_list;
|
||||
}
|
||||
|
||||
void addSectionInfo(const SectionInfo §ionInfo) {
|
||||
section_info_list[sectionInfo.getName()] = sectionInfo;
|
||||
void addSectionInfo(const std::shared_ptr<SectionInfo> §ionInfo) {
|
||||
section_info_list[sectionInfo->getName()] = sectionInfo;
|
||||
}
|
||||
|
||||
void addFunctionSymbolData(const FunctionSymbolData &symbol_data) {
|
||||
void addFunctionSymbolData(const std::shared_ptr<FunctionSymbolData> &symbol_data) {
|
||||
symbol_data_list.insert(symbol_data);
|
||||
}
|
||||
|
||||
[[nodiscard]] const std::set<FunctionSymbolData> &getFunctionSymbolDataList() const {
|
||||
[[nodiscard]] const std::set<std::shared_ptr<FunctionSymbolData>, FunctionSymbolDataComparator> &getFunctionSymbolDataList() const {
|
||||
return symbol_data_list;
|
||||
}
|
||||
|
||||
[[nodiscard]] const std::map<std::string, SectionInfo> &getSectionInfoList() const {
|
||||
[[nodiscard]] const std::map<std::string, std::shared_ptr<SectionInfo>> &getSectionInfoList() const {
|
||||
return section_info_list;
|
||||
}
|
||||
|
||||
[[nodiscard]] std::optional<SectionInfo> getSectionInfo(const std::string §ionName) const {
|
||||
[[nodiscard]] std::optional<std::shared_ptr<SectionInfo>> getSectionInfo(const std::string §ionName) const {
|
||||
if (getSectionInfoList().count(sectionName) > 0) {
|
||||
return section_info_list.at(sectionName);
|
||||
}
|
||||
@@ -158,11 +166,11 @@ public:
|
||||
|
||||
bool relocationsDone = false;
|
||||
private:
|
||||
std::vector<RelocationData> relocation_data_list;
|
||||
std::vector<ExportData> export_data_list;
|
||||
std::vector<HookData> hook_data_list;
|
||||
std::set<FunctionSymbolData> symbol_data_list;
|
||||
std::map<std::string, SectionInfo> section_info_list;
|
||||
std::vector<std::shared_ptr<RelocationData>> relocation_data_list;
|
||||
std::vector<std::shared_ptr<ExportData>> export_data_list;
|
||||
std::vector<std::shared_ptr<HookData>> hook_data_list;
|
||||
std::set<std::shared_ptr<FunctionSymbolData>, FunctionSymbolDataComparator> symbol_data_list;
|
||||
std::map<std::string, std::shared_ptr<SectionInfo>> section_info_list;
|
||||
|
||||
std::string export_name;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user