Commit 15bd9597 authored by cutealien's avatar cutealien

Add _IRR_COMPILE_WITH_XML_ define to allow compiling Irrlicht without xml (patch written by curaga)


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4423 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 5457c5e5
-------------------------- --------------------------
Changes in 1.9 (not yet released) Changes in 1.9 (not yet released)
- Add _IRR_COMPILE_WITH_XML_ define to allow compiling Irrlicht without xml (patch written by curaga)
- Add functions to set/get cursor character and blinktime to IGUIEditBox - Add functions to set/get cursor character and blinktime to IGUIEditBox
- Collada exporter calculates values for orthographic camera now on export - Collada exporter calculates values for orthographic camera now on export
- Collada exporter now exports the camera up-vector correctly. - Collada exporter now exports the camera up-vector correctly.
......
...@@ -116,6 +116,12 @@ ...@@ -116,6 +116,12 @@
//! Maximum number of texture an SMaterial can have, up to 8 are supported by Irrlicht. //! Maximum number of texture an SMaterial can have, up to 8 are supported by Irrlicht.
#define _IRR_MATERIAL_MAX_TEXTURES_ 4 #define _IRR_MATERIAL_MAX_TEXTURES_ 4
//! Whether to support XML and XML-based formats (irrmesh, collada...)
#define _IRR_COMPILE_WITH_XML_
#ifdef NO_IRR_COMPILE_WITH_XML_
#undef _IRR_COMPILE_WITH_XML_
#endif
//! Define _IRR_COMPILE_WITH_DIRECT3D_8_ and _IRR_COMPILE_WITH_DIRECT3D_9_ to //! Define _IRR_COMPILE_WITH_DIRECT3D_8_ and _IRR_COMPILE_WITH_DIRECT3D_9_ to
//! compile the Irrlicht engine with Direct3D8 and/or DIRECT3D9. //! compile the Irrlicht engine with Direct3D8 and/or DIRECT3D9.
/** If you only want to use the software device or opengl you can disable those defines. /** If you only want to use the software device or opengl you can disable those defines.
...@@ -792,5 +798,13 @@ precision will be lower but speed higher. currently X86 only ...@@ -792,5 +798,13 @@ precision will be lower but speed higher. currently X86 only
#undef __IRR_HAS_S64 #undef __IRR_HAS_S64
#endif #endif
// These depend on XML
#ifndef _IRR_COMPILE_WITH_XML_
#undef _IRR_COMPILE_WITH_IRR_MESH_LOADER_
#undef _IRR_COMPILE_WITH_IRR_WRITER_
#undef _IRR_COMPILE_WITH_COLLADA_WRITER_
#undef _IRR_COMPILE_WITH_COLLADA_LOADER_
#endif
#endif // __IRR_COMPILE_CONFIG_H_INCLUDED__ #endif // __IRR_COMPILE_CONFIG_H_INCLUDED__
...@@ -416,6 +416,7 @@ namespace io ...@@ -416,6 +416,7 @@ namespace io
See IIrrXMLReader for description on how to use it. */ See IIrrXMLReader for description on how to use it. */
typedef IIrrXMLReader<char32, IXMLBase> IrrXMLReaderUTF32; typedef IIrrXMLReader<char32, IXMLBase> IrrXMLReaderUTF32;
#ifdef _IRR_COMPILE_WITH_XML_
//! Creates an instance of an UFT-8 or ASCII character xml parser. //! Creates an instance of an UFT-8 or ASCII character xml parser.
/** This means that all character data will be returned in 8 bit ASCII or UTF-8. /** This means that all character data will be returned in 8 bit ASCII or UTF-8.
...@@ -537,6 +538,7 @@ namespace io ...@@ -537,6 +538,7 @@ namespace io
IRRLICHT_API IrrXMLReaderUTF32* IRRCALLCONV createIrrXMLReaderUTF32(IFileReadCallBack* callback, IRRLICHT_API IrrXMLReaderUTF32* IRRCALLCONV createIrrXMLReaderUTF32(IFileReadCallBack* callback,
bool deleteCallback = false); bool deleteCallback = false);
#endif // _IRR_COMPILE_WITH_XML_
/*! \file irrXML.h /*! \file irrXML.h
\brief Header file of the irrXML, the Irrlicht XML parser. \brief Header file of the irrXML, the Irrlicht XML parser.
......
...@@ -8,6 +8,10 @@ ...@@ -8,6 +8,10 @@
#include "IXMLWriter.h" #include "IXMLWriter.h"
#include "IVideoDriver.h" #include "IVideoDriver.h"
#ifndef _IRR_COMPILE_WITH_XML_
#include "CXMLReader.h" // for noXML
#endif
namespace irr namespace irr
{ {
namespace io namespace io
...@@ -1408,6 +1412,7 @@ void CAttributes::setAttribute(s32 index, void* userPointer) ...@@ -1408,6 +1412,7 @@ void CAttributes::setAttribute(s32 index, void* userPointer)
bool CAttributes::read(io::IXMLReader* reader, bool readCurrentElementOnly, bool CAttributes::read(io::IXMLReader* reader, bool readCurrentElementOnly,
const wchar_t* nonDefaultElementName) const wchar_t* nonDefaultElementName)
{ {
#ifdef _IRR_COMPILE_WITH_XML_
if (!reader) if (!reader)
return false; return false;
...@@ -1440,11 +1445,16 @@ bool CAttributes::read(io::IXMLReader* reader, bool readCurrentElementOnly, ...@@ -1440,11 +1445,16 @@ bool CAttributes::read(io::IXMLReader* reader, bool readCurrentElementOnly,
} }
return true; return true;
#else
noXML();
return false;
#endif
} }
void CAttributes::readAttributeFromXML(io::IXMLReader* reader) void CAttributes::readAttributeFromXML(io::IXMLReader* reader)
{ {
#ifdef _IRR_COMPILE_WITH_XML_
core::stringw element = reader->getNodeName(); core::stringw element = reader->getNodeName();
core::stringc name = reader->getAttributeValue(L"name"); core::stringc name = reader->getAttributeValue(L"name");
...@@ -1593,12 +1603,16 @@ void CAttributes::readAttributeFromXML(io::IXMLReader* reader) ...@@ -1593,12 +1603,16 @@ void CAttributes::readAttributeFromXML(io::IXMLReader* reader)
addDimension2d(name.c_str(), core::dimension2d<u32>()); addDimension2d(name.c_str(), core::dimension2d<u32>());
Attributes.getLast()->setString(reader->getAttributeValue(L"value")); Attributes.getLast()->setString(reader->getAttributeValue(L"value"));
} }
#else
noXML();
#endif
} }
//! Write these attributes into a xml file //! Write these attributes into a xml file
bool CAttributes::write(io::IXMLWriter* writer, bool writeXMLHeader, bool CAttributes::write(io::IXMLWriter* writer, bool writeXMLHeader,
const wchar_t* nonDefaultElementName) const wchar_t* nonDefaultElementName)
{ {
#ifdef _IRR_COMPILE_WITH_XML_
if (!writer) if (!writer)
return false; return false;
...@@ -1657,6 +1671,10 @@ bool CAttributes::write(io::IXMLWriter* writer, bool writeXMLHeader, ...@@ -1657,6 +1671,10 @@ bool CAttributes::write(io::IXMLWriter* writer, bool writeXMLHeader,
writer->writeLineBreak(); writer->writeLineBreak();
return true; return true;
#else
noXML();
return false;
#endif
} }
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#ifndef __C_ATTRIBUTES_H_INCLUDED__ #ifndef __C_ATTRIBUTES_H_INCLUDED__
#define __C_ATTRIBUTES_H_INCLUDED__ #define __C_ATTRIBUTES_H_INCLUDED__
#include "IrrCompileConfig.h"
#include "IAttributes.h" #include "IAttributes.h"
#include "IAttribute.h" #include "IAttribute.h"
......
...@@ -994,6 +994,7 @@ bool CFileSystem::existFile(const io::path& filename) const ...@@ -994,6 +994,7 @@ bool CFileSystem::existFile(const io::path& filename) const
//! Creates a XML Reader from a file. //! Creates a XML Reader from a file.
IXMLReader* CFileSystem::createXMLReader(const io::path& filename) IXMLReader* CFileSystem::createXMLReader(const io::path& filename)
{ {
#ifdef _IRR_COMPILE_WITH_XML_
IReadFile* file = createAndOpenFile(filename); IReadFile* file = createAndOpenFile(filename);
if (!file) if (!file)
return 0; return 0;
...@@ -1001,22 +1002,32 @@ IXMLReader* CFileSystem::createXMLReader(const io::path& filename) ...@@ -1001,22 +1002,32 @@ IXMLReader* CFileSystem::createXMLReader(const io::path& filename)
IXMLReader* reader = createXMLReader(file); IXMLReader* reader = createXMLReader(file);
file->drop(); file->drop();
return reader; return reader;
#else
noXML();
return 0;
#endif
} }
//! Creates a XML Reader from a file. //! Creates a XML Reader from a file.
IXMLReader* CFileSystem::createXMLReader(IReadFile* file) IXMLReader* CFileSystem::createXMLReader(IReadFile* file)
{ {
#ifdef _IRR_COMPILE_WITH_XML_
if (!file) if (!file)
return 0; return 0;
return createIXMLReader(file); return createIXMLReader(file);
#else
noXML();
return 0;
#endif
} }
//! Creates a XML Reader from a file. //! Creates a XML Reader from a file.
IXMLReaderUTF8* CFileSystem::createXMLReaderUTF8(const io::path& filename) IXMLReaderUTF8* CFileSystem::createXMLReaderUTF8(const io::path& filename)
{ {
#ifdef _IRR_COMPILE_WITH_XML_
IReadFile* file = createAndOpenFile(filename); IReadFile* file = createAndOpenFile(filename);
if (!file) if (!file)
return 0; return 0;
...@@ -1024,22 +1035,32 @@ IXMLReaderUTF8* CFileSystem::createXMLReaderUTF8(const io::path& filename) ...@@ -1024,22 +1035,32 @@ IXMLReaderUTF8* CFileSystem::createXMLReaderUTF8(const io::path& filename)
IXMLReaderUTF8* reader = createIXMLReaderUTF8(file); IXMLReaderUTF8* reader = createIXMLReaderUTF8(file);
file->drop(); file->drop();
return reader; return reader;
#else
noXML();
return 0;
#endif
} }
//! Creates a XML Reader from a file. //! Creates a XML Reader from a file.
IXMLReaderUTF8* CFileSystem::createXMLReaderUTF8(IReadFile* file) IXMLReaderUTF8* CFileSystem::createXMLReaderUTF8(IReadFile* file)
{ {
#ifdef _IRR_COMPILE_WITH_XML_
if (!file) if (!file)
return 0; return 0;
return createIXMLReaderUTF8(file); return createIXMLReaderUTF8(file);
#else
noXML();
return 0;
#endif
} }
//! Creates a XML Writer from a file. //! Creates a XML Writer from a file.
IXMLWriter* CFileSystem::createXMLWriter(const io::path& filename) IXMLWriter* CFileSystem::createXMLWriter(const io::path& filename)
{ {
#ifdef _IRR_COMPILE_WITH_XML_
IWriteFile* file = createAndWriteFile(filename); IWriteFile* file = createAndWriteFile(filename);
IXMLWriter* writer = 0; IXMLWriter* writer = 0;
if (file) if (file)
...@@ -1048,13 +1069,22 @@ IXMLWriter* CFileSystem::createXMLWriter(const io::path& filename) ...@@ -1048,13 +1069,22 @@ IXMLWriter* CFileSystem::createXMLWriter(const io::path& filename)
file->drop(); file->drop();
} }
return writer; return writer;
#else
noXML();
return 0;
#endif
} }
//! Creates a XML Writer from a file. //! Creates a XML Writer from a file.
IXMLWriter* CFileSystem::createXMLWriter(IWriteFile* file) IXMLWriter* CFileSystem::createXMLWriter(IWriteFile* file)
{ {
#ifdef _IRR_COMPILE_WITH_XML_
return new CXMLWriter(file); return new CXMLWriter(file);
#else
noXML();
return 0;
#endif
} }
......
...@@ -2,8 +2,10 @@ ...@@ -2,8 +2,10 @@
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
#include "CXMLReaderImpl.h"
#include "CXMLReader.h" #include "CXMLReader.h"
#ifdef _IRR_COMPILE_WITH_XML_
#include "CXMLReaderImpl.h"
#include "IReadFile.h" #include "IReadFile.h"
namespace irr namespace irr
...@@ -68,3 +70,15 @@ namespace io ...@@ -68,3 +70,15 @@ namespace io
} // end namespace } // end namespace
} // end namespace } // end namespace
#else // not _IRR_COMPILE_WITH_XML_
#include "os.h"
namespace irr
{
void noXML()
{
irr::os::Printer::log("XML support disabled in IrrCompileConfig.", irr::ELL_ERROR);
}
} // end namespace
#endif // _IRR_COMPILE_WITH_XML_
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
namespace irr namespace irr
{ {
#ifdef _IRR_COMPILE_WITH_XML_
namespace io namespace io
{ {
class IReadFile; class IReadFile;
...@@ -18,8 +19,11 @@ namespace io ...@@ -18,8 +19,11 @@ namespace io
//! creates an IXMLReader //! creates an IXMLReader
IXMLReaderUTF8* createIXMLReaderUTF8(IReadFile* file); IXMLReaderUTF8* createIXMLReaderUTF8(IReadFile* file);
} // end namespace irr } // end namespace irr
#else // _IRR_COMPILE_WITH_XML_
//! print a message that Irrlicht is compiled without _IRR_COMPILE_WITH_XML_
void noXML();
#endif // _IRR_COMPILE_WITH_XML_
} // end namespace io } // end namespace io
#endif #endif
......
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
#include "CXMLWriter.h" #include "CXMLWriter.h"
#ifdef _IRR_COMPILE_WITH_XML_
#include <wchar.h> #include <wchar.h>
#include "irrString.h" #include "irrString.h"
#include "IrrCompileConfig.h" #include "IrrCompileConfig.h"
...@@ -255,3 +258,4 @@ void CXMLWriter::writeLineBreak() ...@@ -255,3 +258,4 @@ void CXMLWriter::writeLineBreak()
} // end namespace irr } // end namespace irr
} // end namespace io } // end namespace io
#endif // _IRR_COMPILE_WITH_XML_
...@@ -5,8 +5,11 @@ ...@@ -5,8 +5,11 @@
#ifndef __C_XML_WRITER_H_INCLUDED__ #ifndef __C_XML_WRITER_H_INCLUDED__
#define __C_XML_WRITER_H_INCLUDED__ #define __C_XML_WRITER_H_INCLUDED__
#include <wchar.h>
#include "IXMLWriter.h" #include "IXMLWriter.h"
#ifdef _IRR_COMPILE_WITH_XML_
#include <wchar.h>
#include "IWriteFile.h" #include "IWriteFile.h"
namespace irr namespace irr
...@@ -72,5 +75,7 @@ namespace io ...@@ -72,5 +75,7 @@ namespace io
} // end namespace irr } // end namespace irr
} // end namespace io } // end namespace io
#endif // _IRR_COMPILE_WITH_XML_
#endif #endif
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
// For conditions of distribution and use, see copyright notice in irrlicht.h and/or irrXML.h // For conditions of distribution and use, see copyright notice in irrlicht.h and/or irrXML.h
#include "irrXML.h" #include "irrXML.h"
#ifdef _IRR_COMPILE_WITH_XML_
#include "irrString.h" #include "irrString.h"
#include "irrArray.h" #include "irrArray.h"
#include "fast_atof.h" #include "fast_atof.h"
...@@ -178,3 +181,5 @@ IRRLICHT_API IrrXMLReaderUTF32* IRRCALLCONV createIrrXMLReaderUTF32( ...@@ -178,3 +181,5 @@ IRRLICHT_API IrrXMLReaderUTF32* IRRCALLCONV createIrrXMLReaderUTF32(
} // end namespace io } // end namespace io
} // end namespace irr } // end namespace irr
#endif // _IRR_COMPILE_WITH_XML_
...@@ -905,6 +905,8 @@ bool twodmaterial() ...@@ -905,6 +905,8 @@ bool twodmaterial()
bool result = true; bool result = true;
TestWithAllDrivers(addBlend2d); TestWithAllDrivers(addBlend2d);
TestWithAllDrivers(moreFilterTests); TestWithAllDrivers(moreFilterTests);
#ifdef _IRR_COMPILE_WITH_XML_
TestWithAllDrivers(draw2DImage4c); TestWithAllDrivers(draw2DImage4c);
#endif
return result; return result;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment