CXSIParser Class Reference
Main class for the XSI 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 XSI parser.
Member Function Documentation
Opens a file for either reading or writing
- Parameters:
-
Checks whether we are at the end of file
Closes the file
Returns the current file name
- Returns:
- CSIBCString Filename
| SI_Int GetNbSupportedTemplates |
( |
|
) |
|
returns the total number of supported templates.
- Returns:
- SI_Int number
| SI_Char* GetSupportedTemplate |
( |
SI_Int |
in_lIndex |
) |
|
returns the name of a supported template
- Returns:
- SI_Char * template name
| SI_Char* GetNextTokenAsCharPtr |
( |
|
) |
|
returns the next token as a string
- Returns:
- SI_Char * token
| SI_Char* GetNextTokenAsString |
( |
|
) |
|
returns the next token and turns it into a null terminated string and removes quotes
- Returns:
- SI_Char * token
| SI_Float GetNextTokenAsFloat |
( |
|
) |
|
returns the next token as a float
- Returns:
- SI_Float token
| SI_Int GetNextTokenAsInteger |
( |
|
) |
|
returns the next token as an integer
- Returns:
- SI_Int 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 tokens into an array of floats
- Parameters:
-
|
|
numFloats |
number of floats to read |
|
|
fileStepCount |
number of sequential floats to read first |
|
|
fileSkipCount |
number of tokens to skip before reading the next sequence of floats |
|
|
arrayStepCount |
number of sequential floats to write to first |
|
|
arraySkipCount |
number of array indices to skip before writing the next sequence of floats |
|
|
i_pArray |
array of floats to read. |
- Returns:
- SI_Error
| 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 tokens into an array of Ints
- Parameters:
-
|
|
numFloats |
number of ints to read |
|
|
fileStepCount |
number of sequential ints to read first |
|
|
fileSkipCount |
number of tokens to skip before reading the next sequence of ints |
|
|
arrayStepCount |
number of sequential ints to write to first |
|
|
arraySkipCount |
number of array indices to skip before writing the next sequence of ints |
|
|
i_pArray |
array of ints to read. |
- Returns:
- SI_Error
| 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 tokens into an array of Unsigned Shorts
- Parameters:
-
|
|
numFloats |
number of Unsigned Shorts to read |
|
|
fileStepCount |
number of sequential Unsigned Shorts to read first |
|
|
fileSkipCount |
number of tokens to skip before reading the next sequence of Unsigned Shorts |
|
|
arrayStepCount |
number of sequential Unsigned Shorts to write to first |
|
|
arraySkipCount |
number of array indices to skip before writing the next sequence of Unsigned Shorts |
|
|
i_pArray |
array of Unsigned Shorts to read. |
- Returns:
- SI_Error
| SI_Char* GetCurrentTokenAsCharPtr |
( |
|
) |
|
Get the current token as a Char Pointer.
- Returns:
- SI_Char * current token.
| SI_Float GetCurrentTokenAsFloat |
( |
|
) |
|
Get the current token as a Float.
- Returns:
- SI_Float returns current token
| SI_Int GetCurrentTokenAsInteger |
( |
|
) |
|
Get the current token as a Integer.
- Returns:
- SI_Int returns current token
| SI_Error GetNextPairAsFloat |
( |
SI_Float & |
fX, |
|
|
|
SI_Float & |
fY |
|
|
|
) |
|
|
|
Gets the next pair as a floating point number
- Parameters:
-
|
|
fX |
First value |
|
|
fY |
Second value |
| SI_Error GetNextPairAsInt |
( |
SI_Int & |
nX, |
|
|
|
SI_Int & |
nY |
|
|
|
) |
|
|
|
Gets the next pair as a Integer number
- Parameters:
-
|
|
fX |
First value |
|
|
fY |
Second value |
| SI_Error GetNextTrippletAsFloat |
( |
SI_Float & |
fX, |
|
|
|
SI_Float & |
fY, |
|
|
|
SI_Float & |
fZ |
|
|
|
) |
|
|
|
Gets the next tripplet as a floating point number.
- Parameters:
-
|
|
fX |
First value |
|
|
fY |
Second value |
|
|
fZ |
Third value |
| SI_Error GetNextTrippletAsInt |
( |
SI_Int & |
nX, |
|
|
|
SI_Int & |
nY, |
|
|
|
SI_Int & |
nZ |
|
|
|
) |
|
|
|
Gets the next tripplet as a Integer number.
- Parameters:
-
|
|
fX |
First value |
|
|
fY |
Second value |
|
|
fZ |
Third value |
| SI_Void SetOpenMode |
( |
SI_Int |
i_nMode |
) |
|
Sets the Open Mode
- Parameters:
-
| SI_Int GetOpenMode |
( |
|
) |
[inline] |
Returns the Input Mode
- Returns:
- The current input mode.
Check the next token to verify wheter they are children templates or not
- Parameters:
-
|
|
i_pReadString |
place holder for the token |
- Returns:
- TRUE/FALSE
| SI_Long GetdotXSIFileVersionMajor |
( |
|
) |
[inline] |
returns the the Major XSI File Version.
- Returns:
- SI_Long Major version number
| SI_Long GetdotXSIFileVersionMinor |
( |
|
) |
[inline] |
returns the the Minor XSI File Version.
- Returns:
- SI_Long Minor version number
| SI_Int GetdotXSIFormat |
( |
|
) |
[inline] |
Returns the dotXSI file Format.
- Returns:
- SI_Int (0 text, 1 binary)
| SI_Void SetdotXSIFormat |
( |
SI_Int |
dotXSIFormat |
) |
[inline] |
Sets the dotXSI file Format.
- Parameters:
-
|
|
Sets |
the format (0 - text, 1 - binary). |
| SI_Int GetdotXSISystemFlags |
( |
|
) |
[inline] |
Returns the System Flags
- Returns:
- SI_Int System flags
| SI_Void SetdotXSISystemFlags |
( |
SI_Int |
dotXSISystemFlags |
) |
[inline] |
Sets the System flags
- Parameters:
-
| SI_Int SetdotXSIFileVersion |
( |
SI_Int |
, |
|
|
|
SI_Int |
|
|
|
|
) |
|
|
|
Sets the file version
- Parameters:
-
|
|
SI_Int |
Major version |
|
|
SI_Int |
Minor version |
| SI_Int GetdotXSINumFileVersion |
( |
|
) |
|
Returns how many file version is supported
- Returns:
- SI_Int number of supported version
| SI_Error GetdotXSIFileVersion |
( |
int |
, |
|
|
|
int * |
, |
|
|
|
int * |
|
|
|
|
) |
|
|
|
Returns the Major & Minor number of a given supported version
- Parameters:
-
|
|
SI_Int |
Which version number to query |
|
|
SI_Long* |
Major version returned |
|
|
SI_Long* |
Minor version returned. |
Reads the file as it was set in the parser.
Writes the file as specified.
Recursive function to read the templates.
- Parameters:
-
|
|
CSIBCString* |
name of template. |
|
|
CdotXSITemplate* |
Parent template. |
| SI_Void WriteTemplate |
( |
CdotXSITemplates * |
dotXSITemplates, |
|
|
|
SI_Int |
i_nInd, |
|
|
|
SI_Int |
i_nLevel |
|
|
|
) |
|
|
|
Recursive function to write out the templates
- Parameters:
-
|
|
CdotXSITemplates* |
Parent template collection |
|
|
SI_Int |
Index of the children (which children in the collection we are exporting) |
|
|
SI_Int |
Indentation (how much to indent to keep the look indented as we nest down). |
Returns the template collection of the Parser (only the toplevel ones).
- Returns:
- CdotXSITemplates* collection
Returns the template collection supported for the current version
- Returns:
- CdotXSITemplates* collection
Returns a string as read (should not be used)
| SI_Error AddEscapeChar |
( |
const SI_Char * |
in_pStr, |
|
|
|
SI_Char * |
out_pStr |
|
|
|
) |
|
|
|
adds an escape character in front of invalid ones (ie. \" )
- Parameters:
-
|
|
in_pStr |
Input String |
|
|
out_pStr |
Resulting String. |
This function is used to read the parameters which are generic (no special cases). Reads the parameters into the new template based on the parameter list from the current template. Generic parameter read. This is used by most of the callbacks because most of the templates have some generic parameters that can be read in batch.
- Parameters:
-
|
|
i_pCurrentTemplate |
current template |
|
|
i_pNewTemplate |
New template (starts empty) |
|
|
i_nNbParam |
Number of parameters to read. |
- Returns:
- SI_Error Error code indicating the success or failure of this command.
Possible values:
SI_SUCCESS - The parameters were read correctly. SI_ERR_BAD_ELEMENT - There was an error reading a parameter.
Reads the next value based on the type expected in the Variant
- Parameters:
-
|
|
o_vValue |
Variant to receive the value based on its type. |
|
|
i_nLastInt |
unused. |
- Returns:
- SI_Error Error code indicating the success or failure of this command.
Possible values:
SI_SUCCESS - The parameter was read correctly. SI_ERR_BAD_ELEMENT - There was an error reading the parameter.
Reads the next value based on the type expected in the Variant in a COLLADA document
- Parameters:
-
|
|
o_vValue |
Variant to receive the value based on its type. |
|
|
in_pStream |
character stream to parse |
- Returns:
- SI_Error Error code indicating the success or failure of this command.
Possible values:
SI_SUCCESS - The parameter was read correctly. SI_ERR_BAD_ELEMENT - There was an error reading the parameter.
Reads an array of integers into a named parameter
- Parameters:
-
|
|
i_pNewTemplate |
template to add the new parameter to |
|
|
i_nNbVertices |
number of integers to read |
|
|
i_sName |
Name of the new argument. |
- Returns:
- SI_Error Error code indicating the success or failure of this command.
Possible values:
SI_SUCCESS - The array was read correctly. SI_ERR_BAD_ELEMENT - There was an error reading the array.
Reads an array of floats into a named parameter
- Parameters:
-
|
|
i_pNewTemplate |
template to add the new parameter to |
|
|
i_nNbVertices |
number of floats to read |
|
|
i_sName |
Name of the new argument. |
- Returns:
- SI_Error Error code indicating the success or failure of this command.
Possible values:
SI_SUCCESS - The array was read correctly. SI_ERR_BAD_ELEMENT - There was an error reading the array.
Reads an array of doubles into a named parameter
- Parameters:
-
|
|
i_pNewTemplate |
template to add the new parameter to |
|
|
i_nNbVertices |
number of floats to read |
|
|
i_sName |
Name of the new argument. |
- Returns:
- SI_Error Error code indicating the success or failure of this command.
Possible values:
SI_SUCCESS - The array was read correctly. SI_ERR_BAD_ELEMENT - There was an error reading the array.
| SI_Void WriteTabs |
( |
SI_Int |
i_nLevel |
) |
|
Indent the output by so many levels. This is per line of output.
- Parameters:
-
|
|
i_nLevel |
Number of levels to indent. |
| SI_Void WriteGenericParameters |
( |
CdotXSITemplate * |
i_pCurrentTemplate, |
|
|
|
SI_Int |
i_nNbParams, |
|
|
|
SI_Int |
i_nLevel |
|
|
|
) |
|
|
|
Write out the parameters that are generic from a given template
- Parameters:
-
|
|
i_pCurrentTemplate |
Template to write from |
|
|
i_nNbParams |
Number of parameters to output |
|
|
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:
-
|
|
i_vValue |
Variant holding the value to output |
|
|
i_nLevel |
Current level for indentation |
|
|
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:
-
|
|
i_lMajor |
Major version requested |
|
|
i_lMinor |
Minor version requested |
| SI_Void CleardotXSINativeTemplates |
( |
|
) |
|
Clears the list of supported template (this is called prior to RegisterdotXSINativeTemplates).
- See also:
- RegisterdotXSINativeTemplates
Retrieves the current list of native templates.
Function to return whether we are at the end of file.
- Returns:
- 1 for eof, 0 otherwise
| SI_Int FTK_Open |
( |
SI_Char * |
in_szName, |
|
|
|
_SI_FILE_MODE |
in_Mode |
|
|
|
) |
|
|
|
Opens the file for filter for reading or writing
- Parameters:
-
|
|
in_szName |
Filename |
|
|
in_Mode |
Open Mode |
Closes the filter
| SI_Long FTK_Read |
( |
void * |
out_pBuffer, |
|
|
|
SI_Long |
size, |
|
|
|
SI_Long |
count |
|
|
|
) |
|
|
|
Reads from the Filter
- Parameters:
-
|
|
out_pBuffer |
Buffer to receive the read data |
|
|
size |
number of bytes to read per object |
|
|
count |
size of eash object |
| SI_Int FTK_Write |
( |
void * |
in_pBuffer, |
|
|
|
SI_Long |
size, |
|
|
|
SI_Long |
count |
|
|
|
) |
|
|
|
Writes to the Filter
- Parameters:
-
|
|
in_pBuffer |
Buffer to write to filter |
|
|
size |
number of bytes to read per object |
|
|
count |
size of eash object |
| SI_Int FTK_Printf |
( |
SI_Char * |
in_szData |
) |
|
Prints an already formatted string as output.
| SI_Int FTK_Seek |
( |
SI_Long |
in_lCount, |
|
|
|
SI_Int |
in_iMode |
|
|
|
) |
|
|
|
Seeks to a given position
- Parameters:
-
|
|
in_lCount |
Number of bytes to seek |
|
|
in_iMode |
How to move (relative to start, relative to end, relative to current) |
Returns the current position
Returns the next byte.
Returns the next byte.
Initializes the Warning callback with a user defined function.
- Parameters:
-
|
|
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_szWarning |
Warning message |
|
|
in_iWarningLevel |
Level (SI_MESSAGE, SI_WARNING, SI_ERROR) |
Returns the last error that occurred in the parser.
- Returns:
- SI_Error 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_pCallback |
Callback function to use. |
| SI_READ_CALLBACK_FNC GetReadCallback |
( |
|
) |
|
Returns the current Read Callback
| SI_Void ClearSkipTable |
( |
|
) |
|
Clears the template skip table
- Returns:
- nothing
Adds a template name to the skip table. All templates of this name will be skipped when writing the file
- Returns:
- nothing
The documentation for this class was generated from the following file: