0ad/source/ps/XML/Xeromyces.h
janwas e6be7e36d2 FILE_WRITE_TO_MOD is now FILE_WRITE_TO_TARGET
ERR_(FILE|PATH)_NOT_FOUND -> ERR_TNODE_NOT_FOUND, ERR_NOT_(FILE|DIR) ->
ERR_TNODE_WRONG TYPE
path_util:
- path_append: bugfix (no more extraneous /); add support for appending
slash
- path_replace: bugfix (no more warnings for expected error)
- add path_last_component, path_foreach_component
- move some defs to the header that belong there from vfs.h/path.h

file: add dir_create; move PosixFile definition here and provide
accessor for fileio
vfs: no longer automatically append slash; instead, make sure caller
does
vfs_mount:
- mount_realpath: bugfix (strip trailing /), interface improvement
- document write_target; clarify MULTIPLE_MOUNTINGS; add support for
creating real dirs
vfs_tree:
- refactor TDir::add into find, add, find_and_add
- fix TDir and TNode for dir-ends-with-slash requirement
- split up lookup into lookup_cb and path_foreach_component
- add support for inserting dirs with given mount point: tree_add_path
(needed when mounting)

wposix: get rid of weird PATH_MAX = 260 (Win32 weirdness)


TextureManager: remove no longer needed SupportedTextureFormats
GameSetup, Xeromyces: setup XMB location to data/cache/mods/official/xmb
Util: HardcodedErrorString now uses error_description_r
VFSUtil, i18n: fixes for dir slash issue

Closes #79, #80

This was SVN commit r3874.
2006-05-17 14:48:18 +00:00

71 lines
1.9 KiB
C++

/*
Xeromyces file-loading interface.
Automatically creates and caches relatively
efficient binary representations of XML files.
- Philip Taylor (philip@zaynar.demon.co.uk / @wildfiregames.com)
*/
#ifndef _XEROMYCES_H_
#define _XEROMYCES_H_
#include "ps/Errors.h"
ERROR_GROUP(Xeromyces);
ERROR_TYPE(Xeromyces, XMLOpenFailed);
ERROR_TYPE(Xeromyces, XMLParseError);
#include "XeroXMB.h"
#include "CVFSFile.h"
class CXeromyces : public XMBFile
{
public:
CXeromyces();
~CXeromyces();
// Load from an XML file (with invisible XMB caching).
PSRETURN Load(const char* filename);
// Call once when shutting down the program, to unload Xerces.
static void Terminate();
private:
// Find out write location of the XMB file corresponding to xmlFilename
void getXMBPath(const char* xmlFilename, const char* xmbFilename,
char* xmbPath);
bool ReadXMBFile(const char* filename);
XMBFile* XMB;
CVFSFile* XMBFileHandle; // if it's being read from disk
char* XMBBuffer; // if it's being read from RAM
static int XercesLoaded; // for once-only initialisation
};
#define _XERO_MAKE_UID2__(p,l) p ## l
#define _XERO_MAKE_UID1__(p,l) _XERO_MAKE_UID2__(p,l)
#define _XERO_CHILDREN _XERO_MAKE_UID1__(_children_, __LINE__)
#define _XERO_I _XERO_MAKE_UID1__(_i_, __LINE__)
#define XERO_ITER_EL(parent_element, child_element) \
XMBElementList _XERO_CHILDREN = parent_element.getChildNodes(); \
XMBElement child_element (0); \
for (int _XERO_I = 0; \
_XERO_I < _XERO_CHILDREN.Count \
&& (child_element = _XERO_CHILDREN.item(_XERO_I), 1); \
++_XERO_I)
#define XERO_ITER_ATTR(parent_element, attribute) \
XMBAttributeList _XERO_CHILDREN = parent_element.getAttributes(); \
XMBAttribute attribute; \
for (int _XERO_I = 0; \
_XERO_I < _XERO_CHILDREN.Count \
&& (attribute = _XERO_CHILDREN.item(_XERO_I), 1); \
++_XERO_I)
#endif // _XEROMYCES_H_