ustream.h revision 27f654740f2a26ad62a5c155af9199af9e69b889
1ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/*
2ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru**********************************************************************
327f654740f2a26ad62a5c155af9199af9e69b889claireho*   Copyright (C) 2001-2010 International Business Machines
4ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*   Corporation and others.  All Rights Reserved.
5ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru**********************************************************************
6ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*  FILE NAME : ustream.h
7ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*
8ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*   Modification History:
9ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*
10ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*   Date        Name        Description
11ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*   06/25/2001  grhoten     Move iostream from unistr.h
12ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru******************************************************************************
13ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*/
1427f654740f2a26ad62a5c155af9199af9e69b889claireho
15ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#ifndef USTREAM_H
16ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#define USTREAM_H
17ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
18ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/unistr.h"
19ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
20ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/**
21ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * \file
22ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * \brief C++ API: Unicode iostream like API
23ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru *
24ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * At this time, this API is very limited. It contains
25ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * operator<< and operator>> for UnicodeString manipulation with the
26ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * C++ I/O stream API.
27ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */
28ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
29ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#if U_IOSTREAM_SOURCE >= 199711
3027f654740f2a26ad62a5c155af9199af9e69b889claireho#if (__GNUC__ == 2)
3127f654740f2a26ad62a5c155af9199af9e69b889claireho#include <iostream>
3227f654740f2a26ad62a5c155af9199af9e69b889claireho#else
33ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include <istream>
34ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include <ostream>
3527f654740f2a26ad62a5c155af9199af9e69b889claireho#endif
36ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
37ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_BEGIN
38ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
39ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/**
40ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Write the contents of a UnicodeString to a C++ ostream. This functions writes
41ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * the characters in a UnicodeString to an ostream. The UChars in the
42ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * UnicodeString are converted to the char based ostream with the default
43ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * converter.
44ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable 3.0
45ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */
46ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_IO_API std::ostream & U_EXPORT2 operator<<(std::ostream& stream, const UnicodeString& s);
47ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
48ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/**
49ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Write the contents from a C++ istream to a UnicodeString. The UChars in the
50ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * UnicodeString are converted from the char based istream with the default
51ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * converter.
52ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * @stable 3.0
53ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */
54ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_IO_API std::istream & U_EXPORT2 operator>>(std::istream& stream, UnicodeString& s);
55ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_END
56ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
57ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#elif U_IOSTREAM_SOURCE >= 198506
58ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/* <istream.h> and <ostream.h> don't exist. */
59ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include <iostream.h>
60ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
61ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_BEGIN
62ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_IO_API ostream & U_EXPORT2 operator<<(ostream& stream, const UnicodeString& s);
63ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
64ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_IO_API istream & U_EXPORT2 operator>>(istream& stream, UnicodeString& s);
65ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruU_NAMESPACE_END
66ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
67ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif
68ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
69ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/* No operator for UChar because it can conflict with wchar_t  */
70ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
71ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif
72