ustream.h 1.9 KB

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