ustream.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. **********************************************************************
  3. * Copyright (C) 2001-2014 International Business Machines
  4. * Corporation and others. All Rights Reserved.
  5. **********************************************************************
  6. * FILE NAME : ustream.h
  7. *
  8. * Modification History:
  9. *
  10. * Date Name Description
  11. * 06/25/2001 grhoten Move iostream from unistr.h
  12. ******************************************************************************
  13. */
  14. #ifndef USTREAM_H
  15. #define USTREAM_H
  16. #include "unicode/unistr.h"
  17. #if !UCONFIG_NO_CONVERSION // not available without conversion
  18. /**
  19. * \file
  20. * \brief C++ API: Unicode iostream like API
  21. *
  22. * At this time, this API is very limited. It contains
  23. * operator<< and operator>> for UnicodeString manipulation with the
  24. * C++ I/O stream API.
  25. */
  26. #if !defined(_MSC_VER)
  27. namespace std { class type_info; } // WORKAROUND: http://llvm.org/bugs/show_bug.cgi?id=13364
  28. #endif
  29. #if U_IOSTREAM_SOURCE >= 199711
  30. #if (__GNUC__ == 2)
  31. #include <iostream>
  32. #else
  33. #include <istream>
  34. #include <ostream>
  35. #endif
  36. U_NAMESPACE_BEGIN
  37. /**
  38. * Write the contents of a UnicodeString to a C++ ostream. This functions writes
  39. * the characters in a UnicodeString to an ostream. The UChars in the
  40. * UnicodeString are converted to the char based ostream with the default
  41. * converter.
  42. * @stable 3.0
  43. */
  44. U_IO_API std::ostream & U_EXPORT2 operator<<(std::ostream& stream, const UnicodeString& s);
  45. /**
  46. * Write the contents from a C++ istream to a UnicodeString. The UChars in the
  47. * UnicodeString are converted from the char based istream with the default
  48. * converter.
  49. * @stable 3.0
  50. */
  51. U_IO_API std::istream & U_EXPORT2 operator>>(std::istream& stream, UnicodeString& s);
  52. U_NAMESPACE_END
  53. #endif
  54. /* No operator for UChar because it can conflict with wchar_t */
  55. #endif
  56. #endif