From fd5c310e0b0d884d3e93761ee6c3ef1b3a883121 Mon Sep 17 00:00:00 2001 From: jez_higgins <> Date: Fri, 12 Jul 2002 22:10:52 +0000 Subject: [PATCH] In an attempt to make compilation easier, XMLReader now has an ifdef ladder which pulls in the headers for the various parsers if the appropriate macros are defined - USE_EXPAT, USE_XERCES, USE_LIBXML2, USE_MSXML. You can define any or all of them, or none should you so wish. It also sets SAX::XMLReader as a default class - ie if you define one of the above macros, SAX::XMLReader will become a synonym for SAX::expat_wrapper or whatever. --- SAX/SAX.dsp | 25 +++++++++++++++++++++- SAX/XMLReader.h | 55 +++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 70 insertions(+), 10 deletions(-) diff --git a/SAX/SAX.dsp b/SAX/SAX.dsp index c0098ee9..5efdd3b8 100644 --- a/SAX/SAX.dsp +++ b/SAX/SAX.dsp @@ -64,7 +64,7 @@ LIB32=link.exe -lib # PROP Intermediate_Dir "Debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GR /GX /ZI /Od /I "..\\" /I "\work\include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GR /GX /ZI /Od /I "..\\" /I "\work\include" /I "\work\lib" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "USE_EXPAT" /YX /FD /GZ /c # ADD BASE RSC /l 0x809 /d "_DEBUG" # ADD RSC /l 0x809 /d "_DEBUG" BSC32=bscmake.exe @@ -254,6 +254,15 @@ SOURCE=.\ext\Locator2.h # Begin Source File SOURCE=.\wrappers\saxexpat.cpp + +!IF "$(CFG)" == "SAXlib - Win32 Release" + +!ELSEIF "$(CFG)" == "SAXlib - Win32 Debug" + +# PROP Exclude_From_Build 1 + +!ENDIF + # End Source File # Begin Source File @@ -262,6 +271,16 @@ SOURCE=.\wrappers\saxexpat.h # Begin Source File SOURCE=.\wrappers\saxlibxml2.cpp + +!IF "$(CFG)" == "SAXlib - Win32 Release" + +!ELSEIF "$(CFG)" == "SAXlib - Win32 Debug" + +# PROP Exclude_From_Build 1 +# SUBTRACT CPP /WX + +!ENDIF + # End Source File # Begin Source File @@ -292,5 +311,9 @@ SOURCE=.\filter\Writer.h SOURCE=.\parsers\saxgarden.h # End Source File # End Group +# Begin Source File + +SOURCE=.\saxlib.cpp +# End Source File # End Target # End Project diff --git a/SAX/XMLReader.h b/SAX/XMLReader.h index fb0cc432..aaa72240 100644 --- a/SAX/XMLReader.h +++ b/SAX/XMLReader.h @@ -403,16 +403,53 @@ public: } // setProperty }; // class basic_XMLReader -/** - * {@link basic_XMLReader basic_XMLReader} instantiated for chars - */ -typedef basic_XMLReader XMLReader; -/** - * {@link basic_XMLReader basic_XMLReader} instantiated for wchar_t - */ -typedef basic_XMLReader wXMLReader; - }; // namespace SAX +// ifdef ladder to set up the default parser +#ifdef USE_LIBXML2 +#pragma message("Including libxml2") +#include +#undef DEF_SAX_P +#define DEF_SAX_P libxml2_wrapper +#endif +#ifdef USE_MSXML +#pragma message("Including MSXML") +#include +#undef DEF_SAX_P +#define DEF_SAX_P msxml2_wrapper +#endif +#ifdef USE_XERCES +#pragma message("Including Xerces") +#include +#undef DEF_SAX_P +#define DEF_SAX_P xerces_wrapper +#endif +#ifdef USE_GARDEN +#pragma message("Including Garden") +#include +#undef DEF_SAX_P +#define DEF_SAX_P Garden +#endif +#ifdef USE_EXPAT +#pragma message("Including Expat") +#include +#undef DEF_SAX_P +#define DEF_SAX_P expat_wrapper +#endif + +#ifndef NO_DEFAULT_PARSER +#ifdef DEF_SAX_P +namespace SAX +{ + template + class XMLReader : public DEF_SAX_P { }; +} // namespace SAX +#else +#error No default parser defined. +#endif +#endif + +#undef DEF_P + #endif // end of file