retdec
|
#include <iterative_distribution_getter.h>
Public Member Functions | |
IterativeDistributionGetter (FileInformation &fileInfo) | |
Getters | |
std::size_t | getDistribution (std::size_t structIndex, std::vector< std::size_t > &distr) const |
std::size_t | getHeaderDesc (std::size_t structIndex, std::vector< std::string > &desc, std::vector< std::string > &abb) const |
void | getHeader (std::size_t structIndex, std::string &header) const |
bool | getDistributionFlags (std::size_t structIndex, std::vector< bool > &flags) const |
Virtual getters | |
virtual bool | getRecord (std::size_t structIndex, std::size_t recIndex, std::vector< std::string > &record) const override |
Pure virtual getters | |
virtual bool | getFlagDescriptors (std::size_t structIndex, std::vector< std::string > &desc, std::vector< std::string > &abbv) const =0 |
![]() | |
IterativeGetter (FileInformation &fileInfo) | |
std::size_t | getNumberOfStructures () const |
std::size_t | getNumberOfStoredRecords (std::size_t structIndex) const |
std::size_t | getHeaderElements (std::size_t structIndex, std::vector< std::string > &elements) const |
void | getTitle (std::string &structTitle) const |
bool | hasBasicInfo (std::size_t structIndex) const |
virtual std::size_t | getBasicInfo (std::size_t structIndex, std::vector< std::string > &desc, std::vector< std::string > &info) const =0 |
Protected Member Functions | |
Other pure virtual methods | |
virtual bool | loadRecord (std::size_t structIndex, std::size_t recIndex, std::vector< std::string > &record)=0 |
Other methods | |
void | loadRecords () |
Protected Attributes | |
std::vector< std::vector< std::vector< std::string > > > | records |
records from all structures More... | |
std::vector< std::size_t > | distribution |
distribution of header (common for all structures) More... | |
std::vector< std::string > | commonHeaderDesc |
description of header elements (common for all structures) More... | |
std::vector< std::vector< std::size_t > > | extraDistribution |
distribution of extra elements for each structure More... | |
std::vector< std::vector< std::string > > | extraDesc |
description of extra header elements for each structure More... | |
std::vector< std::vector< bool > > | distFlags |
distribution flags More... | |
std::vector< std::vector< bool > > | hexMap |
map of hexadecimal elements (columns) More... | |
std::vector< std::vector< std::size_t > > | hexPadding |
padding of hexadecimal columns More... | |
![]() | |
FileInformation & | fileinfo |
information about file More... | |
std::size_t | numberOfStructures |
number of presented structures (e.g. number of symbol tables) More... | |
std::vector< std::size_t > | numberOfStoredRecords |
number of records in each structure More... | |
std::vector< std::string > | commonHeaderElements |
parts of header (common for all structures) More... | |
std::vector< std::size_t > | numberOfExtraElements |
number of extra elements in each structure More... | |
std::vector< std::vector< std::string > > | extraHeaderElements |
parts of header (specific for each structure) More... | |
std::string | title |
title of presented structure More... | |
Abstract class for loading information about file.
This class enable iterative queries to a set of items (e.g. queries to symbols from symbol tables).
retdec::fileinfo::IterativeDistributionGetter::IterativeDistributionGetter | ( | FileInformation & | fileInfo | ) |
Constructor
fileInfo | Information about file |
Constructor in subclass must initialize distribution, commonHeaderDesc, extraDistribution, extraDesc and other members which are descripted in constructor of superclass.
Constructor in subclass must also ensure that the number of elements in distribution, commonHeaderElements and commonHeaderDesc are the same. Length of element in commonHeaderElements may be less than value on corresponding index in distribution. In which case header returned by method getHeader() is filled by spaces. If length of element is greater or equal, returned header will be automatically erased.
Constructor in subclass must furthermore ensure that each element in extraDistribution and in extraDesc contains exactly as many elements as numberOfExtraElements[i], where i is index of extraDistribution, extraDesc and numberOfExtraElements.
Finally, constructor in subclass must invoke method loadRecords.
std::size_t retdec::fileinfo::IterativeDistributionGetter::getDistribution | ( | std::size_t | structIndex, |
std::vector< std::size_t > & | distr | ||
) | const |
Get distribution of header
structIndex | Index of selected structure (indexed from 0) |
distr | Into this parameter is stored distribution (length) of the individual parts of header. At end of distr is stored distribution for extra elements of selected structure. |
Before loading information about distribution, everything from vector distr is deleted If structIndex is out of range, method returns 0 and distr is left unchanged.
bool retdec::fileinfo::IterativeDistributionGetter::getDistributionFlags | ( | std::size_t | structIndex, |
std::vector< bool > & | flags | ||
) | const |
Get distribution flags of one structure
structIndex | Index of selected structure (indexed from 0) |
flags | Into this parameter the flags are stored. |
true
if flags were successfully saved, false
otherwiseBefore loading flags, everything from vector flags is deleted.
If method returns true
, flags contains as many elements as vector returned by the method getDistribution(structIndex).
If structIndex is out of range, method returns false
.
|
pure virtual |
Get descriptors (and its abbreviations) of all records in structure
structIndex | Index of selected structure (indexed from 0) |
desc | Vector for save descriptors |
abbv | Vector for save abbreviations |
true
if index of selected structure is valid, false
otherwise. If index is not valid, desc and abbv are left unchanged.Into desc is stored each flag descriptor, which is assigned to at least one record. Into abbv are stored abbreviations of descriptors, which are stored in desc.
Before loading descriptors, everything from vectors desc and abbv is deleted.
Implemented in retdec::fileinfo::VisualBasicExternTablePlainGetter, retdec::fileinfo::VersionInfoStringTablePlainGetter, retdec::fileinfo::VersionInfoLanguageTablePlainGetter, retdec::fileinfo::TypeRefTablePlainGetter, retdec::fileinfo::TlsInfoPlainGetter, retdec::fileinfo::SymbolTablesPlainGetter, retdec::fileinfo::StringsPlainGetter, retdec::fileinfo::SegmentPlainGetter, retdec::fileinfo::SectionPlainGetter, retdec::fileinfo::RichHeaderPlainGetter, retdec::fileinfo::ResourcePlainGetter, retdec::fileinfo::RelocationTablesPlainGetter, retdec::fileinfo::PatternMatchesPlainGetter, retdec::fileinfo::MissingDepsPlainGetter, retdec::fileinfo::LoaderInfoPlainGetter, retdec::fileinfo::ImportTablePlainGetter, retdec::fileinfo::ExportTablePlainGetter, retdec::fileinfo::ElfNotesPlainGetter, retdec::fileinfo::ElfCoreMapPlainGetter, retdec::fileinfo::ElfAuxVPlainGetter, retdec::fileinfo::DynamicSectionsPlainGetter, retdec::fileinfo::DataDirectoryPlainGetter, and retdec::fileinfo::AnomaliesPlainGetter.
void retdec::fileinfo::IterativeDistributionGetter::getHeader | ( | std::size_t | structIndex, |
std::string & | header | ||
) | const |
Get header of presented structure
structIndex | Index of selected structure (indexed from 0) |
header | Into this parameter the header is stored. At end of this parameter is stored short description of extra information for selected structure. |
If structIndex is out of range, header is left unchanged
Into vectors desc and abb are stored only descriptors of significant elements. Significant element is each element (column), which has set at least one value in related structure.
std::size_t retdec::fileinfo::IterativeDistributionGetter::getHeaderDesc | ( | std::size_t | structIndex, |
std::vector< std::string > & | desc, | ||
std::vector< std::string > & | abb | ||
) | const |
Get description of header elements
structIndex | Index of selected structure (indexed from 0) |
desc | Vector for save descriptors (descriptor is full description of header element) |
abb | Vector for save abbreviations of descriptors (abbreviation is equal to short description in header) |
The first element in abb corresponds to the first element in desc etc. Before loading information, everything from vectors desc and abb is deleted. It is guaranteed that the number of elements in desc and abb are the same. At end of both vectors is stored description (or abbreviation) for extra elements of selected structure.
If structIndex is out of range, method returns 0 and desc and abb is left unchanged.
Into vectors desc and abb are stored only descriptors of significant elements. Significant element is each element (column), which has set at least one value in related structure.
|
overridevirtual |
If method returns true
, record contains as many elements as vector returned by the method getDistribution(structIndex).
More detailed description is in superclass.
Implements retdec::fileinfo::IterativeGetter.
|
protectedpure virtual |
Load one record
structIndex | Index of selected structure (indexed from 0) |
recIndex | Index of record in selected structure (indexed from 0) |
record | Vector for save record. At end of vector are stored special additional information, if these information are present. Number and semantics of additional information may be different for every separate structure. |
true
if record was successfully saved, false
otherwiseBefore loading record, everything from vector record is deleted.
If method returns true
, record contains as many elements as vector returned by the method getHeaderElements(structIndex) as well as vector returned by the method getDistribution(structIndex).
If structIndex or recIndex is out of range, method returns false
.
Implemented in retdec::fileinfo::VisualBasicExternTablePlainGetter, retdec::fileinfo::VersionInfoStringTablePlainGetter, retdec::fileinfo::VersionInfoLanguageTablePlainGetter, retdec::fileinfo::TypeRefTablePlainGetter, retdec::fileinfo::TlsInfoPlainGetter, retdec::fileinfo::SymbolTablesPlainGetter, retdec::fileinfo::StringsPlainGetter, retdec::fileinfo::SegmentPlainGetter, retdec::fileinfo::SectionPlainGetter, retdec::fileinfo::RichHeaderPlainGetter, retdec::fileinfo::ResourcePlainGetter, retdec::fileinfo::RelocationTablesPlainGetter, retdec::fileinfo::PatternMatchesPlainGetter, retdec::fileinfo::MissingDepsPlainGetter, retdec::fileinfo::LoaderInfoPlainGetter, retdec::fileinfo::ImportTablePlainGetter, retdec::fileinfo::ExportTablePlainGetter, retdec::fileinfo::ElfNotesPlainGetter, retdec::fileinfo::ElfCoreMapPlainGetter, retdec::fileinfo::ElfAuxVPlainGetter, retdec::fileinfo::DynamicSectionsPlainGetter, retdec::fileinfo::DataDirectoryPlainGetter, and retdec::fileinfo::AnomaliesPlainGetter.
|
protected |
Load records from all structures and store them into member records
This method load records from all structures and set member distFlags. Member distFlags represents so-called distribution flags. This flags consist of set of vectors. Each vector represents flags for related structure (first vector represents flags for first structure, etc.). Each distribution flag in each vector is related to one item from commonHeaderElements and to one item from commonHeaderDesc (first item from distFlags to first item from commonHeaderElements and to first item from commonHeaderDesc, etc.) of related structure. If flag is set to false
, related item from commonHeaderElements (and from commonHeaderDesc) will not be included to presented header. If any structure contains extra information, surplus values in distFlags represents flags for extraHeaderElements[structIndex] and for extraDesc[structIndex].
This method must be invoke in constructor of subclass after members numberOfStructures and numberOfStoredRecords are set.
|
protected |
description of header elements (common for all structures)
|
protected |
distribution flags
|
protected |
distribution of header (common for all structures)
|
protected |
description of extra header elements for each structure
|
protected |
distribution of extra elements for each structure
|
protected |
map of hexadecimal elements (columns)
|
protected |
padding of hexadecimal columns
|
protected |
records from all structures