ICU-8573 remove support for U_IOSTREAM_SOURCE=198506

X-SVN-Rev: 30278
This commit is contained in:
Markus Scherer 2011-07-05 23:42:32 +00:00
parent 515788594c
commit 493668a25f
9 changed files with 22 additions and 84 deletions

View file

@ -69,20 +69,24 @@
/**
* 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
* "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 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).
* 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
/**

View file

@ -31,12 +31,8 @@
#if 0
#if U_IOSTREAM_SOURCE >= 199711
#include <iostream>
using namespace std;
#elif U_IOSTREAM_SOURCE >= 198506
#include <iostream.h>
#endif
//DEBUGGING
void

View file

@ -787,12 +787,8 @@ Formattable::setDecimalNumber(const StringPiece &numberString, UErrorCode &statu
//----------------------------------------------------
#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"

View file

@ -54,29 +54,6 @@ U_IO_API std::ostream & U_EXPORT2 operator<<(std::ostream& stream, const Unicode
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 */

View file

@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (C) 2001-2010, International Business Machines
* Copyright (C) 2001-2011, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* FILE NAME : ustream.cpp
@ -12,7 +12,6 @@
******************************************************************************
*/
#include "unicode/utypes.h"
#include "unicode/uobject.h"
#include "unicode/ustream.h"
@ -24,13 +23,9 @@
// 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
@ -169,4 +164,3 @@ STOP_READING:
U_NAMESPACE_END
#endif

View file

@ -187,18 +187,13 @@ void TestMessageFormat::testBug2()
}
#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>
@ -243,7 +238,7 @@ operator<<( IntlTest& stream,
}
return stream;
}
#endif /* defined(_DEBUG) && U_IOSTREAM_SOURCE!=0 */
#endif /* defined(_DEBUG) && U_IOSTREAM_SOURCE >= 199711 */
#endif
void TestMessageFormat::PatternTest()

View file

@ -19,12 +19,8 @@
#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

View file

@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (C) 2002-2010, International Business Machines
* Copyright (C) 2002-2011, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* file name: iotest.cpp
@ -694,7 +694,7 @@ static void addAllTests(TestNode** root) {
addTest(root, &DataDrivenPrintfPrecision, "datadriv/DataDrivenPrintfPrecision");
addTest(root, &DataDrivenScanf, "datadriv/DataDrivenScanf");
#endif
#if U_IOSTREAM_SOURCE
#if U_IOSTREAM_SOURCE >= 199711
addStreamTests(root);
#endif
}

View file

@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (C) 2002-2010, International Business Machines
* Copyright (C) 2002-2011, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* file name: iotest.cpp
@ -31,11 +31,6 @@
#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>
@ -51,11 +46,9 @@ const char C_NEW_LINE[] = {'\n',0};
#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");
@ -182,9 +175,6 @@ static void U_CALLCONV TestStream(void)
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
@ -248,12 +238,7 @@ testString(
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);
@ -271,11 +256,6 @@ static void U_CALLCONV TestStreamEOF(void)
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";