| 27 | */ |
| 28 | |
| 29 | std::unique_ptr<FileFormat> createFileFormat( |
| 30 | const std::string &filePath, |
| 31 | const std::string &dllListFile, |
| 32 | bool isRaw, |
| 33 | LoadFlags loadFlags) |
| 34 | { |
| 35 | switch (detectFileFormat(filePath, isRaw)) |
| 36 | { |
| 37 | case Format::PE: |
| 38 | return std::make_unique<PeFormat>(filePath, dllListFile, loadFlags); |
| 39 | case Format::ELF: |
| 40 | return std::make_unique<ElfFormat>(filePath, loadFlags); |
| 41 | case Format::COFF: |
| 42 | return std::make_unique<CoffFormat>(filePath, loadFlags); |
| 43 | case Format::MACHO: |
| 44 | return std::make_unique<MachOFormat>(filePath, loadFlags); |
| 45 | case Format::INTEL_HEX: |
| 46 | return std::make_unique<IntelHexFormat>(filePath, loadFlags); |
| 47 | case Format::RAW_DATA: |
| 48 | return std::make_unique<RawDataFormat>(filePath, loadFlags); |
| 49 | default: |
| 50 | return nullptr; |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | std::unique_ptr<FileFormat> createFileFormat( |
| 55 | const std::string &filePath, |