retdec
Private Attributes | List of all members
retdec::fileformat::Resource Class Reference

#include <resource.h>

Inheritance diagram for retdec::fileformat::Resource:
Inheritance graph
[legend]
Collaboration diagram for retdec::fileformat::Resource:
Collaboration graph
[legend]

Public Member Functions

Getters
std::string getCrc32 () const
 
std::string getMd5 () const
 
std::string getSha256 () const
 
std::string getName () const
 
std::string getType () const
 
std::string getLanguage () const
 
const llvm::StringRef getBytes (std::size_t sOffset=0, std::size_t sSize=0) const
 
std::size_t getOffset () const
 
std::size_t getSizeInFile () const
 
std::size_t getLoadedSize () const
 
bool getNameId (std::size_t &rId) const
 
bool getTypeId (std::size_t &rId) const
 
bool getLanguageId (std::size_t &rId) const
 
bool getSublanguageId (std::size_t &rId) const
 
Getters of resource content
bool getBits (std::string &sResult) const
 
bool getBytes (std::vector< unsigned char > &sResult, std::size_t sOffset=0, std::size_t sSize=0) const
 
bool getString (std::string &sResult, std::size_t sOffset=0, std::size_t sSize=0) const
 
bool getHexBytes (std::string &sResult) const
 
Setters
void setName (std::string rName)
 
void setType (std::string rType)
 
void setLanguage (std::string rLan)
 
void setOffset (std::size_t rOffset)
 
void setSizeInFile (std::size_t rSize)
 
void setNameId (std::size_t rId)
 
void setTypeId (std::size_t rId)
 
void setLanguageId (std::size_t rId)
 
void setSublanguageId (std::size_t rId)
 
Other methods
bool isLoaded () const
 
bool hasValidName () const
 
bool hasValidId () const
 
void invalidateNameId ()
 
void invalidateTypeId ()
 
void invalidateLanguageId ()
 
void invalidateSublanguageId ()
 
void load (const FileFormat *rOwner)
 
bool hasCrc32 () const
 
bool hasMd5 () const
 
bool hasSha256 () const
 
bool hasEmptyName () const
 
bool hasEmptyType () const
 
bool hasEmptyLanguage () const
 

Private Attributes

std::string crc32
 CRC32 of resource content. More...
 
std::string md5
 MD5 of resource content. More...
 
std::string sha256
 SHA256 of resource content. More...
 
std::string name
 resource name More...
 
std::string type
 resource type More...
 
std::string language
 resource language More...
 
llvm::StringRef bytes
 reference to resource data More...
 
std::size_t offset = 0
 offset in file More...
 
std::size_t size = 0
 size in file More...
 
std::size_t nameId = 0
 resource name identifier More...
 
std::size_t typeId = 0
 resource type identifier More...
 
std::size_t languageId = 0
 resource language identifier More...
 
std::size_t sublanguageId = 0
 resource sublanguage identifier More...
 
bool nameIdIsValid = false
 true if name ID is valid More...
 
bool typeIdIsValid = false
 true if type ID is valid More...
 
bool languageIdIsValid = false
 true if language ID is valid More...
 
bool sublanguageIdIsValid = false
 true if sublanguage ID is valid More...
 
bool loaded = false
 true if content of resource was successfully loaded from input file More...
 

Detailed Description

One resource

Member Function Documentation

◆ getBits()

bool retdec::fileformat::Resource::getBits ( std::string &  sResult) const

Get content of resource as bits

Parameters
sResultRead bits in string representation
Returns
true if operation went OK, false otherwise

◆ getBytes() [1/2]

const llvm::StringRef retdec::fileformat::Resource::getBytes ( std::size_t  sOffset = 0,
std::size_t  sSize = 0 
) const

Get resource content as reference to string

Parameters
sOffsetFirst byte of the resource data to get (0 means first byte of resource data)
sSizeNumber of resource bytes to get. If this parameter is set to zero, method returns all bytes from sOffset until end of resource data.
Returns
Resource content as reference to string

◆ getBytes() [2/2]

bool retdec::fileformat::Resource::getBytes ( std::vector< unsigned char > &  sResult,
std::size_t  sOffset = 0,
std::size_t  sSize = 0 
) const

Get content of resource as bytes

Parameters
sResultRead bytes in integer representation
sOffsetFirst byte of the resource data to be loaded (0 means first byte of resource data)
sSizeNumber of bytes for read. If this parameter is set to zero, method will read all bytes from sOffset until end of resource data.
Returns
true if operation went OK, false otherwise

◆ getCrc32()

std::string retdec::fileformat::Resource::getCrc32 ( ) const

Get CRC32

Returns
CRC32 of resource content

◆ getHexBytes()

bool retdec::fileformat::Resource::getHexBytes ( std::string &  sResult) const

Get content of resource as bytes

Parameters
sResultRead bytes in hexadecimal string representation
Returns
true if operation went OK, false otherwise

◆ getLanguage()

std::string retdec::fileformat::Resource::getLanguage ( ) const

Get resource language

Returns
Resource language

◆ getLanguageId()

bool retdec::fileformat::Resource::getLanguageId ( std::size_t &  rId) const

Get resource language ID

Parameters
rIdInto this parameter is stored resource language ID
Returns
true if language ID of resource is valid, false otherwise

If method returns false, rId is left unchanged

◆ getLoadedSize()

std::size_t retdec::fileformat::Resource::getLoadedSize ( ) const

Get real file size of resource

Returns
Real file size of resource

◆ getMd5()

std::string retdec::fileformat::Resource::getMd5 ( ) const

Get MD5

Returns
MD5 of resource content

◆ getName()

std::string retdec::fileformat::Resource::getName ( ) const

Get resource name

Returns
Resource name

◆ getNameId()

bool retdec::fileformat::Resource::getNameId ( std::size_t &  rId) const

Get resource name ID

Parameters
rIdInto this parameter is stored resource name ID
Returns
true if name ID of resource is valid, false otherwise

If method returns false, rId is left unchanged

◆ getOffset()

std::size_t retdec::fileformat::Resource::getOffset ( ) const

Get resource offset

Returns
Offset of resource in input file

◆ getSha256()

std::string retdec::fileformat::Resource::getSha256 ( ) const

Get SHA256

Returns
SHA256 of resource content

◆ getSizeInFile()

std::size_t retdec::fileformat::Resource::getSizeInFile ( ) const

Get resource size in file

Returns
Size of resource data in file

◆ getString()

bool retdec::fileformat::Resource::getString ( std::string &  sResult,
std::size_t  sOffset = 0,
std::size_t  sSize = 0 
) const

Get content of resource as plain string

Parameters
sResultInto this parameter is stored content of resource as plain string
sOffsetFirst byte of the resource data to be loaded (0 means first byte of resource data)
sSizeNumber of bytes for read. If this parameter is set to zero, method will read all bytes from sOffset until end of resource data.
Returns
true if operation went OK, false otherwise

◆ getSublanguageId()

bool retdec::fileformat::Resource::getSublanguageId ( std::size_t &  rId) const

Get resource sublanguage ID

Parameters
rIdInto this parameter is stored resource sublanguage ID
Returns
true if sublanguage ID of resource is valid, false otherwise

If method returns false, rId is left unchanged

◆ getType()

std::string retdec::fileformat::Resource::getType ( ) const

Get resource type

Returns
Resource type

◆ getTypeId()

bool retdec::fileformat::Resource::getTypeId ( std::size_t &  rId) const

Get resource type ID

Parameters
rIdInto this parameter is stored resource type ID
Returns
true if type ID of resource is valid, false otherwise

If method returns false, rId is left unchanged

◆ hasCrc32()

bool retdec::fileformat::Resource::hasCrc32 ( ) const

Check if CRC32 was computed

Returns
true if CRC32 was computed, false otherwise

◆ hasEmptyLanguage()

bool retdec::fileformat::Resource::hasEmptyLanguage ( ) const
Returns
true if resource has empty language string, false otherwise

◆ hasEmptyName()

bool retdec::fileformat::Resource::hasEmptyName ( ) const
Returns
true if resource has empty name string, false otherwise

◆ hasEmptyType()

bool retdec::fileformat::Resource::hasEmptyType ( ) const
Returns
true if resource has empty type string, false otherwise

◆ hasMd5()

bool retdec::fileformat::Resource::hasMd5 ( ) const

Check if MD5 was computed

Returns
true if MD5 was computed, false otherwise

◆ hasSha256()

bool retdec::fileformat::Resource::hasSha256 ( ) const

Check if SHA256 was computed

Returns
true if SHA256 was computed, false otherwise

◆ hasValidId()

bool retdec::fileformat::Resource::hasValidId ( ) const

A method which indicates whether ID is valid.

Returns
true if it is, otherwise false.

◆ hasValidName()

bool retdec::fileformat::Resource::hasValidName ( ) const

A method which indicates whether name is valid.

Returns
true if it is, otherwise false.

◆ invalidateLanguageId()

void retdec::fileformat::Resource::invalidateLanguageId ( )

Invalidate language ID of resource

Instance method getLanguageId() returns false after invocation of this method. ID is possible to revalidate by invocation of method setLanguageId().

◆ invalidateNameId()

void retdec::fileformat::Resource::invalidateNameId ( )

Invalidate name ID of resource

Instance method getNameId() returns false after invocation of this method. ID is possible to revalidate by invocation of method setNameId().

◆ invalidateSublanguageId()

void retdec::fileformat::Resource::invalidateSublanguageId ( )

Invalidate sublanguage ID of resource

Instance method getSublanguageId() returns false after invocation of this method. ID is possible to revalidate by invocation of method setSublanguageId().

◆ invalidateTypeId()

void retdec::fileformat::Resource::invalidateTypeId ( )

Invalidate type ID of resource

Instance method getTypeId() returns false after invocation of this method. ID is possible to revalidate by invocation of method setTypeId().

◆ isLoaded()

bool retdec::fileformat::Resource::isLoaded ( ) const

A method which indicates whether resource is loaded.

Returns
true if it is, otherwise false.

◆ load()

void retdec::fileformat::Resource::load ( const FileFormat rOwner)

Load content of resource from input file

Parameters
rOwnerPointer to input file

This method must be called before getters of resource content

◆ setLanguage()

void retdec::fileformat::Resource::setLanguage ( std::string  rLan)

Set resource language

Parameters
rLanResource language

◆ setLanguageId()

void retdec::fileformat::Resource::setLanguageId ( std::size_t  rId)

Set resource language ID

Parameters
rIdResource language ID

◆ setName()

void retdec::fileformat::Resource::setName ( std::string  rName)

Set resource name

Parameters
rNameResource name

◆ setNameId()

void retdec::fileformat::Resource::setNameId ( std::size_t  rId)

Set resource name ID

Parameters
rIdResource name ID

◆ setOffset()

void retdec::fileformat::Resource::setOffset ( std::size_t  rOffset)

Set resource offset

Parameters
rOffsetOffset of resource in input file

◆ setSizeInFile()

void retdec::fileformat::Resource::setSizeInFile ( std::size_t  rSize)

Set resource size in file

Parameters
rSizeSize of resource in input file

◆ setSublanguageId()

void retdec::fileformat::Resource::setSublanguageId ( std::size_t  rId)

Set resource sublanguage ID

Parameters
rIdResource sublanguage ID

◆ setType()

void retdec::fileformat::Resource::setType ( std::string  rType)

Set resource type

Parameters
rTypeResource type

◆ setTypeId()

void retdec::fileformat::Resource::setTypeId ( std::size_t  rId)

Set resource type ID

Parameters
rIdResource type ID

Member Data Documentation

◆ bytes

llvm::StringRef retdec::fileformat::Resource::bytes
private

reference to resource data

◆ crc32

std::string retdec::fileformat::Resource::crc32
private

CRC32 of resource content.

◆ language

std::string retdec::fileformat::Resource::language
private

resource language

◆ languageId

std::size_t retdec::fileformat::Resource::languageId = 0
private

resource language identifier

◆ languageIdIsValid

bool retdec::fileformat::Resource::languageIdIsValid = false
private

true if language ID is valid

◆ loaded

bool retdec::fileformat::Resource::loaded = false
private

true if content of resource was successfully loaded from input file

◆ md5

std::string retdec::fileformat::Resource::md5
private

MD5 of resource content.

◆ name

std::string retdec::fileformat::Resource::name
private

resource name

◆ nameId

std::size_t retdec::fileformat::Resource::nameId = 0
private

resource name identifier

◆ nameIdIsValid

bool retdec::fileformat::Resource::nameIdIsValid = false
private

true if name ID is valid

◆ offset

std::size_t retdec::fileformat::Resource::offset = 0
private

offset in file

◆ sha256

std::string retdec::fileformat::Resource::sha256
private

SHA256 of resource content.

◆ size

std::size_t retdec::fileformat::Resource::size = 0
private

size in file

◆ sublanguageId

std::size_t retdec::fileformat::Resource::sublanguageId = 0
private

resource sublanguage identifier

◆ sublanguageIdIsValid

bool retdec::fileformat::Resource::sublanguageIdIsValid = false
private

true if sublanguage ID is valid

◆ type

std::string retdec::fileformat::Resource::type
private

resource type

◆ typeId

std::size_t retdec::fileformat::Resource::typeId = 0
private

resource type identifier

◆ typeIdIsValid

bool retdec::fileformat::Resource::typeIdIsValid = false
private

true if type ID is valid


The documentation for this class was generated from the following files: