ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

Class for handling Mac data and resource forks. More...

#include <macresman.h>

Collaboration diagram for Common::MacResManager:

List of all members.

Classes

struct  MacVers
struct  ResMap
struct  Resource
struct  ResType

Public Member Functions

 MacResManager ()
 ~MacResManager ()
bool open (const String &fileName)
 Open a Mac data/resource fork pair.
bool open (const FSNode &path, const String &fileName)
 Open a Mac data/resource fork pair.
void close ()
 Close the Mac data/resource fork pair.
bool hasDataFork () const
 Query whether or not we have a data fork present.
bool hasResFork () const
 Query whether or not we have a data fork present.
SeekableReadStreamgetResource (uint32 typeID, uint16 resID)
 Read resource from the MacBinary file.
SeekableReadStreamgetResource (const String &filename)
 Read resource from the MacBinary file.
SeekableReadStreamgetResource (uint32 typeID, const String &filename)
 Read resource from the MacBinary file.
SeekableReadStreamgetDataFork ()
 Retrieve the data fork.
String getResName (uint32 typeID, uint16 resID) const
 Get the name of a given resource.
uint32 getResForkDataSize () const
 Get the size of the data portion of the resource fork.
String computeResForkMD5AsString (uint32 length=0) const
 Calculate the MD5 checksum of the resource fork.
String getBaseFileName () const
 Get the base file name of the data/resource fork pair.
void setBaseFileName (Common::String str)
MacResIDArray getResIDArray (uint32 typeID)
 Return list of resource IDs with specified type ID.
MacResTagArray getResTagArray ()
 Return list of resource tags.
bool loadFromMacBinary (SeekableReadStream &stream)
 Load from stream in MacBinary format.
void dumpRaw ()
 Dump contents of the archive to .

Static Public Member Functions

static bool exists (const String &fileName)
 See if a Mac data/resource fork pair exists.
static void listFiles (StringArray &files, const String &pattern)
 List all filenames matching pattern for opening with open().
static int getDataForkOffset ()
static bool isMacBinary (SeekableReadStream &stream)
 Check if the given stream is in the MacBinary format.
static MacVersparseVers (SeekableReadStream *vvers)

Private Types

enum  { kResForkNone = 0, kResForkRaw, kResForkMacBinary, kResForkAppleDouble }
typedef ResourceResPtr

Private Member Functions

bool load (SeekableReadStream &stream)
bool loadFromRawFork (SeekableReadStream &stream)
bool loadFromAppleDouble (SeekableReadStream &stream)
void readMap ()

Static Private Member Functions

static String constructAppleDoubleName (String name)
static String disassembleAppleDoubleName (String name, bool *isAppleDouble)
static bool isRawFork (SeekableReadStream &stream)
 Do a sanity check whether the given stream is a raw resource fork.

Private Attributes

SeekableReadStream_stream
String _baseFileName
enum Common::MacResManager:: { ... }  _mode
int32 _resForkOffset
uint32 _resForkSize
uint32 _dataOffset
uint32 _dataLength
uint32 _mapOffset
uint32 _mapLength
ResMap _resMap
ResType_resTypes
ResPtr_resLists

Detailed Description

Class for handling Mac data and resource forks.

It can read from raw, MacBinary, and AppleDouble formats.

Definition at line 50 of file macresman.h.


Member Typedef Documentation

Definition at line 271 of file macresman.h.


Member Enumeration Documentation

anonymous enum [private]
Enumerator:
kResForkNone 
kResForkRaw 
kResForkMacBinary 
kResForkAppleDouble 

Definition at line 232 of file macresman.h.


Constructor & Destructor Documentation

Common::MacResManager::MacResManager (  ) 

Definition at line 48 of file macresman.cpp.

Common::MacResManager::~MacResManager (  ) 

Definition at line 66 of file macresman.cpp.


Member Function Documentation

void Common::MacResManager::close (  ) 

Close the Mac data/resource fork pair.

Definition at line 70 of file macresman.cpp.

String Common::MacResManager::computeResForkMD5AsString ( uint32  length = 0  )  const

Calculate the MD5 checksum of the resource fork.

Parameters:
length The maximum length to compute for
Returns:
The MD5 checksum of the resource fork

Definition at line 104 of file macresman.cpp.

String Common::MacResManager::constructAppleDoubleName ( String  name  )  [static, private]

Definition at line 678 of file macresman.cpp.

String Common::MacResManager::disassembleAppleDoubleName ( String  name,
bool *  isAppleDouble 
) [static, private]

Definition at line 694 of file macresman.cpp.

void Common::MacResManager::dumpRaw (  ) 

Dump contents of the archive to .

/dumps directory

Definition at line 722 of file macresman.cpp.

bool Common::MacResManager::exists ( const String fileName  )  [static]

See if a Mac data/resource fork pair exists.

Parameters:
fileName The base file name of the file
Returns:
True if either a data fork or resource fork with this name exists

Definition at line 257 of file macresman.cpp.

String Common::MacResManager::getBaseFileName (  )  const [inline]

Get the base file name of the data/resource fork pair.

Returns:
The base file name of the data/resource fork pair

Definition at line 171 of file macresman.h.

SeekableReadStream * Common::MacResManager::getDataFork (  ) 

Retrieve the data fork.

Returns:
The stream if present, 0 otherwise

Definition at line 480 of file macresman.cpp.

static int Common::MacResManager::getDataForkOffset (  )  [inline, static]

Definition at line 144 of file macresman.h.

uint32 Common::MacResManager::getResForkDataSize (  )  const

Get the size of the data portion of the resource fork.

Returns:
The size of the data portion of the resource fork

Definition at line 96 of file macresman.cpp.

MacResIDArray Common::MacResManager::getResIDArray ( uint32  typeID  ) 

Return list of resource IDs with specified type ID.

Definition at line 498 of file macresman.cpp.

String Common::MacResManager::getResName ( uint32  typeID,
uint16  resID 
) const

Get the name of a given resource.

Parameters:
typeID FourCC of the type
resID Resource ID to fetch
Returns:
The name of a given resource and an empty string if not present

Definition at line 533 of file macresman.cpp.

SeekableReadStream * Common::MacResManager::getResource ( uint32  typeID,
uint16  resID 
)

Read resource from the MacBinary file.

Parameters:
typeID FourCC of the type
resID Resource ID to fetch
Returns:
Pointer to a SeekableReadStream with loaded resource

Definition at line 552 of file macresman.cpp.

SeekableReadStream * Common::MacResManager::getResource ( const String filename  ) 

Read resource from the MacBinary file.

Note:
This will take the first resource that matches this name, regardless of type
Parameters:
filename file name of the resource
Returns:
Pointer to a SeekableReadStream with loaded resource

Definition at line 584 of file macresman.cpp.

SeekableReadStream * Common::MacResManager::getResource ( uint32  typeID,
const String filename 
)

Read resource from the MacBinary file.

Parameters:
typeID FourCC of the type
filename file name of the resource
Returns:
Pointer to a SeekableReadStream with loaded resource

Definition at line 603 of file macresman.cpp.

MacResTagArray Common::MacResManager::getResTagArray (  ) 

Return list of resource tags.

Definition at line 519 of file macresman.cpp.

bool Common::MacResManager::hasDataFork (  )  const

Query whether or not we have a data fork present.

Returns:
True if the data fork is present

Definition at line 88 of file macresman.cpp.

bool Common::MacResManager::hasResFork (  )  const

Query whether or not we have a data fork present.

Returns:
True if the resource fork is present

Definition at line 92 of file macresman.cpp.

bool Common::MacResManager::isMacBinary ( SeekableReadStream stream  )  [static]

Check if the given stream is in the MacBinary format.

Parameters:
stream The stream we're checking

Definition at line 373 of file macresman.cpp.

bool Common::MacResManager::isRawFork ( SeekableReadStream stream  )  [static, private]

Do a sanity check whether the given stream is a raw resource fork.

Parameters:
stream Stream object to check. Will not preserve its position.

Definition at line 403 of file macresman.cpp.

void Common::MacResManager::listFiles ( StringArray files,
const String pattern 
) [static]

List all filenames matching pattern for opening with open().

Parameters:
files Array containing all matching filenames discovered. Only adds to the list.
pattern Pattern to match against. Taking String::matchPattern's format.

Definition at line 278 of file macresman.cpp.

bool Common::MacResManager::load ( SeekableReadStream stream  )  [private]

Definition at line 452 of file macresman.cpp.

bool Common::MacResManager::loadFromAppleDouble ( SeekableReadStream stream  )  [private]

Definition at line 348 of file macresman.cpp.

bool Common::MacResManager::loadFromMacBinary ( SeekableReadStream stream  ) 

Load from stream in MacBinary format.

Definition at line 415 of file macresman.cpp.

bool Common::MacResManager::loadFromRawFork ( SeekableReadStream stream  )  [private]

Definition at line 445 of file macresman.cpp.

bool Common::MacResManager::open ( const String fileName  ) 

Open a Mac data/resource fork pair.

This uses SearchMan to find the data/resource forks. This should only be used from inside an engine.

Parameters:
fileName The base file name of the file
Note:
This will check for the raw resource fork, MacBinary, and AppleDouble formats.
Returns:
True on success

Definition at line 118 of file macresman.cpp.

bool Common::MacResManager::open ( const FSNode path,
const String fileName 
)

Open a Mac data/resource fork pair.

Parameters:
path The path that holds the forks
fileName The base file name of the file
Note:
This will check for the raw resource fork, MacBinary, and AppleDouble formats.
Returns:
True on success

Definition at line 183 of file macresman.cpp.

MacResManager::MacVers * Common::MacResManager::parseVers ( SeekableReadStream vvers  )  [static]

Definition at line 755 of file macresman.cpp.

void Common::MacResManager::readMap (  )  [private]

Definition at line 625 of file macresman.cpp.

void Common::MacResManager::setBaseFileName ( Common::String  str  )  [inline]

Definition at line 173 of file macresman.h.


Member Data Documentation

Definition at line 215 of file macresman.h.

Definition at line 277 of file macresman.h.

Definition at line 276 of file macresman.h.

Definition at line 279 of file macresman.h.

Definition at line 278 of file macresman.h.

enum { ... } Common::MacResManager::_mode [private]

Definition at line 273 of file macresman.h.

Definition at line 274 of file macresman.h.

Definition at line 282 of file macresman.h.

Definition at line 280 of file macresman.h.

Definition at line 281 of file macresman.h.

Definition at line 214 of file macresman.h.


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


Generated on Sat Sep 12 2020 05:04:26 for ResidualVM by doxygen 1.7.1
curved edge   curved edge