MIffFile Class Reference
[OpenMaya - API module for common classes]

#include <MIffFile.h>

List of all members.


Detailed Description

Read file images stored on disk.

This class provides a simple C++ interface to the IFF i/o library (flib). A class called MIffTag is used to create the 4 byte tags that are used to distinguish the different block types within an IFF file.

Examples:

geometryCacheConverter.cpp, geometryCacheFile.cpp, and geometryCacheFile.h.


Public Member Functions

  MIffFile ()
  MIffFile (const MString &fileName)
virtual  ~MIffFile ()
MStatus  open (const MString &fileName)
MStatus  close ()
bool  isActive () const
MStatus  beginReadGroup (MIffTag &id, MIffTag &type)
MStatus  endReadGroup ()
const void *  getChunk (MIffTag &chunkTag, unsigned *byteCount)
MStatus  beginGet (MIffTag &chunkTag, unsigned *byteCount)
MStatus  endGet ()
int  get (void *buf, unsigned byteCount, MStatus *stat=NULL)
MStatus  iffGetShort (short int &result)
MStatus  iffGetInt (int &result)
MStatus  iffGetFloat (float &result)

Constructor & Destructor Documentation

MIffFile::MIffFile (  ) 

Default class constructor.

MIffFile::MIffFile ( const MString fileName  ) 

Alternate class constructor. Opens the specified file for reading.

Parameters:
[in]  fileName  The file name (full path).

MIffFile::~MIffFile (  )  [virtual]

Destructor.


Member Function Documentation

MStatus MIffFile::open ( const MString fileName  ) 

Opens the file for reading.

Returns:

MStatus MIffFile::close (  ) 

Close the currently open file.

Returns:
Examples:

bool MIffFile::isActive (  )  const

Is the file currently active?

Returns:
True if the file is active, false otherwise.

MStatus MIffFile::beginReadGroup ( MIffTag id,
MIffTag type  
)

Opens a group for reading. A group is composed of several chunks (sub-groups). Provides the id and type of the current group. Can be followed by several calls to chunk reading functions or to nested beginReadGroup(...) calls if needed (depending on the file structure). The function endReadGroup(...) is used to closed a group skipping remaining data (including nested groups).

Returns:

MStatus MIffFile::endReadGroup (  ) 

Closes group currently being read, skipping remaining data (including nested groups).

Returns:

const void * MIffFile::getChunk ( MIffTag chunkTag,
unsigned *  byteCount  
)

Opens a chunk for reading. A chunk is a block of unstructured data with an associated tag.

Returns:
  • Returns a pointer to the data, who's content should not be modified.
  • NULL if the read was not successful.

MStatus MIffFile::beginGet ( MIffTag chunkTag,
unsigned *  byteCount  
)

Begin grabbing the data.

Returns:
MS::kSuccess if the read was successful, MS::kFailure otherwise.

MStatus MIffFile::endGet (  ) 

Finish grabbing the data.

Returns:
MS::kSuccess if successful, MS::kFailure otherwise.

int MIffFile::get ( void *  buf,
unsigned  byteCount,
MStatus ReturnStatus = NULL  
)

Attempt to read 'byteCount' bytes from the file into the buffer pointed to by buf.

Returns:
Number of bytes read if successful.
Status Codes:

MStatus MIffFile::iffGetShort ( short int &  result  ) 

Grabs a short from the active file.

Returns:

MStatus MIffFile::iffGetInt ( int &  result  ) 

Grabs an integer from the active file.

Returns:
  • MS::kSuccess if the open was successful,
  • MS::fFailure otherwise.

MStatus MIffFile::iffGetFloat ( float &  result  ) 

Grabs a float from the active file.

Returns:

Autodesk® Maya® 2011 © 1997-2010 Autodesk, Inc. All rights reserved. Generated with doxygen 1.5.6