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  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.
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.

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().

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 isMacBinary (SeekableReadStream &stream)
 Check if the given stream is in the MacBinary format.
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 239 of file macresman.h.


Member Enumeration Documentation

anonymous enum [private]
Enumerator:
kResForkNone 
kResForkRaw 
kResForkMacBinary 
kResForkAppleDouble 

Definition at line 209 of file macresman.h.


Constructor & Destructor Documentation

Common::MacResManager::MacResManager (  ) 

Definition at line 49 of file macresman.cpp.

Common::MacResManager::~MacResManager (  ) 

Definition at line 54 of file macresman.cpp.


Member Function Documentation

void Common::MacResManager::close (  ) 

Close the Mac data/resource fork pair.

Definition at line 58 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 92 of file macresman.cpp.

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

Definition at line 662 of file macresman.cpp.

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

Definition at line 678 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 244 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 167 of file macresman.h.

SeekableReadStream * Common::MacResManager::getDataFork (  ) 

Retrieve the data fork.

Returns:
The stream if present, 0 otherwise

Definition at line 464 of file macresman.cpp.

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 84 of file macresman.cpp.

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

Return list of resource IDs with specified type ID.

Definition at line 482 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 517 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 536 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 568 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 587 of file macresman.cpp.

MacResTagArray Common::MacResManager::getResTagArray (  ) 

Return list of resource tags.

Definition at line 503 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 76 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 80 of file macresman.cpp.

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

Check if the given stream is in the MacBinary format.

Parameters:
stream The stream we're checking

Definition at line 360 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 388 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 265 of file macresman.cpp.

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

Definition at line 436 of file macresman.cpp.

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

Definition at line 335 of file macresman.cpp.

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

Load from stream in MacBinary format.

Definition at line 400 of file macresman.cpp.

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

Definition at line 429 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 106 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 170 of file macresman.cpp.

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

Definition at line 609 of file macresman.cpp.


Member Data Documentation

Definition at line 186 of file macresman.h.

Definition at line 245 of file macresman.h.

Definition at line 244 of file macresman.h.

Definition at line 247 of file macresman.h.

Definition at line 246 of file macresman.h.

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

Definition at line 241 of file macresman.h.

Definition at line 242 of file macresman.h.

Definition at line 250 of file macresman.h.

Definition at line 248 of file macresman.h.

Definition at line 249 of file macresman.h.

Definition at line 185 of file macresman.h.


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


Generated on Sat Nov 9 2019 05:01:55 for ResidualVM by doxygen 1.7.1
curved edge   curved edge