RetroLinker
Linker for several 8-bit, 16-bit and 32-bit formats
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
Apple::RSegResource Class Reference

Represents an 'rseg' resource in a Macintosh resource file. More...

#include <pefexe.h>

Inheritance diagram for Apple::RSegResource:
Apple::MacintoshResourceFileFormat::Resource Linker::Format Linker::Contents

Public Member Functions

 RSegResource (std::shared_ptr< PEFHeader > structured_data, std::shared_ptr< MacintoshResourceFileFormat::Resource > raw_data=nullptr)
 
 RSegResource (std::shared_ptr< PEFFormat > structured_data, std::shared_ptr< MacintoshResourceFileFormat::Resource > raw_data=nullptr)
 
void CalculateValues () override
 
offset_t ImageSize () const override
 Retrieves the offset of the byte after the last one belonging to this format from the first one.
 
void ReadFile (const std::shared_ptr< Linker::Reader > &rd) override
 Loads file into memory.
 
void ReadFile (const std::shared_ptr< Linker::Reader > &rd, offset_t length) override
 
offset_t WriteFile (const std::shared_ptr< Linker::Writer > &wr) const override
 Stores data in memory to file.
 
int GetDisplayOptions () const override
 
void Dump (Dumper::Dumper &dump, offset_t file_offset) const override
 
void AddFields (Dumper::Dumper &dump, Dumper::Region &region, offset_t file_offset) const override
 
std::unique_ptr< Dumper::Region > CreateRegion (std::string name, offset_t offset, offset_t length, unsigned display_width) const override
 
void ReparseResource (MacintoshResourceFileFormat &format, const std::shared_ptr< Linker::Reader > &rd, offset_t offset, offset_t length)
 
void EffectFormat (MacintoshResourceFileFormat &format, const std::shared_ptr< Linker::Reader > &rd) override
 Apply some changes to the format after parsing.
 
- Public Member Functions inherited from Apple::MacintoshResourceFileFormat::Resource
void Dump (Dumper::Dumper &dump) const override
 Display file contents in a nice manner.
 
- Public Member Functions inherited from Linker::Format
 Format (offset_t file_offset=0)
 
virtual void Clear ()
 Resets all fields to their default values, deallocate memory.
 
virtual void SetFileOffset (offset_t new_offset)
 Attempts to alter the offset to the first byte of the format from the beginning of the file.
 
- Public Member Functions inherited from Linker::Contents
virtual std::shared_ptr< const Image > AsImage () const
 Retrieves a randomly accessible image.
 
std::shared_ptr< Image > AsImage ()
 Retrieves a randomly accessible image.
 

Public Attributes

std::variant< std::shared_ptr< PEFFormat >, std::shared_ptr< PEFHeader > > structured_data
 The parsed contents of the resource.
 
std::shared_ptr< MacintoshResourceFileFormat::Resource > raw_data
 The contents of the resource, processed before recognizing it as an 'rseg' resource.
 
- Public Attributes inherited from Apple::MacintoshResourceFileFormat::Resource
char type [4]
 
uint16_t id
 
std::optional< std::string > name
 
uint8_t attributes
 
- Public Attributes inherited from Linker::Format
offset_t file_offset
 The offset of the first byte used by this format in the file it is stored in.
 

Additional Inherited Members

- Protected Member Functions inherited from Apple::MacintoshResourceFileFormat::Resource
 Resource (const char type[4], uint16_t id, uint8_t attributes=0)
 
 Resource (const char type[4], uint16_t id, std::optional< std::string > name, uint8_t attributes=0)
 

Detailed Description

Represents an 'rseg' resource in a Macintosh resource file.

The resource which contains the PEF metadata is determined by the 'cfrg'0 resource, therefore its contents could be in a resource of any type. To accomodate this, 'rseg' resources are not parsed immediately on encounter, but rather when a 'cfrg'0 resource (or another 'rseg' resource) mentions them by ID.

Since the actual parsing might occur once the resource is already read in, this class contains a reference to the previous parse.

Member Function Documentation

◆ AddFields()

void RSegResource::AddFields ( Dumper::Dumper &  dump,
Dumper::Region &  region,
offset_t  file_offset 
) const
overridevirtual

◆ CalculateValues()

void RSegResource::CalculateValues ( )
overridevirtual

◆ CreateRegion()

std::unique_ptr< Dumper::Region > RSegResource::CreateRegion ( std::string  name,
offset_t  offset,
offset_t  length,
unsigned  display_width 
) const
overridevirtual

◆ Dump()

void RSegResource::Dump ( Dumper::Dumper &  dump,
offset_t  file_offset 
) const
overridevirtual

◆ EffectFormat()

void RSegResource::EffectFormat ( MacintoshResourceFileFormat &  format,
const std::shared_ptr< Linker::Reader > &  rd 
)
overridevirtual

Apply some changes to the format after parsing.

Reimplemented from Apple::MacintoshResourceFileFormat::Resource.

◆ GetDisplayOptions()

int RSegResource::GetDisplayOptions ( ) const
overridevirtual

◆ ImageSize()

offset_t RSegResource::ImageSize ( ) const
overridevirtual

Retrieves the offset of the byte after the last one belonging to this format from the first one.

Returns
The size of the image, or offset_t(-1) if it cannot be determined before writing to the file

Implements Apple::MacintoshResourceFileFormat::Resource.

◆ ReadFile() [1/2]

void RSegResource::ReadFile ( const std::shared_ptr< Linker::Reader > &  rd)
overridevirtual

Loads file into memory.

Implements Linker::Format.

◆ ReadFile() [2/2]

void RSegResource::ReadFile ( const std::shared_ptr< Linker::Reader > &  rd,
offset_t  length 
)
overridevirtual

◆ WriteFile()

offset_t RSegResource::WriteFile ( const std::shared_ptr< Linker::Writer > &  wr) const
overridevirtual

Stores data in memory to file.

Implements Linker::Format.


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