#include <archive_wrapper.h>
|
| ArchiveWrapper (const std::string &archivePath, bool &succes, std::string &errorMessage) |
|
|
std::size_t | getNumberOfObjects () const |
| Getters. More...
|
|
|
bool | isThinArchive () const |
| Query methods. More...
|
|
bool | isEmptyArchive () const |
|
|
bool | getPlainTextList (std::string &result, std::string &errorMessage, bool niceNames=false, bool numbers=true) const |
| Display methods. More...
|
|
bool | getJsonList (std::string &result, std::string &errorMessage, bool niceNames=false, bool numbers=true) const |
|
|
bool | extract (std::string &errorMessage, const std::string &directory="") const |
| Extraction methods. More...
|
|
bool | extractByName (const std::string &name, std::string &errorMessage, const std::string &outputPath="") const |
|
bool | extractByIndex (const std::size_t index, std::string &errorMessage, const std::string &outputPath="") const |
|
|
std::unique_ptr< llvm::object::Archive > | archive |
| LLVM archive parser. More...
|
|
llvm::ErrorOr< std::unique_ptr< llvm::MemoryBuffer > > | buffer |
| Buffer storing content of whole archive. More...
|
|
std::size_t | objectCount = 0 |
| Number of object files in archive. More...
|
|
Class for reading archives using llvm::Archive.
◆ ArchiveWrapper()
retdec::ar_extractor::ArchiveWrapper::ArchiveWrapper |
( |
const std::string & |
archivePath, |
|
|
bool & |
succes, |
|
|
std::string & |
errorMessage |
|
) |
| |
Constructor.
- Parameters
-
archivePath | path to input archive |
succes | result of object construction |
errorMessage | possible error message if success is set to false |
◆ extract()
bool retdec::ar_extractor::ArchiveWrapper::extract |
( |
std::string & |
errorMessage, |
|
|
const std::string & |
directory = "" |
|
) |
| const |
Extraction methods.
Extract all object files.
If directory is not specified, current directory is used. If multiple files have same name, they are decorated with their index suffix.
- Parameters
-
errorMessage | possible error message if false is returned |
directory | optional target directory |
- Returns
true
if no errors occurred, false
otherwise
- Todo:
- In writeFile function call, separator is added to path, this may or may not work on Windows OS.
◆ extractByIndex()
bool retdec::ar_extractor::ArchiveWrapper::extractByIndex |
( |
const std::size_t |
index, |
|
|
std::string & |
errorMessage, |
|
|
const std::string & |
outputPath = "" |
|
) |
| const |
Extract object file by its index.
If output path is not given, object name and current directory is used. If name cannot be retrieved, name 'invalid_name' is used.
- Parameters
-
index | target index |
errorMessage | possible error message if false is returned |
outputPath | optional output path |
- Returns
true
if no errors occurred, false
otherwise
◆ extractByName()
bool retdec::ar_extractor::ArchiveWrapper::extractByName |
( |
const std::string & |
name, |
|
|
std::string & |
errorMessage, |
|
|
const std::string & |
outputPath = "" |
|
) |
| const |
Extract object file by its name.
If output path is not given, object name and current directory is used. If multiple files with the same name are present, only first one is extracted.
- Parameters
-
name | target name |
errorMessage | possible error message if false is returned |
outputPath | optional output path |
- Returns
true
if no errors occurred, false
otherwise
◆ getCount()
bool retdec::ar_extractor::ArchiveWrapper::getCount |
( |
std::size_t & |
count, |
|
|
std::string & |
errorMessage |
|
) |
| const |
|
private |
Get object count.
- Parameters
-
count | result |
errorMessage | possible error message if false is returned |
- Returns
true
if no errors occurred, false
otherwise
◆ getJsonList()
bool retdec::ar_extractor::ArchiveWrapper::getJsonList |
( |
std::string & |
result, |
|
|
std::string & |
errorMessage, |
|
|
bool |
niceNames = false , |
|
|
bool |
numbers = true |
|
) |
| const |
Get list of object file names in JSON format.
- Parameters
-
result | string with complete list in JSON format |
errorMessage | possible error message if false is returned |
niceNames | names will be made nicer if true |
numbers | list will be numbered if true |
- Returns
true
if no errors occurred, false
otherwise
◆ getNames()
bool retdec::ar_extractor::ArchiveWrapper::getNames |
( |
std::vector< std::string > & |
result, |
|
|
std::string & |
errorMessage |
|
) |
| const |
|
private |
Auxiliary methods.
Get names of all object files in archive.
If name of object could not be read from input archive, name 'invalid_name' is used.
- Parameters
-
result | container where names will be added |
errorMessage | possible error message if false is returned |
- Returns
true
if no errors occurred, false
otherwise
◆ getNumberOfObjects()
std::size_t retdec::ar_extractor::ArchiveWrapper::getNumberOfObjects |
( |
| ) |
const |
Getters.
Get number of objects.
- Returns
- number of objects in file.
◆ getPlainTextList()
bool retdec::ar_extractor::ArchiveWrapper::getPlainTextList |
( |
std::string & |
result, |
|
|
std::string & |
errorMessage, |
|
|
bool |
niceNames = false , |
|
|
bool |
numbers = true |
|
) |
| const |
Display methods.
Get list of object file names in plain-text.
- Parameters
-
result | string with complete list in plain-text |
errorMessage | possible error message if false is returned |
niceNames | names will be made nicer if true |
numbers | list will be numbered if true |
- Returns
true
if no errors occurred, false
otherwise
◆ isEmptyArchive()
bool retdec::ar_extractor::ArchiveWrapper::isEmptyArchive |
( |
| ) |
const |
Check whether archive is empty.
- Returns
true
if archive is empty, false
otherwise
◆ isThinArchive()
bool retdec::ar_extractor::ArchiveWrapper::isThinArchive |
( |
| ) |
const |
Query methods.
Check whether archive is thin archive.
- Returns
true
if archive is thin, false
otherwise
◆ archive
std::unique_ptr<llvm::object::Archive> retdec::ar_extractor::ArchiveWrapper::archive |
|
private |
◆ buffer
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer> > retdec::ar_extractor::ArchiveWrapper::buffer |
|
private |
Buffer storing content of whole archive.
◆ objectCount
std::size_t retdec::ar_extractor::ArchiveWrapper::objectCount = 0 |
|
private |
Number of object files in archive.
The documentation for this class was generated from the following files: