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

AppleSingle & AppleDouble. More...

#include <apple.h>

Inheritance diagram for Apple::AppleSingleDouble:
Linker::Format Linker::Contents

Classes

class  Entry
 
class  GenericEntry
 

Public Types

enum  format_type { SINGLE = 0x00051600 , DOUBLE = 0x00051607 }
 
enum  hfs_type {
  HFS_UNDEFINED , HFS_Macintosh , HFS_ProDOS , HFS_MSDOS ,
  HFS_UNIX , HFS_VAX_VMS
}
 
enum  {
  ID_DataFork = 1 , ID_ResourceFork , ID_RealName , ID_Comment ,
  ID_IconBW , ID_IconColor , ID_FileInfo , ID_FileDatesInfo ,
  ID_FinderInfo , ID_MacintoshFileInfo , ID_ProDOSFileInfo , ID_MSDOSFileInfo ,
  ID_AFPShortName , ID_AFPFileInfo , ID_AFPDirectoryID
}
 
using clock = VendorClock< GregorianCalendarDate< 2000, Month::January, 1 > >
 Represents the clock for AppleSingleDouble timestamps.
 
using Timestamp = ::Timestamp< clock >
 

Public Member Functions

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.
 
hfs_type GetHomeFileSystem () const
 
void SetHomeFileSystem (hfs_type type)
 
 AppleSingleDouble (format_type type, unsigned version, hfs_type home_file_system)
 
 AppleSingleDouble (format_type type, hfs_type home_file_system)
 
 AppleSingleDouble (format_type type, unsigned version=2)
 
 AppleSingleDouble (AppleSingleDouble &other, format_type type)
 
 AppleSingleDouble (AppleSingleDouble &other)
 
std::shared_ptr< const Entry > FindEntry (uint32_t id) const
 
std::shared_ptr< Entry > FindEntry (uint32_t id)
 
void AppendEntry (std::shared_ptr< Entry > entry)
 
std::shared_ptr< Entry > GetFileDatesInfo ()
 
std::shared_ptr< Entry > GetMacintoshFileInfo ()
 
std::shared_ptr< Entry > GetAUXFileInfo ()
 
std::shared_ptr< Entry > GetProDOSFileInfo ()
 
std::shared_ptr< Entry > GetMSDOSFileInfo ()
 
std::shared_ptr< Entry > GetDataFork ()
 
std::shared_ptr< Entry > GetResourceFork ()
 
std::shared_ptr< Entry > GetFinderInfo ()
 
std::shared_ptr< Entry > GetRealName ()
 
void SetCreationDate (Timestamp CreationDate)
 
void SetModificationDate (Timestamp ModificationDate)
 
void SetBackupDate (Timestamp BackupDate)
 
void SetAccessDate (Timestamp AccessDate)
 
void SetMacintoshAttributes (uint32_t Attributes)
 
void SetProDOSAccess (uint16_t Access)
 
void SetProDOSFileType (uint16_t FileType)
 
void SetProDOSAuxiliaryType (uint32_t AuxiliaryType)
 
void SetMSDOSAttributes (uint16_t Attributes)
 
Timestamp GetCreationDate ()
 Retrieves creation date field and creates it if it does not exist.
 
Timestamp GetModificationDate ()
 Retrieves modification date field and creates it if it does not exist.
 
uint32_t GetMacintoshAttributes ()
 Retrieves Macintosh attributes field and creates it if it does not exist.
 
std::optional< Timestamp > ReadCreationDate ()
 Retrieves creation date field if it exists.
 
std::optional< Timestamp > ReadModificationDate ()
 Retrieves modification date field if it exists.
 
uint32_t ReadMacintoshAttributes ()
 Retrieves Macintosh attributes field if it exists.
 
void CalculateOffsets ()
 
offset_t WriteFile (const std::shared_ptr< Linker::Writer > &wr) const override
 Stores data in memory to file.
 
void Dump (Dumper::Dumper &dump) const override
 Display file contents in a nice manner.
 
std::string PrefixFilename (std::string prefix, std::string filename)
 
std::string PrefixFilename (std::string prefix, std::string filename, size_t limit)
 
std::string ReplaceExtension (std::string filename, std::string extension, size_t limit)
 
std::string GetUNIXDoubleFilename (std::string filename)
 
std::string GetMacOSXDoubleFilename (std::string filename)
 
std::string GetProDOSDoubleFilename (std::string filename)
 
std::string GetMSDOSDoubleFilename (std::string filename)
 
- 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.
 
offset_t ImageSize () const override
 Retrieves the offset of the byte after the last one belonging to this format from the first one.
 
- 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

format_type type = DOUBLE
 
unsigned version = 2
 
char home_file_system_string [16] = ""
 
std::vector< std::shared_ptr< Entry > > entries
 
offset_t image_size = offset_t(-1)
 
- 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.
 

Static Public Attributes

static const char TXT_undefined [16] = ""
 
static const char TXT_Macintosh [16] = "Macintosh"
 
static const char TXT_ProDOS [16] = "ProDOS"
 
static const char TXT_MS_DOS [16] = "MS-DOS"
 
static const char TXT_UNIX [16] = "Unix"
 
static const char TXT_VAX_VMS [16] = "VAX VMS"
 

Protected Attributes

hfs_type home_file_system
 

Detailed Description

AppleSingle & AppleDouble.

Permits storing certain metadata alongside the byte stream of a file, used for several Apple products

On classic Macintosh systems, each file has two associated parts called forks: the data fork and the resource fork. Classic 68000 applications store all the executable data in the resource fork, which is usually not transferred to non-Macintosh platforms. The AppleSingle and AppleDouble formats provide a way to store both the data and resource fork, or the resource fork, as a separate file, alongside other metadata, which is essential when storing it on a non-Macintosh system.

This container format was first invented for the A/UX Apple UNIX system. It has two versions, and version 2 is used most commonly. See also Apple::MacintoshResourceFileFormat.

Member Function Documentation

◆ Dump()

void AppleSingleDouble::Dump ( Dumper::Dumper &  dump) const
overridevirtual

Display file contents in a nice manner.

Reimplemented from Linker::Format.

◆ ImageSize()

offset_t AppleSingleDouble::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 Linker::Contents.

◆ ReadFile()

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

Loads file into memory.

Implements Linker::Format.

◆ WriteFile()

offset_t AppleSingleDouble::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: