mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-03-18 03:40:54 +00:00
Updates SimXMLDocument, fsTiXmlDocument, Taml and TamlXmlParser for reading from zip.
This commit is contained in:
parent
8765d3a46e
commit
0ece989560
6 changed files with 67 additions and 68 deletions
|
|
@ -27,7 +27,7 @@ bool fsTiXmlDocument::LoadFile( const char * pFilename, TiXmlEncoding encoding )
|
|||
{
|
||||
// Expand the file-path.
|
||||
char filenameBuffer[1024];
|
||||
Con::expandToolScriptFilename( filenameBuffer, sizeof(filenameBuffer), pFilename );
|
||||
Con::expandScriptFilename( filenameBuffer, sizeof(filenameBuffer), pFilename );
|
||||
|
||||
FileStream stream;
|
||||
|
||||
|
|
@ -62,7 +62,7 @@ bool fsTiXmlDocument::SaveFile( const char * pFilename ) const
|
|||
{
|
||||
// Expand the file-name into the file-path buffer.
|
||||
char filenameBuffer[1024];
|
||||
Con::expandToolScriptFilename( filenameBuffer, sizeof(filenameBuffer), pFilename );
|
||||
Con::expandScriptFilename(filenameBuffer, sizeof(filenameBuffer), pFilename);
|
||||
|
||||
FileStream stream;
|
||||
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ ImplementEnumType(_TamlFormatMode,
|
|||
AssertFatal(pFilename != NULL, "Cannot read from a NULL filename.");
|
||||
|
||||
// Expand the file-name into the file-path buffer.
|
||||
Con::expandToolScriptFilename(mFilePathBuffer, sizeof(mFilePathBuffer), pFilename);
|
||||
Con::expandScriptFilename(mFilePathBuffer, sizeof(mFilePathBuffer), pFilename);
|
||||
|
||||
FileStream stream;
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "persistence/taml/xml/tamlXmlParser.h"
|
||||
#include "persistence/taml/fsTinyXml.h"
|
||||
#include "persistence/taml/tamlVisitor.h"
|
||||
#include "console/console.h"
|
||||
|
||||
|
|
@ -45,7 +46,7 @@ bool TamlXmlParser::accept( const char* pFilename, TamlVisitor& visitor )
|
|||
char filenameBuffer[1024];
|
||||
// TODO: Make sure this is a proper substitute for
|
||||
// Con::expandPath (T2D)
|
||||
Con::expandToolScriptFilename( filenameBuffer, sizeof(filenameBuffer), pFilename );
|
||||
Con::expandScriptFilename( filenameBuffer, sizeof(filenameBuffer), pFilename );
|
||||
/** T2D uses a custom version of TinyXML that supports FileStream.
|
||||
* We don't so we can't do this
|
||||
*
|
||||
|
|
@ -67,7 +68,7 @@ bool TamlXmlParser::accept( const char* pFilename, TamlVisitor& visitor )
|
|||
|
||||
*/
|
||||
|
||||
TiXmlDocument xmlDocument;
|
||||
fsTiXmlDocument xmlDocument;
|
||||
|
||||
// Load document from stream.
|
||||
if ( !xmlDocument.LoadFile( filenameBuffer ) )
|
||||
|
|
@ -87,7 +88,7 @@ bool TamlXmlParser::accept( const char* pFilename, TamlVisitor& visitor )
|
|||
mDocumentDirty = false;
|
||||
|
||||
// Parse root element.
|
||||
parseElement( xmlDocument.RootElement(), visitor );
|
||||
parseElement( (fsTiXmlElement*)xmlDocument.RootElement(), visitor );
|
||||
|
||||
// Reset parsing filename.
|
||||
setParsingFilename( StringTable->EmptyString() );
|
||||
|
|
@ -120,7 +121,7 @@ bool TamlXmlParser::accept( const char* pFilename, TamlVisitor& visitor )
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
inline bool TamlXmlParser::parseElement( TiXmlElement* pXmlElement, TamlVisitor& visitor )
|
||||
inline bool TamlXmlParser::parseElement( fsTiXmlElement* pXmlElement, TamlVisitor& visitor )
|
||||
{
|
||||
// Debug Profiling.
|
||||
PROFILE_SCOPE(TamlXmlParser_ParseElement);
|
||||
|
|
@ -140,7 +141,7 @@ inline bool TamlXmlParser::parseElement( TiXmlElement* pXmlElement, TamlVisitor&
|
|||
if ( pChildXmlNode != NULL && pChildXmlNode->Type() == TiXmlNode::TINYXML_ELEMENT )
|
||||
{
|
||||
// Iterate children.
|
||||
for ( TiXmlElement* pChildXmlElement = dynamic_cast<TiXmlElement*>( pChildXmlNode ); pChildXmlElement; pChildXmlElement = pChildXmlElement->NextSiblingElement() )
|
||||
for ( fsTiXmlElement* pChildXmlElement = dynamic_cast<fsTiXmlElement*>( pChildXmlNode ); pChildXmlElement; pChildXmlElement = (fsTiXmlElement*)pChildXmlElement->NextSiblingElement() )
|
||||
{
|
||||
// Parse element (stop processing if instructed).
|
||||
if ( !parseElement( pChildXmlElement, visitor ) )
|
||||
|
|
@ -153,7 +154,7 @@ inline bool TamlXmlParser::parseElement( TiXmlElement* pXmlElement, TamlVisitor&
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
inline bool TamlXmlParser::parseAttributes( TiXmlElement* pXmlElement, TamlVisitor& visitor )
|
||||
inline bool TamlXmlParser::parseAttributes( fsTiXmlElement* pXmlElement, TamlVisitor& visitor )
|
||||
{
|
||||
// Debug Profiling.
|
||||
PROFILE_SCOPE(TamlXmlParser_ParseAttribute);
|
||||
|
|
|
|||
|
|
@ -27,11 +27,8 @@
|
|||
#include "persistence/taml/tamlParser.h"
|
||||
#endif
|
||||
|
||||
#ifndef TINYXML_INCLUDED
|
||||
#include "tinyxml/tinyxml.h"
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
class fsTiXmlElement;
|
||||
|
||||
/// @ingroup tamlGroup
|
||||
/// @see tamlGroup
|
||||
|
|
@ -48,8 +45,8 @@ public:
|
|||
virtual bool accept( const char* pFilename, TamlVisitor& visitor );
|
||||
|
||||
private:
|
||||
inline bool parseElement( TiXmlElement* pXmlElement, TamlVisitor& visitor );
|
||||
inline bool parseAttributes( TiXmlElement* pXmlElement, TamlVisitor& visitor );
|
||||
inline bool parseElement( fsTiXmlElement* pXmlElement, TamlVisitor& visitor );
|
||||
inline bool parseAttributes( fsTiXmlElement* pXmlElement, TamlVisitor& visitor );
|
||||
|
||||
bool mDocumentDirty;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue