Drop XML implementation, related code and dependent features

This commit is contained in:
sfan5
2021-07-07 16:52:49 +02:00
parent ecb30e3d96
commit 729c214c00
60 changed files with 10 additions and 15350 deletions

View File

@ -23,8 +23,6 @@
#include "line3d.h"
#include "irrString.h"
#include "irrArray.h"
#include "IXMLReader.h"
#include "IXMLWriter.h"
#include "EAttributes.h"
#include "path.h"
@ -76,20 +74,6 @@ public:
//! Removes all attributes
virtual void clear() = 0;
//! Reads attributes from a xml file.
//! \param reader The XML reader to read from
//! \param readCurrentElementOnly If set to true, reading only works if current element has the name 'attributes' or
//! the name specified using elementName.
//! \param elementName The surrounding element name. If it is null, the default one, "attributes" will be taken.
//! If set to false, the first appearing list of attributes are read.
virtual bool read(io::IXMLReader* reader, bool readCurrentElementOnly=false, const wchar_t* elementName=0) = 0;
//! Write these attributes into a xml file
//! \param writer: The XML writer to write to
//! \param writeXMLHeader: Writes a header to the XML file, required if at the beginning of the file
//! \param elementName: The surrounding element name. If it is null, the default one, "attributes" will be taken.
virtual bool write(io::IXMLWriter* writer, bool writeXMLHeader=false, const wchar_t* elementName=0) = 0;
/*

View File

@ -1,456 +0,0 @@
// Copyright (C) 2002-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __IRR_I_COLLADA_MESH_WRITER_H_INCLUDED__
#define __IRR_I_COLLADA_MESH_WRITER_H_INCLUDED__
#include "IMeshWriter.h"
#include "ISceneNode.h"
#include "IAnimatedMesh.h"
#include "SMaterial.h"
namespace irr
{
namespace io
{
class IWriteFile;
} // end namespace io
namespace scene
{
//! Lighting models - more or less the way Collada categorizes materials
enum E_COLLADA_TECHNIQUE_FX
{
//! Blinn-phong which is default for opengl and dx fixed function pipelines.
//! But several well-known renderers don't support it and prefer phong.
ECTF_BLINN,
//! Phong shading, default in many external renderers.
ECTF_PHONG,
//! diffuse shaded surface that is independent of lighting.
ECTF_LAMBERT,
// constantly shaded surface that is independent of lighting.
ECTF_CONSTANT
};
//! How to interpret the opacity in collada
enum E_COLLADA_TRANSPARENT_FX
{
//! default - only alpha channel of color or texture is used.
ECOF_A_ONE = 0,
//! Alpha values for each RGB channel of color or texture are used.
ECOF_RGB_ZERO = 1
};
//! Color names collada uses in it's color samplers
enum E_COLLADA_COLOR_SAMPLER
{
ECCS_DIFFUSE,
ECCS_AMBIENT,
ECCS_EMISSIVE,
ECCS_SPECULAR,
ECCS_TRANSPARENT,
ECCS_REFLECTIVE
};
//! Irrlicht colors which can be mapped to E_COLLADA_COLOR_SAMPLER values
enum E_COLLADA_IRR_COLOR
{
//! Don't write this element at all
ECIC_NONE,
//! Check IColladaMeshWriterProperties for custom color
ECIC_CUSTOM,
//! Use SMaterial::DiffuseColor
ECIC_DIFFUSE,
//! Use SMaterial::AmbientColor
ECIC_AMBIENT,
//! Use SMaterial::EmissiveColor
ECIC_EMISSIVE,
//! Use SMaterial::SpecularColor
ECIC_SPECULAR
};
//! Control when geometry elements are created
enum E_COLLADA_GEOMETRY_WRITING
{
//! Default - write each mesh exactly once to collada. Optimal but will not work with many tools.
ECGI_PER_MESH,
//! Write each mesh as often as it's used with different materials-names in the scene.
//! Material names which are used here are created on export, so using the IColladaMeshWriterNames
//! interface you have some control over how many geometries are written.
ECGI_PER_MESH_AND_MATERIAL
};
//! Callback interface for properties which can be used to influence collada writing
class IColladaMeshWriterProperties : public virtual IReferenceCounted
{
public:
virtual ~IColladaMeshWriterProperties () {}
//! Which lighting model should be used in the technique (FX) section when exporting effects (materials)
virtual E_COLLADA_TECHNIQUE_FX getTechniqueFx(const video::SMaterial& material) const = 0;
//! Which texture index should be used when writing the texture of the given sampler color.
/** \return the index to the texture-layer or -1 if that texture should never be exported
Note: for ECCS_TRANSPARENT by default the alpha channel is used, if you want to use RGB you have to set
also the ECOF_RGB_ZERO flag in getTransparentFx. */
virtual s32 getTextureIdx(const video::SMaterial & material, E_COLLADA_COLOR_SAMPLER cs) const = 0;
//! Return which color from Irrlicht should be used for the color requested by collada
/** Note that collada allows exporting either texture or color, not both.
So color mapping is only checked if we have no valid texture already.
By default we try to return best fits when possible. For example ECCS_DIFFUSE is mapped to ECIC_DIFFUSE.
When ECIC_CUSTOM is returned then the result of getCustomColor will be used. */
virtual E_COLLADA_IRR_COLOR getColorMapping(const video::SMaterial & material, E_COLLADA_COLOR_SAMPLER cs) const = 0;
//! Return custom colors for certain color types requested by collada.
/** Only used when getColorMapping returns ECIC_CUSTOM for the same parameters. */
virtual video::SColor getCustomColor(const video::SMaterial & material, E_COLLADA_COLOR_SAMPLER cs) const = 0;
//! Return the transparence color interpretation.
/** Not this is only about ECCS_TRANSPARENT and does not affect getTransparency. */
virtual E_COLLADA_TRANSPARENT_FX getTransparentFx(const video::SMaterial& material) const = 0;
//! Transparency value for that material.
/** This value is additional to transparent settings, if both are set they will be multiplicated.
\return 1.0 for fully transparent, 0.0 for not transparent and not written at all when < 0.f */
virtual f32 getTransparency(const video::SMaterial& material) const = 0;
//! Reflectivity value for that material
/** The amount of perfect mirror reflection to be added to the reflected light
\return 0.0 - 1.0 for reflectivity and element is not written at all when < 0.f */
virtual f32 getReflectivity(const video::SMaterial& material) const = 0;
//! Return index of refraction for that material
/** By default we don't write that.
\return a value greater equal 0.f to write \<index_of_refraction\> when it is lesser than 0 nothing will be written */
virtual f32 getIndexOfRefraction(const video::SMaterial& material) const = 0;
//! Should node be used in scene export? (only needed for scene-writing, ignored in mesh-writing)
//! By default all visible nodes are exported.
virtual bool isExportable(const irr::scene::ISceneNode * node) const = 0;
//! Return the mesh for the given node. If it has no mesh or shouldn't export it's mesh
//! you can return 0 in which case only the transformation matrix of the node will be used.
// TODO: Function is not const because there is no const getMesh() function for several Irrlicht nodes.
virtual IMesh* getMesh(irr::scene::ISceneNode * node) = 0;
//! Return if the node has it's own material overwriting the mesh-materials
/** Usually true except for mesh-nodes which have isReadOnlyMaterials set.
This is mostly important for naming (as ISceneNode::getMaterial() already returns the correct material).
You have to override it when exporting custom scenenodes with own materials.
\return true => The node's own material is used, false => ignore node material and use the one from the mesh */
virtual bool useNodeMaterial(const scene::ISceneNode* node) const = 0;
};
//! Callback interface to use custom names on collada writing.
/** You can either modify names and id's written to collada or you can use
this interface to just find out which names are used on writing.
Names are often used later as xs:anyURI, so avoid whitespace, '#' and '%' in the names.
*/
class IColladaMeshWriterNames : public virtual IReferenceCounted
{
public:
virtual ~IColladaMeshWriterNames () {}
//! Return a unique name for the given mesh
/** Note that names really must be unique here per mesh-pointer, so
mostly it's a good idea to return the nameForMesh from
IColladaMeshWriter::getDefaultNameGenerator(). Also names must follow
the xs:NCName standard to be valid, you can run them through
IColladaMeshWriter::toNCName to ensure that.
\param mesh Pointer to the mesh which needs a name
\param instance When E_COLLADA_GEOMETRY_WRITING is not ECGI_PER_MESH then
several instances of the same mesh can be written and this counts them.
*/
virtual irr::core::stringc nameForMesh(const scene::IMesh* mesh, int instance) = 0;
//! Return a unique name for the given node
/** Note that names really must be unique here per node-pointer, so
mostly it's a good idea to return the nameForNode from
IColladaMeshWriter::getDefaultNameGenerator(). Also names must follow
the xs:NCName standard to be valid, you can run them through
IColladaMeshWriter::toNCName to ensure that.
*/
virtual irr::core::stringc nameForNode(const scene::ISceneNode* node) = 0;
//! Return a name for the material
/** There is one material created in the writer for each unique name.
So you can use this to control the number of materials which get written.
For example Irrlicht does by default write one material for each material
instanced by a node. So if you know that in your application material
instances per node are identical between different nodes you can reduce
the number of exported materials using that knowledge by using identical
names for such shared materials.
Names must follow the xs:NCName standard to be valid, you can run them
through IColladaMeshWriter::toNCName to ensure that.
*/
virtual irr::core::stringc nameForMaterial(const video::SMaterial & material, int materialId, const scene::IMesh* mesh, const scene::ISceneNode* node) = 0;
};
//! Interface for writing meshes
class IColladaMeshWriter : public IMeshWriter
{
public:
IColladaMeshWriter()
: Properties(0), DefaultProperties(0), NameGenerator(0), DefaultNameGenerator(0)
, WriteTextures(true), WriteDefaultScene(true), ExportSMaterialOnce(true)
, AmbientLight(0.f, 0.f, 0.f, 1.f)
, UnitMeter(1.f), UnitName("meter")
, GeometryWriting(ECGI_PER_MESH)
{
ParamNamesUV[0] = "U";
ParamNamesUV[1] = "V";
}
//! Destructor
virtual ~IColladaMeshWriter()
{
if ( Properties )
Properties->drop();
if ( DefaultProperties )
DefaultProperties->drop();
if ( NameGenerator )
NameGenerator->drop();
if ( DefaultNameGenerator )
DefaultNameGenerator->drop();
}
//! writes a scene starting with the given node
//\param writeRoot: 0 = no, 1=yes unless root is scenemanager, 2=yes
virtual bool writeScene(io::IWriteFile* file, scene::ISceneNode* root, int writeRoot=1) = 0;
//! Set if texture information should be written
virtual void setWriteTextures(bool write)
{
WriteTextures = write;
}
//! Get if texture information should be written
virtual bool getWriteTextures() const
{
return WriteTextures;
}
//! Set if a default scene should be written when writing meshes.
/** Many collada readers fail to read a mesh if the collada files doesn't contain a scene as well.
The scene is doing an instantiation of the mesh.
When using writeScene this flag is ignored (as we have scene there already)
*/
virtual void setWriteDefaultScene(bool write)
{
WriteDefaultScene = write;
}
//! Get if a default scene should be written
virtual bool getWriteDefaultScene() const
{
return WriteDefaultScene;
}
//! Sets ambient color of the scene to write
virtual void setAmbientLight(const video::SColorf &ambientColor)
{
AmbientLight = ambientColor;
}
//! Return ambient light of the scene which is written
virtual video::SColorf getAmbientLight() const
{
return AmbientLight;
}
//! Set the unit distances for all elements and objects
/**
\param meter: Real-world meters to use per unit. Default 1 unit = 1 meter. For 1 unit = 1cm you would set to 0.01
\param name: Name to use for distance unit. Default is "meter". */
virtual void setUnit(irr::f32 meter, const irr::core::stringc& name)
{
UnitMeter = meter;
UnitName = name;
}
//! Return real world meters to use per unit for all elements and objects
virtual irr::f32 getUnitMeter() const
{
return UnitMeter;
}
//! Return name to use for distance units. Like p.E. "meter".
virtual irr::core::stringc getUnitName() const
{
return UnitName;
}
//! Control when and how often a mesh is written
/** Optimally ECGI_PER_MESH would be always sufficient - writing geometry once per mesh.
Unfortunately many tools (at the time of writing this nearly all of them) have trouble
on import when different materials are used per node. So when you override materials
per node and importing the resulting collada has materials problems in other tools try
using other values here.
\param writeStyle One of the E_COLLADA_GEOMETRY_WRITING settings.
*/
virtual void setGeometryWriting(E_COLLADA_GEOMETRY_WRITING writeStyle)
{
GeometryWriting = writeStyle;
}
//! Get the current style of geometry writing.
virtual E_COLLADA_GEOMETRY_WRITING getGeometryWriting() const
{
return GeometryWriting;
}
//! Make certain there is only one collada material generated per Irrlicht material
/** Checks before creating a collada material-name if an identical
irr:::video::SMaterial has been exported already. If so don't export it with
another name. This is set by default and leads to way smaller .dae files.
Note that if you need to disable this flag for some reason you can still
get a similar effect using the IColladaMeshWriterNames::nameForMaterial
by returning identical names for identical materials there.
*/
virtual void setExportSMaterialsOnlyOnce(bool exportOnce)
{
ExportSMaterialOnce = exportOnce;
}
virtual bool getExportSMaterialsOnlyOnce() const
{
return ExportSMaterialOnce;
}
//! Set properties to use by the meshwriter instead of it's default properties.
/** Overloading properties with an own class allows modifying the writing process in certain ways.
By default properties are set to the DefaultProperties. */
virtual void setProperties(IColladaMeshWriterProperties * p)
{
if ( p == Properties )
return;
if ( p )
p->grab();
if ( Properties )
Properties->drop();
Properties = p;
}
//! Get properties which are currently used.
virtual IColladaMeshWriterProperties * getProperties() const
{
return Properties;
}
//! Return the original default properties of the writer.
/** You can use this pointer in your own properties to access and return default values. */
IColladaMeshWriterProperties * getDefaultProperties() const
{
return DefaultProperties;
}
//! Install a generator to create custom names on export.
virtual void setNameGenerator(IColladaMeshWriterNames * nameGenerator)
{
if ( nameGenerator == NameGenerator )
return;
if ( nameGenerator )
nameGenerator->grab();
if ( NameGenerator )
NameGenerator->drop();
NameGenerator = nameGenerator;
}
//! Get currently used name generator
virtual IColladaMeshWriterNames * getNameGenerator() const
{
return NameGenerator;
}
//! Return the original default name generator of the writer.
/** You can use this pointer in your own generator to access and return default values. */
IColladaMeshWriterNames * getDefaultNameGenerator() const
{
return DefaultNameGenerator;
}
//! Restrict the characters of oldString a set of allowed characters in xs:NCName and add the prefix.
/** A tool function to help when using a custom name generator to generative valid names for collada names and id's. */
virtual irr::core::stringc toNCName(const irr::core::stringc& oldString, const irr::core::stringc& prefix=irr::core::stringc("_NC_")) const = 0;
//! After export you can find out which name had been used for writing the geometry for this node.
/** The name comes from IColladaMeshWriterNames::nameForMesh, but you can't access the node there.
\return Either a pointer to the name or NULL */
// TODO: Function is not const because there is no const getMesh() function for several Irrlicht nodes.
virtual const irr::core::stringc* findGeometryNameForNode(ISceneNode* node) = 0;
//! Change param name used for UV's.
/** Param names for UV's have a name. By default it's "U" and "V".
Usually it doesn't matter as names are optional in Collada anyway.
But unfortunately some tools insist on specific names.
So if "U", "V" does not work then try to export by setting this to "S", "T".
One tool which insists on "S", "T" is for example SketchUp.
*/
void SetParamNamesUV(const core::stringc& u, const core::stringc& v)
{
ParamNamesUV[0] = u;
ParamNamesUV[1] = v;
}
protected:
// NOTE: You usually should also call setProperties with the same parameter when using setDefaultProperties
virtual void setDefaultProperties(IColladaMeshWriterProperties * p)
{
if ( p == DefaultProperties )
return;
if ( p )
p->grab();
if ( DefaultProperties )
DefaultProperties->drop();
DefaultProperties = p;
}
// NOTE: You usually should also call setNameGenerator with the same parameter when using setDefaultProperties
virtual void setDefaultNameGenerator(IColladaMeshWriterNames * p)
{
if ( p == DefaultNameGenerator )
return;
if ( p )
p->grab();
if ( DefaultNameGenerator )
DefaultNameGenerator->drop();
DefaultNameGenerator = p;
}
protected:
irr::core::stringc ParamNamesUV[2];
private:
IColladaMeshWriterProperties * Properties;
IColladaMeshWriterProperties * DefaultProperties;
IColladaMeshWriterNames * NameGenerator;
IColladaMeshWriterNames * DefaultNameGenerator;
bool WriteTextures;
bool WriteDefaultScene;
bool ExportSMaterialOnce;
video::SColorf AmbientLight;
irr::f32 UnitMeter;
irr::core::stringc UnitName;
E_COLLADA_GEOMETRY_WRITING GeometryWriting;
};
} // end namespace
} // end namespace
#endif

View File

@ -6,8 +6,6 @@
#define __I_FILE_SYSTEM_H_INCLUDED__
#include "IReferenceCounted.h"
#include "IXMLReader.h"
#include "IXMLWriter.h"
#include "IFileArchive.h"
namespace irr
@ -318,70 +316,6 @@ public:
\return True if file exists, and false if it does not exist or an error occurred. */
virtual bool existFile(const path& filename) const =0;
//! Creates a XML Reader from a file which returns all parsed strings as wide characters (wchar_t*).
/** Use createXMLReaderUTF8() if you prefer char* instead of wchar_t*. See IIrrXMLReader for
more information on how to use the parser.
\return 0, if file could not be opened, otherwise a pointer to the created
IXMLReader is returned. After use, the reader
has to be deleted using its IXMLReader::drop() method.
See IReferenceCounted::drop() for more information. */
virtual IXMLReader* createXMLReader(const path& filename) =0;
//! Creates a XML Reader from a file which returns all parsed strings as wide characters (wchar_t*).
/** Use createXMLReaderUTF8() if you prefer char* instead of wchar_t*. See IIrrXMLReader for
more information on how to use the parser.
\return 0, if file could not be opened, otherwise a pointer to the created
IXMLReader is returned. After use, the reader
has to be deleted using its IXMLReader::drop() method.
See IReferenceCounted::drop() for more information. */
virtual IXMLReader* createXMLReader(IReadFile* file) =0;
//! Creates a XML Reader from a file which returns all parsed strings as ASCII/UTF-8 characters (char*).
/** Use createXMLReader() if you prefer wchar_t* instead of char*. See IIrrXMLReader for
more information on how to use the parser.
\return 0, if file could not be opened, otherwise a pointer to the created
IXMLReader is returned. After use, the reader
has to be deleted using its IXMLReaderUTF8::drop() method.
See IReferenceCounted::drop() for more information. */
virtual IXMLReaderUTF8* createXMLReaderUTF8(const path& filename) =0;
//! Creates a XML Reader from a file which returns all parsed strings as ASCII/UTF-8 characters (char*).
/** Use createXMLReader() if you prefer wchar_t* instead of char*. See IIrrXMLReader for
more information on how to use the parser.
\return 0, if file could not be opened, otherwise a pointer to the created
IXMLReader is returned. After use, the reader
has to be deleted using its IXMLReaderUTF8::drop() method.
See IReferenceCounted::drop() for more information. */
virtual IXMLReaderUTF8* createXMLReaderUTF8(IReadFile* file) =0;
//! Creates a XML Writer from a file which will write ASCII/UTF-8 characters (char*).
/** \return 0, if file could not be opened, otherwise a pointer to the created
IXMLWriter is returned. After use, the reader
has to be deleted using its IXMLWriter::drop() method.
See IReferenceCounted::drop() for more information. */
virtual IXMLWriterUTF8* createXMLWriterUTF8(const path& filename) =0;
//! Creates a XML Writer from a file which will write ASCII/UTF-8 characters (char*).
/** \return 0, if file could not be opened, otherwise a pointer to the created
IXMLWriter is returned. After use, the reader
has to be deleted using its IXMLWriter::drop() method.
See IReferenceCounted::drop() for more information. */
virtual IXMLWriterUTF8* createXMLWriterUTF8(IWriteFile* file) =0;
//! Creates a XML Writer from a file.
/** \return 0, if file could not be opened, otherwise a pointer to the created
IXMLWriter is returned. After use, the reader
has to be deleted using its IXMLWriter::drop() method.
See IReferenceCounted::drop() for more information. */
virtual IXMLWriter* createXMLWriter(const path& filename) =0;
//! Creates a XML Writer from a file.
/** \return 0, if file could not be opened, otherwise a pointer to the created
IXMLWriter is returned. After use, the reader
has to be deleted using its IXMLWriter::drop() method.
See IReferenceCounted::drop() for more information. */
virtual IXMLWriter* createXMLWriter(IWriteFile* file) =0;
//! Creates a new empty collection of attributes, usable for serialization and more.
/** \param driver: Video driver to be used to load textures when specified as attribute values.
Can be null to prevent automatic texture loading by attributes.

View File

@ -11,8 +11,6 @@
#include "EMessageBoxFlags.h"
#include "EFocusFlags.h"
#include "IEventReceiver.h"
#include "IXMLReader.h"
#include "IXMLWriter.h"
#include "path.h"
namespace irr
@ -622,12 +620,6 @@ public:
//! Reads attributes of the gui environment
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)=0;
//! writes an element
virtual void writeGUIElement(io::IXMLWriter* writer, IGUIElement* element) =0;
//! reads an element
virtual void readGUIElement(io::IXMLReader* reader, IGUIElement* element) =0;
//! Find the next element which would be selected when pressing the tab-key
/** If you set the focus for the result you can manually force focus-changes like they
would happen otherwise by the tab-keys.

View File

@ -19,7 +19,6 @@
#include "SceneParameters.h"
#include "IGeometryCreator.h"
#include "ISkinnedMesh.h"
#include "IXMLWriter.h"
namespace irr
{
@ -199,37 +198,6 @@ namespace scene
* directly in Irrlicht.
* </TR>
* <TR>
* <TD>COLLADA (.dae, .xml)</TD>
* <TD>COLLADA is an open Digital Asset Exchange Schema for
* the interactive 3D industry. There are exporters and
* importers for this format available for most of the
* big 3d packagesat http://collada.org. Irrlicht can
* import COLLADA files by using the
* ISceneManager::getMesh() method. COLLADA files need
* not contain only one single mesh but multiple meshes
* and a whole scene setup with lights, cameras and mesh
* instances, this loader can set up a scene as
* described by the COLLADA file instead of loading and
* returning one single mesh. By default, this loader
* behaves like the other loaders and does not create
* instances, but it can be switched into this mode by
* using
* SceneManager-&gt;getParameters()-&gt;setAttribute(COLLADA_CREATE_SCENE_INSTANCES, true);
* Created scene nodes will be named as the names of the
* nodes in the COLLADA file. The returned mesh is just
* a dummy object in this mode. Meshes included in the
* scene will be added into the scene manager with the
* following naming scheme:
* "path/to/file/file.dea#meshname". The loading of such
* meshes is logged. Currently, this loader is able to
* create meshes (made of only polygons), lights, and
* cameras. Materials and animations are currently not
* supported but this will change with future releases.
* </TD>
* </TR>
* <TR>
* <TD>Delgine DeleD (.dmf)</TD>
* <TD>DeleD (delgine.com) is a 3D editor and level-editor
* combined into one and is specifically designed for 3D
@ -266,13 +234,6 @@ namespace scene
* by Fabio Concas and adapted by Thomas Alten.</TD>
* </TR>
* <TR>
* <TD>Irrlicht Mesh (.irrMesh)</TD>
* <TD>This is a static mesh format written in XML, native
* to Irrlicht and written by the irr mesh writer.
* This format is exported by the CopperCube engine's
* lightmapper.</TD>
* </TR>
* <TR>
* <TD>LightWave (.lwo)</TD>
* <TD>Native to NewTek's LightWave 3D, the LWO format is well
* known and supported by many exporters. This loader will
@ -1586,26 +1547,6 @@ namespace scene
\return True if successful. */
virtual bool saveScene(io::IWriteFile* file, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0) = 0;
//! Saves the current scene into a file.
/** Scene nodes with the option isDebugObject set to true are
not being saved. The scene is usually written to an .irr file,
an xml based format. .irr files can Be edited with the Irrlicht
Engine Editor, irrEdit (http://www.ambiera.com/irredit/). To
load .irr files again, see ISceneManager::loadScene().
\param writer XMLWriter with which the scene is saved.
\param currentPath Path which is used for relative file names.
Usually the directory of the file written into.
\param userDataSerializer If you want to save some user data
for every scene node into the file, implement the
ISceneUserDataSerializer interface and provide it as parameter
here. Otherwise, simply specify 0 as this parameter.
\param node Node which is taken as the top node of the scene.
This node and all of its descendants are saved into the scene
file. Pass 0 or the scene manager to save the full scene (which
is also the default).
\return True if successful. */
virtual bool saveScene(io::IXMLWriter* writer, const io::path& currentPath, ISceneUserDataSerializer* userDataSerializer=0, ISceneNode* node=0) = 0;
//! Loads a scene. Note that the current scene is not cleared before.
/** The scene is usually loaded from an .irr file, an xml based
format, but other scene formats can be added to the engine via

View File

@ -1,31 +0,0 @@
// Copyright (C) 2002-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_XML_READER_H_INCLUDED__
#define __I_XML_READER_H_INCLUDED__
#include "IReferenceCounted.h"
#include "irrXML.h"
namespace irr
{
namespace io
{
//! An xml reader for wide characters, derived from IReferenceCounted.
/** This XML Parser can read any type of text files from any source
Irrlicht can read. Just call IFileSystem::createXMLReader(). For more
information on how to use the parser, see IIrrXMLReader */
typedef IIrrXMLReader<wchar_t, IReferenceCounted> IXMLReader;
//! An xml reader for ASCII or UTF-8 characters, derived from IReferenceCounted.
/** This XML Parser can read any type of text files from any source
Irrlicht can read. Just call IFileSystem::createXMLReaderUTF8(). For
more information on how to use the parser, see IIrrXMLReader */
typedef IIrrXMLReader<c8, IReferenceCounted> IXMLReaderUTF8;
} // end namespace io
} // end namespace irr
#endif

View File

@ -1,26 +0,0 @@
// Copyright (C) 2002-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_XML_WRITER_H_INCLUDED__
#define __I_XML_WRITER_H_INCLUDED__
#include "IReferenceCounted.h"
#include "irrXML.h"
namespace irr
{
namespace io
{
//! An xml writer for wide characters, derived from IReferenceCounted.
/** Call IFileSystem::createXMLReader(). to create an IXMLWriter */
typedef IIrrXMLWriter<wchar_t, IReferenceCounted> IXMLWriter;
//! An xml writer for ASCII or UTF-8 characters, derived from IReferenceCounted.
/** Call IFileSystem::createXMLReaderUtf8(). to create an IXMLWriter */
typedef IIrrXMLWriter<c8, IReferenceCounted> IXMLWriterUTF8;
} // end namespace io
} // end namespace irr
#endif

View File

@ -151,12 +151,6 @@
//! Maximum number of texture an SMaterial can have, up to 8 are supported by Irrlicht.
#define _IRR_MATERIAL_MAX_TEXTURES_ 8
//! 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
//! Add a leak-hunter to Irrlicht which helps finding unreleased reference counted objects.
//! NOTE: This is slow and should only be used for debugging
//#define _IRR_COMPILE_WITH_LEAK_HUNTER_
@ -532,11 +526,6 @@ B3D, MS3D or X meshes */
#endif
#endif // _IRR_COMPILE_WITH_SKINNED_MESH_SUPPORT_
//! Define _IRR_COMPILE_WITH_IRR_MESH_LOADER_ if you want to load Irrlicht Engine .irrmesh files
#define _IRR_COMPILE_WITH_IRR_MESH_LOADER_
#ifdef NO_IRR_COMPILE_WITH_IRR_MESH_LOADER_
#undef _IRR_COMPILE_WITH_IRR_MESH_LOADER_
#endif
//! Define _IRR_COMPILE_WITH_HALFLIFE_LOADER_ if you want to load Halflife animated files
#define _IRR_COMPILE_WITH_HALFLIFE_LOADER_
#ifdef NO_IRR_COMPILE_WITH_HALFLIFE_LOADER_
@ -557,11 +546,6 @@ B3D, MS3D or X meshes */
#ifdef NO_IRR_COMPILE_WITH_3DS_LOADER_
#undef _IRR_COMPILE_WITH_3DS_LOADER_
#endif
//! Define _IRR_COMPILE_WITH_COLLADA_LOADER_ if you want to load Collada files
#define _IRR_COMPILE_WITH_COLLADA_LOADER_
#ifdef NO_IRR_COMPILE_WITH_COLLADA_LOADER_
#undef _IRR_COMPILE_WITH_COLLADA_LOADER_
#endif
//! Define _IRR_COMPILE_WITH_CSM_LOADER_ if you want to load Cartography Shop files
#define _IRR_COMPILE_WITH_CSM_LOADER_
#ifdef NO_IRR_COMPILE_WITH_CSM_LOADER_
@ -618,16 +602,6 @@ B3D, MS3D or X meshes */
#undef _IRR_COMPILE_WITH_SMF_LOADER_
#endif
//! Define _IRR_COMPILE_WITH_IRR_WRITER_ if you want to write static .irrMesh files
#define _IRR_COMPILE_WITH_IRR_WRITER_
#ifdef NO_IRR_COMPILE_WITH_IRR_WRITER_
#undef _IRR_COMPILE_WITH_IRR_WRITER_
#endif
//! Define _IRR_COMPILE_WITH_COLLADA_WRITER_ if you want to write Collada files
#define _IRR_COMPILE_WITH_COLLADA_WRITER_
#ifdef NO_IRR_COMPILE_WITH_COLLADA_WRITER_
#undef _IRR_COMPILE_WITH_COLLADA_WRITER_
#endif
//! Define _IRR_COMPILE_WITH_STL_WRITER_ if you want to write .stl files
#define _IRR_COMPILE_WITH_STL_WRITER_
#ifdef NO_IRR_COMPILE_WITH_STL_WRITER_
@ -866,14 +840,6 @@ precision will be lower but speed higher. currently X86 only
#undef __IRR_HAS_S64
#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
#if defined(__BORLANDC__)
#include <tchar.h>

View File

@ -1,645 +0,0 @@
// Copyright (C) 2002-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine" and the "irrXML" project.
// For conditions of distribution and use, see copyright notice in irrlicht.h and/or irrXML.h
#ifndef __IRR_XML_H_INCLUDED__
#define __IRR_XML_H_INCLUDED__
#include <stdio.h>
#include "IrrCompileConfig.h"
#include "irrArray.h"
#include "irrString.h"
/** \mainpage irrXML 1.2 API documentation
<div align="center"><img src="logobig.png" ></div>
\section intro Introduction
Welcome to the irrXML API documentation.
Here you'll find any information you'll need to develop applications with
irrXML. If you look for a tutorial on how to start, take a look at the \ref irrxmlexample,
at the homepage of irrXML at <A HREF="http://www.ambiera.com/irrxml/">www.ambiera.com/irrxml/</A>
or into the SDK in the directory example.
irrXML is intended to be a high speed and easy-to-use XML Parser for C++, and
this documentation is an important part of it. If you have any questions or
suggestions, just send a email to the author of the engine, Nikolaus Gebhardt
(niko (at) irrlicht3d.org). For more information about this parser, see \ref history.
\section features Features
irrXML provides forward-only, read-only
access to a stream of non validated XML data. It was fully implemented by
Nikolaus Gebhardt. Its current features are:
- It it fast as lighting and has very low memory usage. It was
developed with the intention of being used in 3D games, as it already has been.
- irrXML is very small: It only consists of 60 KB of code and can be added easily
to your existing project.
- Of course, it is platform independent and works with lots of compilers.
- It is able to parse ASCII, UTF-8, UTF-16 and UTF-32 text files, both in
little and big endian format.
- Independent of the input file format, the parser can return all strings in ASCII, UTF-8,
UTF-16 and UTF-32 format.
- With its optional file access abstraction it has the advantage that it can read not
only from files but from any type of data (memory, network, ...). For example when
used with the Irrlicht Engine, it directly reads from compressed .zip files.
- Just like the Irrlicht Engine for which it was originally created, it is extremely easy
to use.
- It has no external dependencies, it does not even need the STL.
Although irrXML has some strengths, it currently also has the following limitations:
- The input xml file is not validated and assumed to be correct.
\section irrxmlexample Example
The following code demonstrates the basic usage of irrXML. A simple xml
file like this is parsed:
\code
<?xml version="1.0"?>
<config>
<!-- This is a config file for the mesh viewer -->
<model file="dwarf.dea" />
<messageText caption="Irrlicht Engine Mesh Viewer">
Welcome to the Mesh Viewer of the &quot;Irrlicht Engine&quot;.
</messageText>
</config>
\endcode
The code for parsing this file would look like this:
\code
#include <irrXML.h>
using namespace irr; // irrXML is located in the namespace irr::io
using namespace io;
#include <string> // we use STL strings to store data in this example
void main()
{
// create the reader using one of the factory functions
IrrXMLReader* xml = createIrrXMLReader("config.xml");
// strings for storing the data we want to get out of the file
std::string modelFile;
std::string messageText;
std::string caption;
// parse the file until end reached
while(xml && xml->read())
{
switch(xml->getNodeType())
{
case EXN_TEXT:
// in this xml file, the only text which occurs is the messageText
messageText = xml->getNodeData();
break;
case EXN_ELEMENT:
{
if (!strcmp("model", xml->getNodeName()))
modelFile = xml->getAttributeValue("file");
else
if (!strcmp("messageText", xml->getNodeName()))
caption = xml->getAttributeValue("caption");
}
break;
}
}
// delete the xml parser after usage
delete xml;
}
\endcode
\section howto How to use
Simply add the source files in the /src directory of irrXML to your project. Done.
\section license License
The irrXML license is based on the zlib license. Basically, this means you can do with
irrXML whatever you want:
Copyright (C) 2002-2012 Nikolaus Gebhardt
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
\section history History
As lots of references in this documentation and the source show, this xml
parser has originally been a part of the
<A HREF="http://irrlicht.sourceforge.net" >Irrlicht Engine</A>. But because
the parser has become very useful with the latest release, people asked for a
separate version of it, to be able to use it in non Irrlicht projects. With
irrXML 1.0, this has now been done.
*/
namespace irr
{
namespace io
{
//! Enumeration of all supported source text file formats
enum ETEXT_FORMAT
{
//! ASCII, file without byte order mark, or not a text file
ETF_ASCII,
//! UTF-8 format
ETF_UTF8,
//! UTF-16 format, big endian
ETF_UTF16_BE,
//! UTF-16 format, little endian
ETF_UTF16_LE,
//! UTF-32 format, big endian
ETF_UTF32_BE,
//! UTF-32 format, little endian
ETF_UTF32_LE
};
//! Enumeration for all xml nodes which are parsed by IrrXMLReader
enum EXML_NODE
{
//! No xml node. This is usually the node if you did not read anything yet.
EXN_NONE,
//! An xml element such as &lt;foo&gt;
EXN_ELEMENT,
//! End of an xml element such as &lt;/foo&gt;
EXN_ELEMENT_END,
//! Text within an xml element: &lt;foo&gt; this is the text. &lt;/foo&gt;
//! Also text between 2 xml elements: &lt;/foo&gt; this is the text. &lt;foo&gt;
EXN_TEXT,
//! An xml comment like &lt;!-- I am a comment --&gt; or a DTD definition.
EXN_COMMENT,
//! An xml cdata section like &lt;![CDATA[ this is some CDATA ]]&gt;
EXN_CDATA,
//! Unknown element.
EXN_UNKNOWN
};
//! Callback class for file read abstraction.
/** With this, it is possible to make the xml parser read in other
things than just files. The Irrlicht engine is using this for example to
read xml from compressed .zip files. To make the parser read in
any other data, derive a class from this interface, implement the
two methods to read your data and give a pointer to an instance of
your implementation when calling createIrrXMLReader(),
createIrrXMLReaderUTF16() or createIrrXMLReaderUTF32() */
class IFileReadCallBack
{
public:
//! Destructor
virtual ~IFileReadCallBack() {}
//! Reads an amount of bytes from the file.
/** \param buffer: Pointer to buffer where to read bytes will be written to.
\param sizeToRead: Amount of bytes to read from the file.
\return Returns how much bytes were read. */
virtual int read(void* buffer, int sizeToRead) = 0;
//! Returns size of file in bytes on success or -1L on failure.
virtual long getSize() const = 0;
};
//! Empty class to be used as parent class for IrrXMLReader.
/** If you need another class as base class for the xml reader, you can do this by creating
the reader using for example new CXMLReaderImpl<char, YourBaseClass>(yourcallback);
The Irrlicht Engine for example needs IReferenceCounted as base class for every object to
let it automatically reference counted, hence it replaces IXMLBase with IReferenceCounted.
See irrXML.cpp on how this can be done in detail. */
class IXMLBase
{
};
//! Interface providing easy read access to a XML file.
/** You can create an instance of this reader using one of the factory functions
createIrrXMLReader(), createIrrXMLReaderUTF16() and createIrrXMLReaderUTF32().
If using the parser from the Irrlicht Engine, please use IFileSystem::createXMLReader()
instead.
For a detailed intro how to use the parser, see \ref irrxmlexample and \ref features.
The typical usage of this parser looks like this:
\code
#include <irrXML.h>
using namespace irr; // irrXML is located in the namespace irr::io
using namespace io;
void main()
{
// create the reader using one of the factory functions
IrrXMLReader* xml = createIrrXMLReader("config.xml");
if (xml == 0)
return; // file could not be opened
// parse the file until end reached
while(xml->read())
{
// based on xml->getNodeType(), do something.
}
// delete the xml parser after usage
delete xml;
}
\endcode
See \ref irrxmlexample for a more detailed example.
*/
template<class char_type, class super_class>
class IIrrXMLReader : public super_class
{
public:
//! Destructor
virtual ~IIrrXMLReader() {}
//! Reads forward to the next xml node.
/** \return Returns false, if there was no further node. */
virtual bool read() = 0;
//! Returns the type of the current XML node.
virtual EXML_NODE getNodeType() const = 0;
//! Returns attribute count of the current XML node.
/** This is usually
non null if the current node is EXN_ELEMENT, and the element has attributes.
\return Returns amount of attributes of this xml node. */
virtual unsigned int getAttributeCount() const = 0;
//! Returns name of an attribute.
/** \param idx: Zero based index, should be something between 0 and getAttributeCount()-1.
\return Name of the attribute, 0 if an attribute with this index does not exist. */
virtual const char_type* getAttributeName(int idx) const = 0;
//! Returns the value of an attribute.
/** \param idx: Zero based index, should be something between 0 and getAttributeCount()-1.
\return Value of the attribute, 0 if an attribute with this index does not exist. */
virtual const char_type* getAttributeValue(int idx) const = 0;
//! Returns the value of an attribute.
/** \param name: Name of the attribute.
\return Value of the attribute, 0 if an attribute with this name does not exist. */
virtual const char_type* getAttributeValue(const char_type* name) const = 0;
//! Returns the value of an attribute in a safe way.
/** Like getAttributeValue(), but does not
return 0 if the attribute does not exist. An empty string ("") is returned then.
\param name: Name of the attribute.
\return Value of the attribute, and "" if an attribute with this name does not exist */
virtual const char_type* getAttributeValueSafe(const char_type* name) const = 0;
//! Returns the value of an attribute as integer.
/** \param name Name of the attribute.
\param defaultNotFound Value returned when name does not exist
\return Value of the attribute as integer or value of defaultNotFound
when name was not found or 0 when value could not be interpreted as integer */
virtual int getAttributeValueAsInt(const char_type* name, int defaultNotFound=0) const = 0;
//! Returns the value of an attribute as integer.
/** \param idx: Zero based index, should be something between 0 and getAttributeCount()-1.
\param defaultNotFound Value returned when index does not exist.
\return Value of the attribute as integer or value of defaultNotFound parameter for invalid index
or 0 when value could not be interpreted as integer */
virtual int getAttributeValueAsInt(int idx, int defaultNotFound=0) const = 0;
//! Returns the value of an attribute as float.
/** \param name: Name of the attribute.
\param defaultNotFound Value returned when name does not exist.
\return Value of the attribute as float or value of defaultNotFound parameter on failure
or 0 when value could not be interpreted as float. */
virtual float getAttributeValueAsFloat(const char_type* name, float defaultNotFound=0.f) const = 0;
//! Returns the value of an attribute as float.
/** \param idx: Zero based index, should be something between 0 and getAttributeCount()-1.
\param defaultNotFound Value returned when index does not exist.
\return Value of the attribute as float or value of defaultNotFound parameter on failure
or 0 when value could not be interpreted as float. */
virtual float getAttributeValueAsFloat(int idx, float defaultNotFound=0.f) const = 0;
//! Returns the name of the current node.
/** Only valid, if the node type is EXN_ELEMENT.
\return Name of the current node or 0 if the node has no name. */
virtual const char_type* getNodeName() const = 0;
//! Returns data of the current node.
/** Only valid if the node has some
data and it is of type EXN_TEXT, EXN_COMMENT, EXN_CDATA or EXN_UNKNOWN. */
virtual const char_type* getNodeData() const = 0;
//! Returns if an element is an empty element, like &lt;foo />
virtual bool isEmptyElement() const = 0;
//! Returns format of the source xml file.
/** It is not necessary to use
this method because the parser will convert the input file format
to the format wanted by the user when creating the parser. This
method is useful to get/display additional information. */
virtual ETEXT_FORMAT getSourceFormat() const = 0;
//! Returns format of the strings returned by the parser.
/** This will be UTF8 for example when you created a parser with
IrrXMLReaderUTF8() and UTF32 when it has been created using
IrrXMLReaderUTF32. It should not be necessary to call this
method and only exists for informational purposes. */
virtual ETEXT_FORMAT getParserFormat() const = 0;
};
//! Interface providing methods for making it easier to write XML files.
template<class char_type, class super_class>
class IIrrXMLWriter : public super_class
{
public:
//! Destructor
virtual ~IIrrXMLWriter() {}
//! Writes an xml 1.0 header.
/** Looks like &lt;?xml version="1.0"?&gt;. This should always
be called before writing anything other, because also the text
file header for Unicode texts is written out with this method. */
virtual void writeXMLHeader() = 0;
//! Writes an xml element with maximal 5 attributes like "<foo />" or
//! &lt;foo optAttr="value" /&gt;.
/** The element can be empty or not.
\param name: Name of the element
\param empty: Specifies if the element should be empty. Like
"<foo />". If You set this to false, something like this is
written instead: "<foo>".
\param attr1Name: 1st attributes name
\param attr1Value: 1st attributes value
\param attr2Name: 2nd attributes name
\param attr2Value: 2nd attributes value
\param attr3Name: 3rd attributes name
\param attr3Value: 3rd attributes value
\param attr4Name: 4th attributes name
\param attr4Value: 4th attributes value
\param attr5Name: 5th attributes name
\param attr5Value: 5th attributes value */
virtual void writeElement(const char_type* name, bool empty=false,
const char_type* attr1Name = 0, const char_type* attr1Value = 0,
const char_type* attr2Name = 0, const char_type* attr2Value = 0,
const char_type* attr3Name = 0, const char_type* attr3Value = 0,
const char_type* attr4Name = 0, const char_type* attr4Value = 0,
const char_type* attr5Name = 0, const char_type* attr5Value = 0) = 0;
//! Writes an xml element with any number of attributes
virtual void writeElement(const char_type* name, bool empty,
core::array<core::string<char_type> > &names, core::array<core::string<char_type> > &values) = 0;
//! Writes a comment into the xml file
virtual void writeComment(const char_type* comment) = 0;
//! Writes the closing tag for an element. Like "</foo>"
virtual void writeClosingTag(const char_type* name) = 0;
//! Writes a text into the file.
/** All occurrences of special characters such as
& (&amp;), < (&lt;), > (&gt;), and " (&quot;) are automatically
replaced. */
virtual void writeText(const char_type* text) = 0;
//! Writes a line break
virtual void writeLineBreak() = 0;
};
template <typename T>
struct xmlChar
{
T c;
xmlChar<T>() {}
xmlChar<T>(char in) : c(static_cast<T>(in)) {}
xmlChar<T>(wchar_t in) : c(static_cast<T>(in)) {}
#if defined(__BORLANDC__)
// Note - removing explicit for Borland was to get it to even compile.
// There haven't been any kind of tests for that besides that.
xmlChar<T>(unsigned char in) : c(static_cast<T>(in)) {}
xmlChar<T>(unsigned short in) : c(static_cast<T>(in)) {}
xmlChar<T>(unsigned int in) : c(static_cast<T>(in)) {}
xmlChar<T>(unsigned long in) : c(static_cast<T>(in)) {}
#else
explicit xmlChar<T>(unsigned char in) : c(static_cast<T>(in)) {}
#if !defined(_MSC_VER) || defined(_NATIVE_WCHAR_T_DEFINED) // VS compiling without native wchar_t can't have it
explicit xmlChar<T>(unsigned short in) : c(static_cast<T>(in)) {}
#endif
explicit xmlChar<T>(unsigned int in) : c(static_cast<T>(in)) {}
explicit xmlChar<T>(unsigned long in) : c(static_cast<T>(in)) {}
#endif
operator T() const { return c; }
void operator=(int t) { c=static_cast<T>(t); }
};
//! defines the utf-16 type.
/** Not using wchar_t for this because
wchar_t has 16 bit on windows and 32 bit on other operating systems. */
typedef xmlChar<unsigned short> char16;
//! defines the utf-32 type.
/** Not using wchar_t for this because
wchar_t has 16 bit on windows and 32 bit on other operating systems. */
typedef xmlChar<unsigned int> char32;
//! A UTF-8 or ASCII character xml parser.
/** This means that all character data will be returned in 8 bit ASCII or UTF-8 by this parser.
The file to read can be in any format, it will be converted to UTF-8 if it is not
in this format.
Create an instance of this with createIrrXMLReader();
See IIrrXMLReader for description on how to use it. */
typedef IIrrXMLReader<char, IXMLBase> IrrXMLReader;
//! A UTF-16 xml parser.
/** This means that all character data will be returned in UTF-16 by this parser.
The file to read can be in any format, it will be converted to UTF-16 if it is not
in this format.
Create an instance of this with createIrrXMLReaderUTF16();
See IIrrXMLReader for description on how to use it. */
typedef IIrrXMLReader<char16, IXMLBase> IrrXMLReaderUTF16;
//! A UTF-32 xml parser.
/** This means that all character data will be returned in UTF-32 by this parser.
The file to read can be in any format, it will be converted to UTF-32 if it is not
in this format.
Create an instance of this with createIrrXMLReaderUTF32();
See IIrrXMLReader for description on how to use it. */
typedef IIrrXMLReader<char32, IXMLBase> IrrXMLReaderUTF32;
#ifdef _IRR_COMPILE_WITH_XML_
//! 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.
The file to read can be in any format, it will be converted to UTF-8 if it is not in this format.
If you are using the Irrlicht Engine, it is better not to use this function but
IFileSystem::createXMLReaderUTF8() instead.
\param filename: Name of file to be opened.
\return Returns a pointer to the created xml parser. This pointer should be
deleted using 'delete' after no longer needed. Returns 0 if an error occurred
and the file could not be opened. */
IRRLICHT_API IrrXMLReader* IRRCALLCONV createIrrXMLReader(const char* filename);
//! 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. The file to read can
be in any format, it will be converted to UTF-8 if it is not in this format.
If you are using the Irrlicht Engine, it is better not to use this function but
IFileSystem::createXMLReaderUTF8() instead.
\param file: Pointer to opened file, must have been opened in binary mode, e.g.
using fopen("foo.bar", "wb"); The file will not be closed after it has been read.
\return Returns a pointer to the created xml parser. This pointer should be
deleted using 'delete' after no longer needed. Returns 0 if an error occurred
and the file could not be opened. */
IRRLICHT_API IrrXMLReader* IRRCALLCONV createIrrXMLReader(FILE* file);
//! 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. The file to read can
be in any format, it will be converted to UTF-8 if it is not in this format.
If you are using the Irrlicht Engine, it is better not to use this function but
IFileSystem::createXMLReaderUTF8() instead.
\param callback: Callback for file read abstraction. Implement your own
callback to make the xml parser read in other things than just files. See
IFileReadCallBack for more information about this.
\param deleteCallback: if true, the callback will be deleted after the file
has been read. Otherwise the caller is responsible for cleaning it up.
\return Returns a pointer to the created xml parser. This pointer should be
deleted using 'delete' after no longer needed. Returns 0 if an error occurred
and the file could not be opened. */
IRRLICHT_API IrrXMLReader* IRRCALLCONV createIrrXMLReader(IFileReadCallBack* callback,
bool deleteCallback = false);
//! Creates an instance of an UFT-16 xml parser.
/** This means that
all character data will be returned in UTF-16. The file to read can
be in any format, it will be converted to UTF-16 if it is not in this format.
If you are using the Irrlicht Engine, it is better not to use this function but
IFileSystem::createXMLReader() instead.
\param filename: Name of file to be opened.
\return Returns a pointer to the created xml parser. This pointer should be
deleted using 'delete' after no longer needed. Returns 0 if an error occurred
and the file could not be opened. */
IRRLICHT_API IrrXMLReaderUTF16* IRRCALLCONV createIrrXMLReaderUTF16(const char* filename);
//! Creates an instance of an UFT-16 xml parser.
/** This means that all character data will be returned in UTF-16. The file to read can
be in any format, it will be converted to UTF-16 if it is not in this format.
If you are using the Irrlicht Engine, it is better not to use this function but
IFileSystem::createXMLReader() instead.
\param file: Pointer to opened file, must have been opened in binary mode, e.g.
using fopen("foo.bar", "wb"); The file will not be closed after it has been read.
\return Returns a pointer to the created xml parser. This pointer should be
deleted using 'delete' after no longer needed. Returns 0 if an error occurred
and the file could not be opened. */
IRRLICHT_API IrrXMLReaderUTF16* IRRCALLCONV createIrrXMLReaderUTF16(FILE* file);
//! Creates an instance of an UFT-16 xml parser.
/** This means that all character data will be returned in UTF-16. The file to read can
be in any format, it will be converted to UTF-16 if it is not in this format.
If you are using the Irrlicht Engine, it is better not to use this function but
IFileSystem::createXMLReader() instead.
\param callback: Callback for file read abstraction. Implement your own
callback to make the xml parser read in other things than just files. See
IFileReadCallBack for more information about this.
\param deleteCallback: if true, the callback will be deleted after the file
has been read. Otherwise the caller is responsible for cleaning it up.
\return Returns a pointer to the created xml parser. This pointer should be
deleted using 'delete' after no longer needed. Returns 0 if an error occurred
and the file could not be opened. */
IRRLICHT_API IrrXMLReaderUTF16* IRRCALLCONV createIrrXMLReaderUTF16(IFileReadCallBack* callback,
bool deleteCallback = false);
//! Creates an instance of an UFT-32 xml parser.
/** This means that all character data will be returned in UTF-32. The file to read can
be in any format, it will be converted to UTF-32 if it is not in this format.
If you are using the Irrlicht Engine, it is better not to use this function but
IFileSystem::createXMLReader() instead.
\param filename: Name of file to be opened.
\return Returns a pointer to the created xml parser. This pointer should be
deleted using 'delete' after no longer needed. Returns 0 if an error occurred
and the file could not be opened. */
IRRLICHT_API IrrXMLReaderUTF32* IRRCALLCONV createIrrXMLReaderUTF32(const char* filename);
//! Creates an instance of an UFT-32 xml parser.
/** This means that all character data will be returned in UTF-32. The file to read can
be in any format, it will be converted to UTF-32 if it is not in this format.
if you are using the Irrlicht Engine, it is better not to use this function but
IFileSystem::createXMLReader() instead.
\param file: Pointer to opened file, must have been opened in binary mode, e.g.
using fopen("foo.bar", "wb"); The file will not be closed after it has been read.
\return Returns a pointer to the created xml parser. This pointer should be
deleted using 'delete' after no longer needed. Returns 0 if an error occurred
and the file could not be opened. */
IRRLICHT_API IrrXMLReaderUTF32* IRRCALLCONV createIrrXMLReaderUTF32(FILE* file);
//! Creates an instance of an UFT-32 xml parser.
/** This means that
all character data will be returned in UTF-32. The file to read can
be in any format, it will be converted to UTF-32 if it is not in this format.
If you are using the Irrlicht Engine, it is better not to use this function but
IFileSystem::createXMLReader() instead.
\param callback: Callback for file read abstraction. Implement your own
callback to make the xml parser read in other things than just files. See
IFileReadCallBack for more information about this.
\param deleteCallback: if true, the callback will be deleted after the file
has been read. Otherwise the caller is responsible for cleaning it up.
\return Returns a pointer to the created xml parser. This pointer should be
deleted using 'delete' after no longer needed. Returns 0 if an error occurred
and the file could not be opened. */
IRRLICHT_API IrrXMLReaderUTF32* IRRCALLCONV createIrrXMLReaderUTF32(IFileReadCallBack* callback,
bool deleteCallback = false);
#endif // _IRR_COMPILE_WITH_XML_
/*! \file irrXML.h
\brief Header file of the irrXML, the Irrlicht XML parser.
This file includes everything needed for using irrXML,
the XML parser of the Irrlicht Engine. To use irrXML,
you only need to include this file in your project:
\code
#include <irrXML.h>
\endcode
It is also common to use the two namespaces in which irrXML is included,
directly after including irrXML.h:
\code
#include <irrXML.h>
using namespace irr;
using namespace io;
\endcode
*/
} // end namespace io
} // end namespace irr
#endif // __IRR_XML_H_INCLUDED__

View File

@ -116,7 +116,6 @@
#include "IMeshSceneNode.h"
#include "IMeshWriter.h"
#include "IOctreeSceneNode.h"
#include "IColladaMeshWriter.h"
#include "IMetaTriangleSelector.h"
#include "IOSOperator.h"
#include "IParticleSystemSceneNode.h" // also includes all emitters and attractors
@ -134,7 +133,6 @@
#include "irrString.h"
#include "irrTypes.h"
#include "path.h"
#include "irrXML.h"
#include "ISceneCollisionManager.h"
#include "ISceneLoader.h"
#include "ISceneManager.h"
@ -159,8 +157,6 @@
#include "IVideoModeList.h"
#include "IVolumeLightSceneNode.h"
#include "IWriteFile.h"
#include "IXMLReader.h"
#include "IXMLWriter.h"
#include "ILightManager.h"
#include "Keycodes.h"
#include "line2d.h"
@ -375,7 +371,7 @@ namespace irr
{
}
//! This namespace provides interfaces for input/output: Reading and writing files, accessing zip archives, xml files, ...
//! This namespace provides interfaces for input/output: Reading and writing files, accessing zip archives, ...
namespace io
{
}