My Project
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
ParaEngine::XFileParser Class Reference

The XFileParser reads a XFile either in text or binary form and builds a temporary data structure out of it. More...

#include <XFileParser.h>

Inheritance diagram for ParaEngine::XFileParser:
ParaEngine::XFileCharModelParser ParaEngine::XFileStaticModelParser

Public Member Functions

 XFileParser (const char *pBuffer, int32 nSize)
 Constructor. More...
 
 ~XFileParser ()
 Destructor. More...
 
XFile::SceneGetImportedData (bool bGiveupDataOwnerhip=false)
 Returns the temporary representation of the imported data. More...
 
XFileDataObjectPtr CreateEnumObject ()
 

Protected Member Functions

void ParseHeader ()
 
void ParseFile ()
 
void ParseDataObjectTemplate ()
 
void ParseDataObjectFrame (XFile::Node *pParent)
 
void ParseDataObjectTransformationMatrix (Matrix4 &pMatrix)
 
void ParseDataObjectMesh (XFile::Mesh *pMesh)
 
void ParseDataObjectMeshNormals (XFile::Mesh *pMesh)
 
void ParseDataObjectMeshTextureCoords (XFile::Mesh *pMesh)
 
void ParseDataObjectMeshVertexColors (XFile::Mesh *pMesh)
 
void ParseDataObjectMeshMaterialList (XFile::Mesh *pMesh)
 
void ParseDataObjectMaterial (XFile::Material *pMaterial)
 
void ParseDataObjectTextureFilename (std::string &pName)
 
void ParseDataObjectParaXHeader (ParaXHeaderDef &pName)
 
bool ParseUnknownDataObject ()
 
void FindNextNoneWhiteSpace ()
 places pointer to next begin of a token, and ignores comments
 
std::string GetNextToken ()
 returns next parseable token. Returns empty string if no token there
 
bool IsEndOfFile ()
 
void readHeadOfDataObject (std::string *poName=NULL)
 reads header of dataobject including the opening brace. More...
 
void CheckForClosingBrace ()
 checks for closing curly brace, throws exception if not there More...
 
void CheckForSemicolon ()
 checks for one following semicolon, throws exception if not there More...
 
void CheckForSeparator ()
 checks for a separator char, either a ',' or a ';'
 
void TestForSeparator ()
 tests and possibly consumes a separator char, but does nothing if there was no separator
 
void GetNextTokenAsString (std::string &poString)
 reads a x file style string
 
void ReadUntilEndOfLine ()
 
void ReadToEndOfDataObject ()
 
uint16 ReadBinWord ()
 
uint32 ReadBinDWord ()
 
uint32 ReadInt ()
 
float ReadFloat ()
 
Vector2 ReadVector2 ()
 
Vector3 ReadVector3 ()
 
Vector3 ReadRGB ()
 
LinearColor ReadRGBA ()
 
void ReadCharArray (char *sOutput, int nCount)
 
void ThrowException (const std::string &pText)
 Throws an exception with a line number and the given text. More...
 
void FilterHierarchy (XFile::Node *pNode)
 Filters the imported hierarchy for some degenerated cases that some exporters produce. More...
 

Protected Attributes

uint32 mMajorVersion
 
uint32 mMinorVersion
 version numbers
 
bool mIsBinaryFormat
 true if the file is in binary, false if it's in text form
 
uint32 mBinaryFloatSize
 float size in bytes, either 4 or 8
 
uint32 mBinaryNumCount
 
const char * P
 
const char * End
 
uint32 mLineNumber
 Line number when reading in text format.
 
XFile::ScenemScene
 Imported data.
 

Friends

class XFileDataObject
 

Detailed Description

The XFileParser reads a XFile either in text or binary form and builds a temporary data structure out of it.

Constructor & Destructor Documentation

§ XFileParser()

ParaEngine::XFileParser::XFileParser ( const char *  pBuffer,
int32  nSize 
)

Constructor.

Creates a data structure out of the XFile given in the memory block.

Parameters
pBufferNull-terminated memory buffer containing the XFile

§ ~XFileParser()

ParaEngine::XFileParser::~XFileParser ( )

Destructor.

Destroys all imported data along with it

Member Function Documentation

§ CheckForClosingBrace()

void XFileParser::CheckForClosingBrace ( )
protected

checks for closing curly brace, throws exception if not there

checks for closing curly brace

§ CheckForSemicolon()

void XFileParser::CheckForSemicolon ( )
protected

checks for one following semicolon, throws exception if not there

checks for one following semicolon

§ FilterHierarchy()

void XFileParser::FilterHierarchy ( XFile::Node pNode)
protected

Filters the imported hierarchy for some degenerated cases that some exporters produce.

Parameters
pDataThe sub-hierarchy to filter

§ GetImportedData()

XFile::Scene * ParaEngine::XFileParser::GetImportedData ( bool  bGiveupDataOwnerhip = false)

Returns the temporary representation of the imported data.

Parameters
bGiveupDataOwnerhipif true, the parse will given up buffer ownership.

§ readHeadOfDataObject()

void XFileParser::readHeadOfDataObject ( std::string *  poName = NULL)
protected

reads header of dataobject including the opening brace.

returns false if error happened, and writes name of object if there is one

§ ThrowException()

void XFileParser::ThrowException ( const std::string &  pText)
protected

Throws an exception with a line number and the given text.


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