CXSIParser Class Reference

Main class for the Softimage parser. More...

#include <XSIParser.h>

List of all members.

Public Member Functions

  CXSIParser ()
  Default Constructor.
  ~CXSIParser ()
  Default Destructor.
SI_Error  Open (const CSIBCString &in_filename)
SI_Bool  EndOfFile ()
SI_Error  Close ()
CSIBCString FileName ()
SI_Int  GetNbSupportedTemplates ()
SI_Char *  GetSupportedTemplate (SI_Int in_lIndex)
SI_Char *  GetNextTokenAsCharPtr ()
SI_Char *  GetNextTokenAsString ()
SI_Float  GetNextTokenAsFloat ()
SI_Int  GetNextTokenAsInteger ()
SI_Error  GetNextTokensAsFloatArray (SI_Int numFloats, SI_Int fileStepCount, SI_Int fileSkipCount, SI_Int arrayStepCount, SI_Int arraySkipCount, SI_Float *i_pArray)
SI_Error  GetNextTokensAsIntegerArray (SI_Int numInts, SI_Int fileStepCount, SI_Int fileSkipCount, SI_Int arrayStepCount, SI_Int arraySkipCount, SI_Int *i_pArray)
SI_Error  GetNextTokensAsUnsignedShortArray (SI_Int numUShorts, SI_Int fileStepCount, SI_Int fileSkipCount, SI_Int arrayStepCount, SI_Int arraySkipCount, SI_UShort *i_pArray)
SI_Char *  GetCurrentTokenAsCharPtr ()
SI_Float  GetCurrentTokenAsFloat ()
SI_Int  GetCurrentTokenAsInteger ()
SI_Error  GetNextPairAsFloat (SI_Float &fX, SI_Float &fY)
SI_Error  GetNextPairAsInt (SI_Int &nX, SI_Int &nY)
SI_Error  GetNextTrippletAsFloat (SI_Float &fX, SI_Float &fY, SI_Float &fZ)
SI_Error  GetNextTrippletAsInt (SI_Int &nX, SI_Int &nY, SI_Int &nZ)
SI_Void  SetOpenMode (SI_Int i_nMode)
SI_Int  GetOpenMode ()
SI_Int  CheckNextToken (CSIBCString *i_pReadString)
SI_Long  GetdotXSIFileVersionMajor ()
SI_Long  GetdotXSIFileVersionMinor ()
SI_Int  GetdotXSIFormat ()
SI_Void  SetdotXSIFormat (SI_Int dotXSIFormat)
SI_Int  GetdotXSISystemFlags ()
SI_Void  SetdotXSISystemFlags (SI_Int dotXSISystemFlags)
SI_Int  SetdotXSIFileVersion (SI_Int, SI_Int)
SI_Int  GetdotXSINumFileVersion ()
SI_Error  GetdotXSIFileVersion (int, int *, int *)
SI_Error  Read ()
SI_Error  Write ()
SI_Bool  ReadTemplate (CSIBCString *i_sTemplateName, CdotXSITemplate *i_pParent)
SI_Void  WriteTemplate (CdotXSITemplates *dotXSITemplates, SI_Int i_nInd, SI_Int i_nLevel)
CdotXSITemplates dotXSITemplate ()
CdotXSITemplates dotXSISupported ()
SI_Int  GetString ()
SI_Error  AddEscapeChar (const SI_Char *in_pStr, SI_Char *out_pStr)
SI_Error  ReadGenericParameters (CdotXSITemplate *i_pCurrentTemplate, CdotXSITemplate *i_pNewTemplate, SI_Int i_nNbParam)
SI_Error  ReadParameterValue (SI_TinyVariant *o_vValue, SI_Int i_nLastInt)
SI_Error  ReadCOLLADAParameterValue (SI_TinyVariant *o_vValue, char **in_pStream)
SI_Error  ReadIntegerArray (CdotXSITemplate *i_pNewTemplate, SI_Int i_nNbVertices, SI_Char *i_sName)
SI_Error  ReadFloatArray (CdotXSITemplate *i_pNewTemplate, SI_Int i_nNbVertices, SI_Char *i_sName)
SI_Error  ReadDoubleArray (CdotXSITemplate *i_pNewTemplate, SI_Int i_nNbVertices, SI_Char *i_sName)
SI_Void  WriteTabs (SI_Int i_nLevel)
SI_Void  WriteGenericParameters (CdotXSITemplate *i_pCurrentTemplate, SI_Int i_nNbParams, SI_Int i_nLevel)
SI_Void  WriteParameterValue (SI_TinyVariant *i_vValue, SI_Int i_nLevel, SI_Int in_nFlag=0)
SI_Void  RegisterdotXSINativeTemplates (SI_Long i_lMajor, SI_Long i_lMinor, SI_Int i_lFormat)
SI_Void  CleardotXSINativeTemplates ()
CdotXSITemplates GetdotXSINativeTemplates ()
SI_Int  FTK_Eof ()
SI_Int  FTK_Open (SI_Char *in_szName, _SI_FILE_MODE in_Mode)
SI_Int  FTK_Close ()
SI_Long  FTK_Read (void *out_pBuffer, SI_Long size, SI_Long count)
SI_Int  FTK_Write (void *in_pBuffer, SI_Long size, SI_Long count)
SI_Int  FTK_Printf (SI_Char *in_szData)
SI_Int  FTK_Seek (SI_Long in_lCount, SI_Int in_iMode)
SI_Long  FTK_Tell ()
SI_Int  FTK_FGetc ()
SI_Int  FTK_Getc ()
SI_Void  SetWarningCallback (SI_WARNING_CALLBACK_FNC in_pfncCallback)
SI_Void  FTK_Warning (SI_Char *in_szWarning, SI_Int in_iWarningLevel)
SI_Error  GetLastError ()
SI_Void  SetReadCallback (SI_READ_CALLBACK_FNC in_pCallback)
SI_READ_CALLBACK_FNC  GetReadCallback ()
SI_Void  ClearSkipTable ()
SI_Void  SkipTemplate (CSIBCString)


Detailed Description

Main class for the Softimage parser.


Member Function Documentation

SI_Error Open ( const CSIBCString in_filename  ) 

Opens the file for either reading or writing

Parameters:
[in]  in_filename  File to open
Returns:
Results of open

SI_Bool EndOfFile (  ) 

Tests whether we have reached the end of file

Return values:
SI_Bool::TRUE  if we are at the end of the file
SI_Bool::FALSE  otherwise

SI_Error Close (  ) 

Closes the file

Returns:
Whether the file was successfully closed or not

CSIBCString& FileName (  )  [inline]

Returns the current file name

Returns:
Filename

SI_Int GetNbSupportedTemplates (  ) 

Returns the total number of supported templates.

Returns:
Number of supported templates

SI_Char* GetSupportedTemplate ( SI_Int  in_lIndex  ) 

Returns the name of a supported template

Parameters:
[in]  in_lIndex  Index of template to find
Returns:
Template name

SI_Char* GetNextTokenAsCharPtr (  ) 

Returns the next token as a string

Returns:
Token

SI_Char* GetNextTokenAsString (  ) 

Returns the next token, turns it into a null-terminated string, and removes quotes

Returns:
Token

SI_Float GetNextTokenAsFloat (  ) 

Returns the next token as a float

Returns:
Token

SI_Int GetNextTokenAsInteger (  ) 

Returns the next token as an integer

Returns:
Token

SI_Error GetNextTokensAsFloatArray ( SI_Int  numFloats,
SI_Int  fileStepCount,
SI_Int  fileSkipCount,
SI_Int  arrayStepCount,
SI_Int  arraySkipCount,
SI_Float *  i_pArray  
)

Returns the next set of tokens into an array of floats according to the specified criteria

Parameters:
[in]  numFloats  number of floats to read
[in]  fileStepCount  number of sequential floats to read first
[in]  fileSkipCount  number of tokens to skip before reading the next sequence of floats
[in]  arrayStepCount  number of sequential floats to write to first
[in]  arraySkipCount  number of array indices to skip before writing the next sequence of floats
[out]  i_pArray  array of floats to read.
Returns:
Success/failure

SI_Error GetNextTokensAsIntegerArray ( SI_Int  numInts,
SI_Int  fileStepCount,
SI_Int  fileSkipCount,
SI_Int  arrayStepCount,
SI_Int  arraySkipCount,
SI_Int *  i_pArray  
)

Returns the next set of tokens into an array of ints according to the specified criteria

Parameters:
[in]  numInts  number of ints to read
[in]  fileStepCount  number of sequential ints to read first
[in]  fileSkipCount  number of tokens to skip before reading the next sequence of ints
[in]  arrayStepCount  number of sequential ints to write to first
[in]  arraySkipCount  number of array indices to skip before writing the next sequence of ints
[out]  i_pArray  array of ints to read.
Returns:
Success/failure

SI_Error GetNextTokensAsUnsignedShortArray ( SI_Int  numUShorts,
SI_Int  fileStepCount,
SI_Int  fileSkipCount,
SI_Int  arrayStepCount,
SI_Int  arraySkipCount,
SI_UShort *  i_pArray  
)

Returns the next set of tokens into an array of unsigned shorts according to the specified criteria

Parameters:
[in]  numUShorts  number of unsigned shorts to read
[in]  fileStepCount  number of sequential unsigned shorts to read first
[in]  fileSkipCount  number of tokens to skip before reading the next sequence of unsigned shorts
[in]  arrayStepCount  number of sequential unsigned shorts to write to first
[in]  arraySkipCount  number of array indices to skip before writing the next sequence of unsigned shorts
[in]  i_pArray  array of unsigned shorts to read.
Returns:
Success/failure

SI_Char* GetCurrentTokenAsCharPtr (  ) 

Returns the current token as a char pointer.

Returns:
Current token.

SI_Float GetCurrentTokenAsFloat (  ) 

Returns the current token as a float.

Returns:
Current token

SI_Int GetCurrentTokenAsInteger (  ) 

Returns the current token as an integer.

Returns:
Current token

SI_Error GetNextPairAsFloat ( SI_Float &  fX,
SI_Float &  fY  
)

Returns the next pair as a floating point number

Parameters:
[in]  fX  First value
[in]  fY  Second value
Returns:
Success/failure

SI_Error GetNextPairAsInt ( SI_Int &  nX,
SI_Int &  nY  
)

Returns the next pair as an integer.

Parameters:
[in]  nX  First value
[in]  nY  Second value
Returns:
Success/failure

SI_Error GetNextTrippletAsFloat ( SI_Float &  fX,
SI_Float &  fY,
SI_Float &  fZ  
)

Returns the next triplet as a float.

Parameters:
[in]  fX  First value
[in]  fY  Second value
[in]  fZ  Third value
Returns:
Success/failure

SI_Error GetNextTrippletAsInt ( SI_Int &  nX,
SI_Int &  nY,
SI_Int &  nZ  
)

Returns the next triplet as an integer.

Parameters:
[in]  nX  First value
[in]  nY  Second value
[in]  nZ  Third value
Returns:
Success/failure

SI_Void SetOpenMode ( SI_Int  i_nMode  ) 

Sets the Open mode

Parameters:
[in]  i_nMode  Mode that indicates whether the file is open for reading (OPEN_READ) or writing (OPEN_WRITE)

SI_Int GetOpenMode (  )  [inline]

Returns the Open mode

Return values:
SI_Int::OPEN_READ  Open for reading
SI_Int::OPEN_WRITE  Open for writing

SI_Int CheckNextToken ( CSIBCString i_pReadString  ) 

Checks the next token to verify whether they are children templates or not

Parameters:
[in]  i_pReadString  place holder for the token
Return values:
SI_Int::TRUE  Token is child template
SI_Int::FALSE  Otherwise

SI_Long GetdotXSIFileVersionMajor (  )  [inline]

Returns the the Major dotXSI File Version.

Returns:
Major version number

SI_Long GetdotXSIFileVersionMinor (  )  [inline]

Returns the the Minor dotXSI File Version.

Returns:
Minor version number

SI_Int GetdotXSIFormat (  )  [inline]

Returns the dotXSI file format.

Return values:
\c  0 text
\c  1 binary

SI_Void SetdotXSIFormat ( SI_Int  dotXSIFormat  )  [inline]

Sets the dotXSI file format.

Parameters:
[in]  dotXSIFormat  dotXSIFormat. Possible values include:
  • 0 text
  • 1 binary

SI_Int GetdotXSISystemFlags (  )  [inline]

Returns the dotXSI system flags

Returns:
System flags

SI_Void SetdotXSISystemFlags ( SI_Int  dotXSISystemFlags  )  [inline]

Sets the dotXSI system flags

Parameters:
[in]  dotXSISystemFlags  System flags.

SI_Int SetdotXSIFileVersion ( SI_Int  ,
SI_Int   
)

Sets the file version

SI_Int GetdotXSINumFileVersion (  ) 

Returns how many file versions are supported

Returns:
Number of supported version

SI_Error GetdotXSIFileVersion ( int  ,
int *  ,
int *   
)

Returns the Major and Minor numbers of a supported version

Returns:
Success/failure

SI_Error Read (  ) 

Reads the file as it was set in the parser.

SI_Error Write (  ) 

Writes the file as specified.

SI_Bool ReadTemplate ( CSIBCString i_sTemplateName,
CdotXSITemplate i_pParent  
)

Reads the templates recursively.

Parameters:
[in]  i_sTemplateName  Name of template.
[in]  i_pParent  Parent template.
Returns:
Success/failure

SI_Void WriteTemplate ( CdotXSITemplates dotXSITemplates,
SI_Int  i_nInd,
SI_Int  i_nLevel  
)

Recursive function to write out the templates

Parameters:
[in]  dotXSITemplates  Parent template collection
[in]  i_nInd  Index of the children (which children in the collection we are exporting)
[in]  i_nLevel  Indentation (how much to indent to keep the look indented as we nest down).

CdotXSITemplates* dotXSITemplate (  )  [inline]

Returns the template collection of the Parser (only the top-level ones).

Returns:
Template collection

CdotXSITemplates* dotXSISupported (  )  [inline]

Returns the template collection supported for the current version

Returns:
Template collection

SI_Int GetString (  ) 

Returns a string as read (should not be used)

Returns:
Read string

SI_Error AddEscapeChar ( const SI_Char *  in_pStr,
SI_Char *  out_pStr  
)

Adds an escape character in front of invalid ones (ie. \" )

Parameters:
[in]  in_pStr  Input string
[out]  out_pStr  Modified string.
Returns:
Success/failure

SI_Error ReadGenericParameters ( CdotXSITemplate i_pCurrentTemplate,
CdotXSITemplate i_pNewTemplate,
SI_Int  i_nNbParam  
)

Reads the parameters which are generic (no special cases).

Reads the parameters into the new template based on the parameter list from the current template. This is used by most of the callbacks because most of the templates have some generic parameters that can be read in batch.

Parameters:
[in]  i_pCurrentTemplate  Current template
[in]  i_pNewTemplate  New template (starts out as empty)
[in]  i_nNbParam  Number of parameters to read.
Return values:
SI_Error::SI_SUCCESS  The parameters were read correctly.
SI_Error::SI_ERR_BAD_ELEMENT  There was an error reading a parameter.

SI_Error ReadParameterValue ( SI_TinyVariant o_vValue,
SI_Int  i_nLastInt  
)

Reads the next value into the specified variant. The value to read is based on the type of the variant.

Parameters:
[out]  o_vValue  Variant to write the value to
[in]  i_nLastInt  Unused.
Return values:
SI_Error::SI_SUCCESS  The parameter was read correctly.
SI_Error::SI_ERR_BAD_ELEMENT  There was an error reading the parameter.

SI_Error ReadCOLLADAParameterValue ( SI_TinyVariant o_vValue,
char **  in_pStream  
)

Reads the next value into the specified variant in a COLLADA document. The value to read is based on the type of the variant.

Parameters:
[out]  o_vValue  Variant to write the value to
[in]  in_pStream  Character stream to parse
Return values:
SI_Error::SI_SUCCESS  The parameter was read correctly.
SI_Error::SI_ERR_BAD_ELEMENT  There was an error reading the parameter.

SI_Error ReadIntegerArray ( CdotXSITemplate i_pNewTemplate,
SI_Int  i_nNbVertices,
SI_Char *  i_sName  
)

Reads an array of integers into a named parameter

Parameters:
[in]  i_pNewTemplate  Template to add the new parameter to
[in]  i_nNbVertices  Number of integers to read
[in]  i_sName  Name of the new argument.
Return values:
SI_Error::SI_SUCCESS  The parameter was read correctly.
SI_Error::SI_ERR_BAD_ELEMENT  There was an error reading the parameter.

SI_Error ReadFloatArray ( CdotXSITemplate i_pNewTemplate,
SI_Int  i_nNbVertices,
SI_Char *  i_sName  
)

Reads an array of floats into a named parameter

Parameters:
[in]  i_pNewTemplate  Template to add the new parameter to
[in]  i_nNbVertices  Number of floats to read
[in]  i_sName  Name of the new argument.
Return values:
SI_Error::SI_SUCCESS  The parameter was read correctly.
SI_Error::SI_ERR_BAD_ELEMENT  There was an error reading the parameter.

SI_Error ReadDoubleArray ( CdotXSITemplate i_pNewTemplate,
SI_Int  i_nNbVertices,
SI_Char *  i_sName  
)

Reads an array of doubles into a named parameter

Parameters:
[in]  i_pNewTemplate  Template to add the new parameter to
[in]  i_nNbVertices  Number of doubles to read
[in]  i_sName  Name of the new argument.
Return values:
SI_Error::SI_SUCCESS  The parameter was read correctly.
SI_Error::SI_ERR_BAD_ELEMENT  There was an error reading the parameter.

SI_Void WriteTabs ( SI_Int  i_nLevel  ) 

Indents the output by so many levels.

Parameters:
[in]  i_nLevel  Number of levels to indent per line of output.

SI_Void WriteGenericParameters ( CdotXSITemplate i_pCurrentTemplate,
SI_Int  i_nNbParams,
SI_Int  i_nLevel  
)

Writes out the parameters that are generic from a given template

Parameters:
[in]  i_pCurrentTemplate  Template to write from
[in]  i_nNbParams  Number of parameters to output
[in]  i_nLevel  Current level (for indentation).

SI_Void WriteParameterValue ( SI_TinyVariant i_vValue,
SI_Int  i_nLevel,
SI_Int  in_nFlag = 0  
)

Generic parameter write. This is used by most of the callbacks because most of the templates have some generic parameters that can be written in batch.

Parameters:
[in]  i_vValue  Variant holding the value to output
[in]  i_nLevel  Current level for indentation
[in]  in_nFlag  Unused

SI_Void RegisterdotXSINativeTemplates ( SI_Long  i_lMajor,
SI_Long  i_lMinor,
SI_Int  i_lFormat  
)

Registers the supported templates for a given version

Parameters:
[in]  i_lMajor  Major version requested
[in]  i_lMinor  Minor version requested
[in]  i_lFormat  File format (FORMAT_TEXT, FORMAT_BINARY, FORMAT_COLLADA)

SI_Void CleardotXSINativeTemplates (  ) 

Clears the list of supported templates (this is called prior to RegisterdotXSINativeTemplates).

See also:
RegisterdotXSINativeTemplates

CdotXSITemplates* GetdotXSINativeTemplates (  ) 

Returns the current list of native templates.

Returns:
Collection of CdotXSITemplate objects

SI_Int FTK_Eof (  ) 

Tests whether we have reached the end of file

Return values:
\c  1 if we are at the end of the file
\c  0 otherwise

SI_Int FTK_Open ( SI_Char *  in_szName,
_SI_FILE_MODE  in_Mode  
)

Opens the filter for either reading or writing

Parameters:
[in]  in_szName  Filter to open
[in]  in_Mode  Whether to read (OPEN_READ) or write (OPEN_WRITE)
Returns:
Whether the file was successfully opened or not

SI_Int FTK_Close (  ) 

Closes the filter when finished

Returns:
Whether the filter was successfully closed or not

SI_Long FTK_Read ( void *  out_pBuffer,
SI_Long  size,
SI_Long  count  
)

Reads a number of bytes into the buffer passed in.

Parameters:
[out]  out_pBuffer  Output buffer
[in]  size  Number of bytes to read per object
[in]  count  Size of eash object
Returns:
number of bytes read.

SI_Int FTK_Write ( void *  in_pBuffer,
SI_Long  size,
SI_Long  count  
)

Writes a number of bytes to the filter

Parameters:
[in]  in_pBuffer  Input buffer
[in]  size  Number of bytes to read per object
[in]  count  Size of eash object
Returns:
number of bytes written

SI_Int FTK_Printf ( SI_Char *  in_szData  ) 

Prints an already formatted string as output.

Parameters:
[in]  in_szData  Formatted string to print
Return values:
\c  0

SI_Int FTK_Seek ( SI_Long  in_lCount,
SI_Int  in_iMode  
)

Moves the current position the specified number of bytes according to the specified Seek mode.

Parameters:
[in]  in_lCount  Number of bytes to move
[in]  in_iMode  How to move. Valid values are:
  • SEEK_SET Relative to start
  • SEEK_CUR Relative to end
  • SEEK_END Relative to current
Returns:
0

SI_Long FTK_Tell (  ) 

Returns the current position

Returns:
Position in the file (0 - beginning)

SI_Int FTK_FGetc (  ) 

Returns the next byte.

Returns:
Next byte

SI_Int FTK_Getc (  ) 

Returns the next byte. This is just an alias for CXSIParser::FTK_FGetc

Returns:
Next byte

SI_Void SetWarningCallback ( SI_WARNING_CALLBACK_FNC  in_pfncCallback  ) 

Initializes the Warning callback with a user-defined function.

Parameters:
[in]  in_pfncCallback  Function pointer to receive all warning messages.

SI_Void FTK_Warning ( SI_Char *  in_szWarning,
SI_Int  in_iWarningLevel  
)

Outputs a warning to the callback (or default if not set).

Parameters:
[in]  in_szWarning  Warning message
[in]  in_iWarningLevel  Type of warning (SI_MESSAGE, SI_WARNING, SI_ERROR)

SI_Error GetLastError (  )  [inline]

Returns the last error that occurred in the parser.

Returns:
The error code indicating the last error that occurred.

SI_Void SetReadCallback ( SI_READ_CALLBACK_FNC  in_pCallback  ) 

Initializes the Read callback with a user defined function.

Parameters:
[in]  in_pCallback  Callback function to use.

SI_READ_CALLBACK_FNC GetReadCallback (  ) 

Returns the current Read callback

Returns:
Read callback

SI_Void ClearSkipTable (  ) 

Clears the template skip table

SI_Void SkipTemplate ( CSIBCString   ) 

Adds a template name to the skip table. All templates of this name will be skipped when writing the file


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