Initial commit

This commit is contained in:
alexpete
2021-03-05 11:26:34 -08:00
commit a10351f38d
27091 changed files with 5521199 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or the license accompanying this file. Do not
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
if (NOT PAL_TRAIT_BUILD_HOST_TOOLS)
return()
endif()
ly_add_target(
NAME CryXML MODULE
NAMESPACE Legacy
FILES_CMAKE
cryxml_files.cmake
INCLUDE_DIRECTORIES
PUBLIC
.
COMPILE_DEFINITIONS
PRIVATE
CRYTOOLS
RESOURCE_COMPILER
BUILD_DEPENDENCIES
PRIVATE
3rdParty::expat
Legacy::CryCommon
Legacy::CryCommonTools
)
+105
View File
@@ -0,0 +1,105 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Defines the entry point for the DLL application.
#include "CryXML_precompiled.h"
#include "CryAssert_impl.h"
#include "ICryXML.h"
#include "XMLSerializer.h"
#include <platform.h>
#include <CryCommon/ISystem.h>
class CryXML
: public ICryXML
{
public:
CryXML();
virtual void AddRef();
virtual void Release();
virtual IXMLSerializer* GetXMLSerializer();
private:
int nRefCount;
XMLSerializer serializer;
};
static CryXML* s_pCryXML = nullptr;
#if defined(AZ_PLATFORM_WINDOWS) && !defined(AZ_MONOLITHIC_BUILD)
BOOL APIENTRY DllMain([[maybe_unused]] HANDLE hModule, [[maybe_unused]] DWORD ul_reason_for_call, [[maybe_unused]] LPVOID lpReserved)
{
return TRUE;
}
#endif
extern "C" DLL_EXPORT ICryXML * __stdcall GetICryXML()
{
PREVENT_MODULE_AND_ENVIRONMENT_SYMBOL_STRIPPING
if (!s_pCryXML)
{
s_pCryXML = new CryXML;
}
return s_pCryXML;
}
CryXML::CryXML()
: nRefCount(0)
{
}
void CryXML::AddRef()
{
++this->nRefCount;
}
void CryXML::Release()
{
--this->nRefCount;
if (this->nRefCount == 0)
{
if (this == s_pCryXML)
{
s_pCryXML = nullptr;
}
delete this;
}
}
IXMLSerializer* CryXML::GetXMLSerializer()
{
return &this->serializer;
}
// STLPort requires folowing functions defined:
// when using STL Port _STLP_DEBUG and _STLP_DEBUG_TERMINATE - avoid actually
// crashing (default terminator seems to kill the thread, which isn't nice).
#ifdef _STLP_DEBUG_TERMINATE
void __stl_debug_terminate(void)
{
assert(0 && "STL Debug Error");
}
#endif
#ifdef _STLP_DEBUG_MESSAGE
void __stl_debug_message(const char* format_str, ...)
{
va_list __args;
va_start(__args, format_str);
vprintf(format_str, __args);
va_end(__args);
}
#endif //_STLP_DEBUG_MESSAGE
+3
View File
@@ -0,0 +1,3 @@
LIBRARY CryXML
EXPORTS
GetICryXML @1
+14
View File
@@ -0,0 +1,14 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
#include "CryXML_precompiled.h"
+32
View File
@@ -0,0 +1,32 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#include <cassert>
#define CRY_ASSERT(condition) assert(condition)
#define CRY_ASSERT_TRACE(condition, message) assert(condition)
#define CRY_ASSERT_MESSAGE(condition, message) assert(condition)
// Define this to prevent including CryAssert (there is no proper hook for turning this off, like the above).
#define CRYINCLUDE_CRYCOMMON_CRYASSERT_H
#define CRY_STRING
#include <platform.h>
#include "Cry_Math.h"
+34
View File
@@ -0,0 +1,34 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
#ifndef CRYINCLUDE_CRYXML_ICRYXML_H
#define CRYINCLUDE_CRYXML_ICRYXML_H
#pragma once
class IXMLSerializer;
class ICryXML
{
public:
virtual ~ICryXML() = default;
virtual void AddRef() = 0;
virtual void Release() = 0;
virtual IXMLSerializer* GetXMLSerializer() = 0;
};
// Prototype for the function that is exported by the DLL - use this function to
// get a pointer to an ICryXML object. The function is exported by name as GetICryXML().
typedef ICryXML* (* FnGetICryXML)();
#endif // CRYINCLUDE_CRYXML_ICRYXML_H
+68
View File
@@ -0,0 +1,68 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
#ifndef CRYINCLUDE_CRYXML_IXMLSERIALIZER_H
#define CRYINCLUDE_CRYXML_IXMLSERIALIZER_H
#pragma once
#include "IXml.h"
#include <cstdio>
class IXMLDataSink;
class IXMLDataSource;
struct IXmlBufferSource
{
virtual int Read(void* buffer, int size) const = 0;
};
class FileXmlBufferSource
: public IXmlBufferSource
{
public:
FileXmlBufferSource(const char* path)
{
file = nullptr;
azfopen(&file, path, "r");
}
~FileXmlBufferSource()
{
if (file)
{
std::fclose(file);
}
}
virtual int Read(void* buffer, int size) const
{
if (!file)
{
return 0;
}
return check_cast<int>(std::fread(buffer, 1, size, file));
}
private:
mutable std::FILE* file;
};
class IXMLSerializer
{
public:
virtual XmlNodeRef CreateNode(const char* tag) = 0;
virtual bool Write(XmlNodeRef root, const char* szFileName) = 0;
virtual XmlNodeRef Read(const IXmlBufferSource& source, bool bRemoveNonessentialSpacesFromContent, int nErrorBufferSize, char* szErrorBuffer) = 0;
};
#endif // CRYINCLUDE_CRYXML_IXMLSERIALIZER_H
File diff suppressed because it is too large Load Diff
+471
View File
@@ -0,0 +1,471 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
#ifndef CRYINCLUDE_CRYXML_XML_XML_H
#define CRYINCLUDE_CRYXML_XML_XML_H
#pragma once
#include <vector>
#include <set>
#include <algorithm>
#include "IXml.h"
struct IXmlBufferSource;
struct IXmlStringPool
{
public:
IXmlStringPool() { m_refCount = 0; }
virtual ~IXmlStringPool() {};
void AddRef() { m_refCount++; };
void Release()
{
if (--m_refCount <= 0)
{
delete this;
}
};
virtual char* AddString(const char* str) = 0;
private:
int m_refCount;
};
/************************************************************************/
/* XmlParser class, Parse xml and return root xml node if success. */
/************************************************************************/
class XmlParser
{
public:
explicit XmlParser(bool bRemoveNonessentialSpacesFromContent);
~XmlParser();
//! Parse xml file.
XmlNodeRef parse(const char* fileName);
//! Parse xml from memory buffer.
XmlNodeRef parseBuffer(const char* buffer);
XmlNodeRef parseSource(const IXmlBufferSource* source);
const char* getErrorString() const { return m_errorString; }
private:
XmlString m_errorString;
class XmlParserImp* m_pImpl;
};
// Compare function for string comparasion, can be strcmp or _stricmp
typedef int (__cdecl * XmlStrCmpFunc)(const char* str1, const char* str2);
extern XmlStrCmpFunc g_pXmlStrCmp;
//////////////////////////////////////////////////////////////////////////
// XmlAttribute class
//////////////////////////////////////////////////////////////////////////
struct XmlAttribute
{
const char* key;
const char* value;
bool operator<(const XmlAttribute& attr) const { return g_pXmlStrCmp(key, attr.key) < 0; }
bool operator>(const XmlAttribute& attr) const { return g_pXmlStrCmp(key, attr.key) > 0; }
bool operator==(const XmlAttribute& attr) const { return g_pXmlStrCmp(key, attr.key) == 0; }
bool operator!=(const XmlAttribute& attr) const { return g_pXmlStrCmp(key, attr.key) != 0; }
};
//! Xml node attributes class.
typedef std::vector<XmlAttribute> XmlAttributes;
typedef XmlAttributes::iterator XmlAttrIter;
typedef XmlAttributes::const_iterator XmlAttrConstIter;
/**
******************************************************************************
* CXmlNode class
* Never use CXmlNode directly instead use reference counted XmlNodeRef.
******************************************************************************
*/
class CXmlNode
: public IXmlNode
{
public:
//! Constructor.
CXmlNode();
CXmlNode(const char* tag);
//! Destructor.
~CXmlNode();
virtual void DeleteThis();
//! Create new XML node.
XmlNodeRef createNode(const char* tag);
//! Get XML node tag.
const char* getTag() const { return m_tag; };
void setTag(const char* tag);
//! Return true if given tag equal to node tag.
bool isTag(const char* tag) const;
//! Get XML Node attributes.
virtual int getNumAttributes() const { return (int)m_attributes.size(); };
//! Return attribute key and value by attribute index.
virtual bool getAttributeByIndex(int index, const char** key, const char** value);
virtual void copyAttributes(XmlNodeRef fromNode);
//! Get XML Node attribute for specified key.
const char* getAttr(const char* key) const;
//! Get XML Node attribute for specified key.
// Returns true if the attribute existes, alse otherwise.
bool getAttr(const char* key, const char** value) const;
//! Check if attributes with specified key exist.
bool haveAttr(const char* key) const;
//! Creates new xml node and add it to childs list.
XmlNodeRef newChild(const char* tagName);
//! Adds new child node.
void addChild(const XmlNodeRef& node);
//! Remove child node.
void removeChild(const XmlNodeRef& node);
void insertChild(int nIndex, const XmlNodeRef& node);
void replaceChild(int nIndex, const XmlNodeRef& node);
//! Remove all child nodes.
void removeAllChilds();
//! Get number of child XML nodes.
int getChildCount() const { return (int)m_childs.size(); };
//! Get XML Node child nodes.
XmlNodeRef getChild(int i) const;
//! Find node with specified tag.
XmlNodeRef findChild(const char* tag) const;
void deleteChild(const char* tag);
void deleteChildAt(int nIndex);
//! Get parent XML node.
XmlNodeRef getParent() const { return m_parent; }
void setParent(const XmlNodeRef& inRef);
//! Returns content of this node.
const char* getContent() const { return m_content.c_str(); };
void setContent(const char* str);
XmlNodeRef clone();
//! Returns line number for XML tag.
int getLine() const { return m_line; };
//! Set line number in xml.
void setLine(int line) { m_line = line; };
//! Returns XML of this node and sub nodes.
virtual IXmlStringData* getXMLData(int nReserveMem = 0) const;
XmlString getXML(int level = 0) const;
bool saveToFile(const char* fileName) override;
//! Set new XML Node attribute (or override attribute with same key).
void setAttr(const char* key, const char* value);
void setAttr(const char* key, int value);
void setAttr(const char* key, unsigned int value);
void setAttr(const char* key, int64 value);
void setAttr(const char* key, uint64 value, bool useHexFormat = true);
void setAttr(const char* key, float value);
void setAttr(const char* key, double value);
void setAttr(const char* key, const Vec2& value);
void setAttr(const char* key, const Vec2d& value);
void setAttr(const char* key, const Ang3& value);
void setAttr(const char* key, const Vec3& value);
void setAttr(const char* key, const Vec4& value);
void setAttr(const char* key, const Vec3d& value);
void setAttr(const char* key, const Quat& value);
//! Delete attrbute.
void delAttr(const char* key);
//! Remove all node attributes.
void removeAllAttributes();
//! Get attribute value of node.
bool getAttr(const char* key, int& value) const;
bool getAttr(const char* key, unsigned int& value) const;
bool getAttr(const char* key, int64& value) const;
bool getAttr(const char* key, uint64& value, bool useHexFormat = true /*ignored*/) const;
bool getAttr(const char* key, float& value) const;
bool getAttr(const char* key, double& value) const;
bool getAttr(const char* key, bool& value) const;
bool getAttr(const char* key, XmlString& value) const
{
XmlString v;
if (v = getAttr(key))
{
value = v;
return true;
}
else
{
return false;
}
}
bool getAttr(const char* key, Vec2& value) const;
bool getAttr(const char* key, Vec2d& value) const;
bool getAttr(const char* key, Ang3& value) const;
bool getAttr(const char* key, Vec3& value) const;
bool getAttr(const char* key, Vec3d& value) const;
bool getAttr(const char* key, Vec4& value) const;
bool getAttr(const char* key, Quat& value) const;
bool getAttr(const char* key, ColorB& value) const;
// bool getAttr( const char *key,string &value ) const { XmlString v; if (getAttr(key,v)) { value = (const char*)v; return true; } else return false; }
#if !defined(RESOURCE_COMPILER)
// <interfuscator:shuffle>
// Summary:
// Collect all allocated memory
void GetMemoryUsage([[maybe_unused]] ICrySizer* pSizer) const { assert(0); };
// Summary:
// Copies children to this node from a given node.
// Children are reference copied (shallow copy) and the children's parent is NOT set to this
// node, but left with its original parent (which is still the parent)
void shareChildren([[maybe_unused]] const XmlNodeRef& fromNode) { assert(0); };
// Summary:
// Returns XML of this node and sub nodes into tmpBuffer without XML checks (much faster)
XmlString getXMLUnsafe(int level, [[maybe_unused]] char* tmpBuffer, [[maybe_unused]] uint32 sizeOfTmpBuffer) const { return getXML(level); }
// Notes:
// Save in small memory chunks.
bool saveToFile([[maybe_unused]] const char* fileName, [[maybe_unused]] size_t chunkSizeBytes, [[maybe_unused]] AZ::IO::HandleType fileHandle = AZ::IO::InvalidHandle) override { assert(0); return false; };
// </interfuscator:shuffle>
#endif
private:
void AddToXmlString(XmlString& xml, int level) const;
XmlString MakeValidXmlString(const XmlString& xml) const;
bool IsValidXmlString(const char* str) const;
XmlAttrConstIter GetAttrConstIterator(const char* key) const
{
XmlAttribute tempAttr;
tempAttr.key = key;
XmlAttributes::const_iterator it = std::find(m_attributes.begin(), m_attributes.end(), tempAttr);
return it;
/*
XmlAttributes::const_iterator it = std::lower_bound( m_attributes.begin(),m_attributes.end(),tempAttr );
if (it != m_attributes.end() && _stricmp(it->key,key) == 0)
return it;
return m_attributes.end();
*/
}
XmlAttrIter GetAttrIterator(const char* key)
{
XmlAttribute tempAttr;
tempAttr.key = key;
XmlAttributes::iterator it = std::find(m_attributes.begin(), m_attributes.end(), tempAttr);
return it;
// XmlAttributes::iterator it = std::lower_bound( m_attributes.begin(),m_attributes.end(),tempAttr );
//if (it != m_attributes.end() && _stricmp(it->key,key) == 0)
//return it;
//return m_attributes.end();
}
const char* GetValue(const char* key) const
{
XmlAttrConstIter it = GetAttrConstIterator(key);
if (it != m_attributes.end())
{
return it->value;
}
return 0;
}
private:
//! Line in XML file where this node firstly appeared (usefull for debugging).
int m_line;
//! Tag of XML node.
const char* m_tag;
//! Content of XML node.
XmlString m_content;
//! Parent XML node.
CXmlNode* m_parent;
// String pool used by this node.
IXmlStringPool* m_pStringPool;
typedef std::vector<XmlNodeRef> XmlNodes;
XmlNodes m_childs;
//! Xml node attributes.
XmlAttributes m_attributes;
friend class XmlParserImp;
};
#endif // __XML_HEADER__
/*
#ifndef __XML_HEADER__
#define __XML_HEADER__
class CXmlNode : public IXmlNode
{
public:
//! Constructor.
CXmlNode( const char *tag );
//! Destructor.
~CXmlNode();
//////////////////////////////////////////////////////////////////////////
//! Reference counting.
void AddRef() { m_refCount++; };
//! When ref count reach zero XML node dies.
void Release();
//! Create new XML node.
XmlNodeRef createNode( const char *tag );
//! Get XML node tag.
const char *getTag() const { return m_tag; };
void setTag( const char *tag ) { m_tag = tag; }
//! Return true if givven tag equal to node tag.
bool isTag( const char *tag ) const;
//! Get XML Node attributes.
virtual int getNumAttributes() const { return (int)m_attributes.size(); };
//! Return attribute key and value by attribute index.
virtual bool getAttributeByIndex( int index,const char **key,const char **value );
virtual void* getFirstAttribute();
virtual bool getNextAttribute( void** pIterator,const char **key,const char **value );
virtual void copyAttributes( XmlNodeRef fromNode );
//! Get XML Node attribute for specified key.
const char* getAttr( const char *key ) const;
//! Check if attributes with specified key exist.
bool haveAttr( const char *key ) const;
//! Adds new child node.
void addChild( const XmlNodeRef &node );
//! Creates new xml node and add it to childs list.
XmlNodeRef newChild( const char *tagName );
//! Remove child node.
void removeChild( const XmlNodeRef &node );
//! Remove all child nodes.
void removeAllChilds();
//! Get number of child XML nodes.
int getChildCount() const { return (int)m_childs.size(); };
//! Get XML Node child nodes.
XmlNodeRef getChild( int i ) const;
//! Find node with specified tag.
XmlNodeRef findChild( const char *tag ) const;
//! Get parent XML node.
XmlNodeRef getParent() const { return m_parent; }
//! Returns content of this node.
const char* getContent() const { return m_content; };
void setContent( const char *str ) { m_content = str; };
void addContent( const char *str ) { m_content += str; };
XmlNodeRef clone();
//! Returns line number for XML tag.
int getLine() const { return m_line; };
//! Set line number in xml.
void setLine( int line ) { m_line = line; };
//! Returns XML of this node and sub nodes.
XmlString getXML( int level=0 ) const;
XmlString getBinaryXML() const;
bool saveToFile( const char *fileName, bool bBinary = false );
bool saveToSink(IXMLDataSink* pSink, bool bBinary = false);
//! Set new XML Node attribute (or override attribute with same key).
void setAttr( const char* key,const char* value );
void setAttr( const char* key,int value );
void setAttr( const char* key,unsigned int value );
void setAttr( const char* key,uint64 value );
void setAttr( const char* key,float value );
void setAttr( const char* key,const Ang3& value );
void setAttr( const char* key,const Vec3& value );
void setAttr( const char* key,const Quat &value );
//! Delete attribute.
void delAttr( const char* key );
//! Remove all node attributes.
void removeAllAttributes();
//! Get attribute value of node.
bool getAttr( const char *key,int &value ) const;
bool getAttr( const char *key,unsigned int &value ) const;
bool getAttr( const char *key,uint64 &value ) const;
bool getAttr( const char *key,float &value ) const;
bool getAttr( const char *key,Ang3& value ) const;
bool getAttr( const char *key,Vec3& value ) const;
bool getAttr( const char *key,Quat &value ) const;
bool getAttr( const char *key,bool &value ) const;
bool getAttr( const char *key,XmlString &value ) const { XmlString v; if (v=getAttr(key)) { value = v; return true; } else return false; }
// bool getAttr( const char *key,string &value ) const { XmlString v; if (getAttr(key,v)) { value = (const char*)v; return true; } else return false; }
// Add an attribute structure directly.
void addAttr(XmlAttribute& attribute);
void SetBuffer(StringBuffer* pStringBuffer);
private:
void AddToXmlString( XmlString &xml,int level ) const;
private:
StringBuffer* m_pStringBuffer;
//! Ref count itself, its zeroed on node creation.
int m_refCount;
//! Line in XML file where this node firstly appeared (usefull for debuggin).
int m_line;
//! Tag of XML node.
XmlString m_tag;
//! Content of XML node.
XmlString m_content;
//! Parent XML node.
CXmlNode *m_parent;
//! Next XML node in same hierarchy level.
typedef std::vector<XmlNodeRef> XmlNodes;
XmlNodes m_childs;
//! Xml node attributes.
XmlAttributes m_attributes;
static XmlAttribute tempAttr;
};
#endif // CRYINCLUDE_CRYXML_XML_XML_H
*/
+40
View File
@@ -0,0 +1,40 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
#include "CryXML_precompiled.h"
#include "XMLSerializer.h"
#include "XML/xml.h"
#include "IXMLSerializer.h"
#include "StringUtils.h"
XmlNodeRef XMLSerializer::CreateNode(const char* tag)
{
return new CXmlNode(tag);
}
bool XMLSerializer::Write(XmlNodeRef root, const char* szFileName)
{
return root->saveToFile(szFileName);
}
XmlNodeRef XMLSerializer::Read(const IXmlBufferSource& source, bool bRemoveNonessentialSpacesFromContent, int nErrorBufferSize, char* szErrorBuffer)
{
XmlParser parser(bRemoveNonessentialSpacesFromContent);
XmlNodeRef root = parser.parseSource(&source);
if (nErrorBufferSize > 0 && szErrorBuffer)
{
const char* const err = parser.getErrorString();
cry_strcpy(szErrorBuffer, nErrorBufferSize, err ? err : "");
}
return root;
}
+31
View File
@@ -0,0 +1,31 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
#ifndef CRYINCLUDE_CRYXML_XMLSERIALIZER_H
#define CRYINCLUDE_CRYXML_XMLSERIALIZER_H
#pragma once
#include "IXMLSerializer.h"
class XMLSerializer
: public IXMLSerializer
{
public:
virtual XmlNodeRef CreateNode(const char* tag);
virtual bool Write(XmlNodeRef root, const char* szFileName);
virtual XmlNodeRef Read(const IXmlBufferSource& source, bool bRemoveNonessentialSpacesFromContent, int nErrorBufferSize, char* szErrorBuffer);
};
#endif // CRYINCLUDE_CRYXML_XMLSERIALIZER_H
+22
View File
@@ -0,0 +1,22 @@
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or the license accompanying this file. Do not
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
set(FILES
CryXML.cpp
XMLSerializer.cpp
ICryXML.h
IXMLSerializer.h
XMLSerializer.h
XML/xml.cpp
XML/xml.h
CryXML_precompiled.h
CryXML_precompiled.cpp
)