/**
* Define what support for C++ streams is available.
- * If U_IOSTREAM_SOURCE is set to 199711, then <iostream> is available
- * (1997711 is the date the ISO/IEC C++ FDIS was published), and then
+ *
+ * If U_IOSTREAM_SOURCE is set to 199711, then <iostream> is available
+ * (the ISO/IEC C++ FDIS was published in November 1997), and then
* one should qualify streams using the std namespace in ICU header
* files.
- * If U_IOSTREAM_SOURCE is set to 198506, then <iostream.h> is
- * available instead (198506 is the date when Stroustrup published
+ * Starting with ICU 49, this is the only supported version.
+ *
+ * If U_IOSTREAM_SOURCE is set to 198506, then <iostream.h> is
+ * available instead (in June 1985 Stroustrup published
* "An Extensible I/O Facility for C++" at the summer USENIX conference).
- * If U_IOSTREAM_SOURCE is 0, then C++ streams are not available and
- * support for them will be silently suppressed in ICU.
+ * Starting with ICU 49, this version is not supported any more.
*
+ * If U_IOSTREAM_SOURCE is 0 (or any value less than 199711),
+ * then C++ streams are not available and
+ * support for them will be silently suppressed in ICU.
*/
-
#ifndef U_IOSTREAM_SOURCE
-#define U_IOSTREAM_SOURCE @U_IOSTREAM_SOURCE@
+#define U_IOSTREAM_SOURCE 199711
#endif
/**
#if 0
-#if U_IOSTREAM_SOURCE >= 199711
#include <iostream>
using namespace std;
-#elif U_IOSTREAM_SOURCE >= 198506
-#include <iostream.h>
-#endif
//DEBUGGING
void
//----------------------------------------------------
#ifdef _DEBUG
-#if U_IOSTREAM_SOURCE >= 199711
#include <iostream>
using namespace std;
-#elif U_IOSTREAM_SOURCE >= 198506
-#include <iostream.h>
-#endif
#include "unicode/datefmt.h"
#include "unistrm.h"
U_IO_API std::istream & U_EXPORT2 operator>>(std::istream& stream, UnicodeString& s);
U_NAMESPACE_END
-#elif U_IOSTREAM_SOURCE >= 198506
-/* <istream.h> and <ostream.h> don't exist. */
-#include <iostream.h>
-
-U_NAMESPACE_BEGIN
-/**
- * Write the contents of a UnicodeString to a C++ ostream. This functions writes
- * the characters in a UnicodeString to an ostream. The UChars in the
- * UnicodeString are converted to the char based ostream with the default
- * converter.
- * @stable 3.0
- */
-U_IO_API ostream & U_EXPORT2 operator<<(ostream& stream, const UnicodeString& s);
-
-/**
- * Write the contents from a C++ istream to a UnicodeString. The UChars in the
- * UnicodeString are converted from the char based istream with the default
- * converter.
- * @stable 3.0
- */
-U_IO_API istream & U_EXPORT2 operator>>(istream& stream, UnicodeString& s);
-U_NAMESPACE_END
-
#endif
/* No operator for UChar because it can conflict with wchar_t */
/*
**********************************************************************
-* Copyright (C) 2001-2010, International Business Machines
+* Copyright (C) 2001-2011, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* FILE NAME : ustream.cpp
******************************************************************************
*/
-
#include "unicode/utypes.h"
#include "unicode/uobject.h"
#include "unicode/ustream.h"
// console IO
-#if U_IOSTREAM_SOURCE >= 198506
-
#if U_IOSTREAM_SOURCE >= 199711
+
#define STD_NAMESPACE std::
-#else
-#define STD_NAMESPACE
-#endif
#define STD_OSTREAM STD_NAMESPACE ostream
#define STD_ISTREAM STD_NAMESPACE istream
U_NAMESPACE_END
#endif
-
}
#if 0
-#if defined(_DEBUG) && U_IOSTREAM_SOURCE!=0
+#if defined(_DEBUG) && U_IOSTREAM_SOURCE >= 199711
//----------------------------------------------------
// console I/O
//----------------------------------------------------
-#if U_IOSTREAM_SOURCE >= 199711
-# include <iostream>
- std::ostream& operator<<(std::ostream& stream, const Formattable& obj);
-#elif U_IOSTREAM_SOURCE >= 198506
-# include <iostream.h>
- ostream& operator<<(ostream& stream, const Formattable& obj);
-#endif
+#include <iostream>
+std::ostream& operator<<(std::ostream& stream, const Formattable& obj);
#include "unicode/datefmt.h"
#include <stdlib.h>
}
return stream;
}
-#endif /* defined(_DEBUG) && U_IOSTREAM_SOURCE!=0 */
+#endif /* defined(_DEBUG) && U_IOSTREAM_SOURCE >= 199711 */
#endif
void TestMessageFormat::PatternTest()
#if 0
#include "unicode/ustream.h"
-#if U_IOSTREAM_SOURCE >= 199711
#include <iostream>
using namespace std;
-#elif U_IOSTREAM_SOURCE >= 198506
-#include <iostream.h>
-#endif
#endif
/*
**********************************************************************
-* Copyright (C) 2002-2010, International Business Machines
+* Copyright (C) 2002-2011, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* file name: iotest.cpp
addTest(root, &DataDrivenPrintfPrecision, "datadriv/DataDrivenPrintfPrecision");
addTest(root, &DataDrivenScanf, "datadriv/DataDrivenScanf");
#endif
-#if U_IOSTREAM_SOURCE
+#if U_IOSTREAM_SOURCE >= 199711
addStreamTests(root);
#endif
}
/*
**********************************************************************
-* Copyright (C) 2002-2010, International Business Machines
+* Copyright (C) 2002-2011, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* file name: iotest.cpp
#include <fstream>
#include <iomanip>
using namespace std;
-#elif U_IOSTREAM_SOURCE >= 198506
-#define USE_OLD_IOSTREAM 1
-#include <strstream.h>
-#include <fstream.h>
-#endif
#include <string.h>
#endif
U_CDECL_END
-#if U_IOSTREAM_SOURCE
U_CDECL_BEGIN
static void U_CALLCONV TestStream(void)
{
-#if U_IOSTREAM_SOURCE >= 198506
const UChar thisMu[] = { 0x74, 0x48, 0x69, 0x73, 0x3BC, 0};
const UChar mu[] = { 0x6D, 0x75, 0};
UnicodeString str1 = UNICODE_STRING_SIMPLE("str1");
log_err("Error converting string for large stream buffer testing.\n");
}
ucnv_close(defConv);
-#else
- log_info("U_IOSTREAM_SOURCE is disabled\n");
-#endif
}
#define IOSTREAM_GOOD_SHIFT 3
if (getBitStatus(sstrm) != expectedStatus) {
printBits(sstrm);
-#ifdef USE_OLD_IOSTREAM
- log_info("Warning. Expected status %d, Got %d. This maybe caused by the fact that the non-standardized iostream is being used.\n", expectedStatus, getBitStatus(sstrm));
- log_info("See verbose output for details.\n");
-#else
log_err("Expected status %d, Got %d. See verbose output for details\n", expectedStatus, getBitStatus(sstrm));
-#endif
}
if (str != UnicodeString(expectedString)) {
log_err("Did not get expected results from \"%s\", expected \"%s\"\n", testString, expectedString);
strstream ss;
#endif
-#ifdef USE_OLD_IOSTREAM
- log_info("Old non-standardized iostream being used. This may result in inconsistent state flag settings. (e.g. failbit may not be set properly)\n");
- log_info("In such a case, warnings will be issued instead of errors.\n");
-#endif
-
fs << "EXAMPLE";
fs.seekg(0);
ss << "EXAMPLE";