From 1d8bde2f55542103a1fc88863ee5dbde87fc258d Mon Sep 17 00:00:00 2001 From: Gareth Reakes <gareth@apache.org> Date: Thu, 29 May 2003 11:18:37 +0000 Subject: [PATCH] Added macros in so we can determine whether to do things like iostream as opposed to iostream.h and whether to use std:: or not. git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@175055 13f79535-47bb-0310-9956-ffa450edef68 --- src/xercesc/framework/StdOutFormatTarget.cpp | 14 +++++++++++--- src/xercesc/util/Compilers/CSetDefs.hpp | 7 +++++++ src/xercesc/util/Compilers/GCCDefs.hpp | 7 +++++++ src/xercesc/util/Compilers/SunCCDefs.hpp | 7 +++++++ src/xercesc/util/Compilers/VCPPDefs.hpp | 7 +++++++ src/xercesc/util/XercesDefs.hpp | 12 ++++++++++++ 6 files changed, 51 insertions(+), 3 deletions(-) diff --git a/src/xercesc/framework/StdOutFormatTarget.cpp b/src/xercesc/framework/StdOutFormatTarget.cpp index 899169684..585cf8cb5 100644 --- a/src/xercesc/framework/StdOutFormatTarget.cpp +++ b/src/xercesc/framework/StdOutFormatTarget.cpp @@ -57,6 +57,9 @@ /* * $Id$ * $Log$ + * Revision 1.7 2003/05/29 11:18:37 gareth + * Added macros in so we can determine whether to do things like iostream as opposed to iostream.h and whether to use std:: or not. + * * Revision 1.6 2003/01/24 20:20:22 tng * Add method flush to XMLFormatTarget * @@ -80,7 +83,12 @@ */ #include <xercesc/framework/StdOutFormatTarget.hpp> + +#if defined(XERCES_NEW_IOSTREAMS) +#include <iostream> +#else #include <iostream.h> +#endif XERCES_CPP_NAMESPACE_BEGIN @@ -92,7 +100,7 @@ StdOutFormatTarget::~StdOutFormatTarget() void StdOutFormatTarget::flush() { - cout.flush(); + XERCES_STD_QUALIFIER cout.flush(); } void StdOutFormatTarget::writeChars(const XMLByte* const toWrite @@ -104,8 +112,8 @@ void StdOutFormatTarget::writeChars(const XMLByte* const toWrite // Without the cast, it was printing the pointer value in hex. // Quite annoying, considering every other platform printed // the string with the explicit cast to char* below. - cout.write((char *) toWrite, (int) count); - cout.flush(); + XERCES_STD_QUALIFIER cout.write((char *) toWrite, (int) count); + XERCES_STD_QUALIFIER cout.flush(); } diff --git a/src/xercesc/util/Compilers/CSetDefs.hpp b/src/xercesc/util/Compilers/CSetDefs.hpp index ff73023e3..70ca28684 100644 --- a/src/xercesc/util/Compilers/CSetDefs.hpp +++ b/src/xercesc/util/Compilers/CSetDefs.hpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.7 2003/05/29 11:18:37 gareth + * Added macros in so we can determine whether to do things like iostream as opposed to iostream.h and whether to use std:: or not. + * * Revision 1.6 2002/11/05 21:43:55 tng * Turn on C++ Namespace support only if using AIX xlC version 4 or higher. * @@ -193,6 +196,10 @@ typedef int XMLInt32; #define XERCES_DEBUG #endif +#if __IBMCPP__ >= 400 +#define XERCES_NEW_IOSTREAMS +#define XERCES_STD_NAMESPACE +#endif // --------------------------------------------------------------------------- // Provide some common string ops that are different/notavail on CSet diff --git a/src/xercesc/util/Compilers/GCCDefs.hpp b/src/xercesc/util/Compilers/GCCDefs.hpp index 4beac0dec..99796bddd 100644 --- a/src/xercesc/util/Compilers/GCCDefs.hpp +++ b/src/xercesc/util/Compilers/GCCDefs.hpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.7 2003/05/29 11:18:37 gareth + * Added macros in so we can determine whether to do things like iostream as opposed to iostream.h and whether to use std:: or not. + * * Revision 1.6 2002/11/18 20:38:11 tng * [Bug 14612] GCCDefs clashes with cygwin's string.h for stricmp and strnicmp. * @@ -197,6 +200,10 @@ typedef int XMLInt32; #define XERCES_DEBUG #endif +#if __GNUC__ >= 3 +#define XERCES_NEW_IOSTREAMS +#define XERCES_STD_NAMESPACE +#endif // --------------------------------------------------------------------------- // Provide some common string ops that are different/notavail on GCC diff --git a/src/xercesc/util/Compilers/SunCCDefs.hpp b/src/xercesc/util/Compilers/SunCCDefs.hpp index 6989ba309..082192b4b 100644 --- a/src/xercesc/util/Compilers/SunCCDefs.hpp +++ b/src/xercesc/util/Compilers/SunCCDefs.hpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.6 2003/05/29 11:18:37 gareth + * Added macros in so we can determine whether to do things like iostream as opposed to iostream.h and whether to use std:: or not. + * * Revision 1.5 2002/11/04 14:45:20 tng * C++ Namespace Support. * @@ -196,6 +199,10 @@ typedef int XMLInt32; #define XERCES_DEBUG #endif +#if __SUNPRO_CC >= 0x500 +#define XERCES_NEW_IOSTREAMS +#define XERCES_STD_NAMESPACE +#endif // --------------------------------------------------------------------------- // Provide some common string ops that are different/notavail on CC diff --git a/src/xercesc/util/Compilers/VCPPDefs.hpp b/src/xercesc/util/Compilers/VCPPDefs.hpp index 080e76e11..46b74e757 100644 --- a/src/xercesc/util/Compilers/VCPPDefs.hpp +++ b/src/xercesc/util/Compilers/VCPPDefs.hpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.8 2003/05/29 11:18:37 gareth + * Added macros in so we can determine whether to do things like iostream as opposed to iostream.h and whether to use std:: or not. + * * Revision 1.7 2002/11/04 14:45:20 tng * C++ Namespace Support. * @@ -204,6 +207,10 @@ typedef int XMLInt32; #define XERCES_DEBUG #endif +#if _MSV_VER > 1300 +#define XERCES_NEW_IOSTREAMS +#define XERCES_STD_NAMESPACE +#endif // --------------------------------------------------------------------------- // The name of the DLL that is built by the Visual C++ version of the diff --git a/src/xercesc/util/XercesDefs.hpp b/src/xercesc/util/XercesDefs.hpp index 28ddb69f8..476302b07 100644 --- a/src/xercesc/util/XercesDefs.hpp +++ b/src/xercesc/util/XercesDefs.hpp @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.15 2003/05/29 11:18:37 gareth + * Added macros in so we can determine whether to do things like iostream as opposed to iostream.h and whether to use std:: or not. + * * Revision 1.14 2003/05/12 09:44:19 gareth * Port to NetBSD. Patch by Hiramatsu Yoshifumi. * @@ -452,6 +455,15 @@ typedef XMLUInt32 UCS4Ch; #define XERCES_CPP_NAMESPACE_QUALIFIER #endif +#if defined(XERCES_STD_NAMESPACE) + #define XERCES_USING_STD(NAME) using std :: NAME; + #define XERCES_STD_QUALIFIER std :: +#else + #define XERCES_USING_STD(NAME) + #define XERCES_STD_QUALIFIER +#endif + + // --------------------------------------------------------------------------- // Set up the import/export keyword for our core projects. The // PLATFORM_XXXX keywords are set in the per-development environment -- GitLab