IOStream.hxx.in 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /*============================================================================
  2. KWSys - Kitware System Library
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #ifndef @KWSYS_NAMESPACE@_IOStream_hxx
  11. #define @KWSYS_NAMESPACE@_IOStream_hxx
  12. #include <iosfwd>
  13. /* Define these macros temporarily to keep the code readable. */
  14. #if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
  15. # define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT
  16. #endif
  17. /* Whether istream supports long long. */
  18. #define @KWSYS_NAMESPACE@_IOS_HAS_ISTREAM_LONG_LONG @KWSYS_IOS_HAS_ISTREAM_LONG_LONG@
  19. /* Whether ostream supports long long. */
  20. #define @KWSYS_NAMESPACE@_IOS_HAS_OSTREAM_LONG_LONG @KWSYS_IOS_HAS_OSTREAM_LONG_LONG@
  21. /* Determine whether we need to define the streaming operators for
  22. long long or __int64. */
  23. #if @KWSYS_USE_LONG_LONG@
  24. # if !@KWSYS_NAMESPACE@_IOS_HAS_ISTREAM_LONG_LONG || \
  25. !@KWSYS_NAMESPACE@_IOS_HAS_OSTREAM_LONG_LONG
  26. # define @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL 1
  27. namespace @KWSYS_NAMESPACE@
  28. {
  29. typedef long long IOStreamSLL;
  30. typedef unsigned long long IOStreamULL;
  31. }
  32. # endif
  33. #elif defined(_MSC_VER) && _MSC_VER < 1300
  34. # define @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL 1
  35. namespace @KWSYS_NAMESPACE@
  36. {
  37. typedef __int64 IOStreamSLL;
  38. typedef unsigned __int64 IOStreamULL;
  39. }
  40. #endif
  41. #if !defined(@KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL)
  42. # define @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL 0
  43. #endif
  44. #if @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL
  45. # if !@KWSYS_NAMESPACE@_IOS_HAS_ISTREAM_LONG_LONG
  46. /* Input stream operator implementation functions. */
  47. namespace @KWSYS_NAMESPACE@
  48. {
  49. kwsysEXPORT std::istream& IOStreamScan(std::istream&, IOStreamSLL&);
  50. kwsysEXPORT std::istream& IOStreamScan(std::istream&, IOStreamULL&);
  51. }
  52. /* Provide input stream operator for long long. */
  53. # if !defined(@KWSYS_NAMESPACE@_IOS_NO_ISTREAM_LONG_LONG) && \
  54. !defined(KWSYS_IOS_ISTREAM_LONG_LONG_DEFINED)
  55. # define KWSYS_IOS_ISTREAM_LONG_LONG_DEFINED
  56. # define @KWSYS_NAMESPACE@_IOS_ISTREAM_LONG_LONG_DEFINED
  57. inline std::istream&
  58. operator>>(std::istream& is, @KWSYS_NAMESPACE@::IOStreamSLL& value)
  59. {
  60. return @KWSYS_NAMESPACE@::IOStreamScan(is, value);
  61. }
  62. # endif
  63. /* Provide input stream operator for unsigned long long. */
  64. # if !defined(@KWSYS_NAMESPACE@_IOS_NO_ISTREAM_UNSIGNED_LONG_LONG) && \
  65. !defined(KWSYS_IOS_ISTREAM_UNSIGNED_LONG_LONG_DEFINED)
  66. # define KWSYS_IOS_ISTREAM_UNSIGNED_LONG_LONG_DEFINED
  67. # define @KWSYS_NAMESPACE@_IOS_ISTREAM_UNSIGNED_LONG_LONG_DEFINED
  68. inline std::istream&
  69. operator>>(std::istream& is, @KWSYS_NAMESPACE@::IOStreamULL& value)
  70. {
  71. return @KWSYS_NAMESPACE@::IOStreamScan(is, value);
  72. }
  73. # endif
  74. # endif /* !@KWSYS_NAMESPACE@_IOS_HAS_ISTREAM_LONG_LONG */
  75. # if !@KWSYS_NAMESPACE@_IOS_HAS_OSTREAM_LONG_LONG
  76. /* Output stream operator implementation functions. */
  77. namespace @KWSYS_NAMESPACE@
  78. {
  79. kwsysEXPORT std::ostream& IOStreamPrint(std::ostream&, IOStreamSLL);
  80. kwsysEXPORT std::ostream& IOStreamPrint(std::ostream&, IOStreamULL);
  81. }
  82. /* Provide output stream operator for long long. */
  83. # if !defined(@KWSYS_NAMESPACE@_IOS_NO_OSTREAM_LONG_LONG) && \
  84. !defined(KWSYS_IOS_OSTREAM_LONG_LONG_DEFINED)
  85. # define KWSYS_IOS_OSTREAM_LONG_LONG_DEFINED
  86. # define @KWSYS_NAMESPACE@_IOS_OSTREAM_LONG_LONG_DEFINED
  87. inline std::ostream&
  88. operator<<(std::ostream& os, @KWSYS_NAMESPACE@::IOStreamSLL value)
  89. {
  90. return @KWSYS_NAMESPACE@::IOStreamPrint(os, value);
  91. }
  92. # endif
  93. /* Provide output stream operator for unsigned long long. */
  94. # if !defined(@KWSYS_NAMESPACE@_IOS_NO_OSTREAM_UNSIGNED_LONG_LONG) && \
  95. !defined(KWSYS_IOS_OSTREAM_UNSIGNED_LONG_LONG_DEFINED)
  96. # define KWSYS_IOS_OSTREAM_UNSIGNED_LONG_LONG_DEFINED
  97. # define @KWSYS_NAMESPACE@_IOS_OSTREAM_UNSIGNED_LONG_LONG_DEFINED
  98. inline std::ostream&
  99. operator<<(std::ostream& os, @KWSYS_NAMESPACE@::IOStreamULL value)
  100. {
  101. return @KWSYS_NAMESPACE@::IOStreamPrint(os, value);
  102. }
  103. # endif
  104. # endif /* !@KWSYS_NAMESPACE@_IOS_HAS_OSTREAM_LONG_LONG */
  105. #endif /* @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL */
  106. /* Undefine temporary macros. */
  107. #if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
  108. # undef kwsysEXPORT
  109. #endif
  110. /* If building a C++ file in kwsys itself, give the source file
  111. access to the macros without a configured namespace. */
  112. #if defined(KWSYS_NAMESPACE)
  113. # define KWSYS_IOS_HAS_ISTREAM_LONG_LONG @KWSYS_NAMESPACE@_IOS_HAS_ISTREAM_LONG_LONG
  114. # define KWSYS_IOS_HAS_OSTREAM_LONG_LONG @KWSYS_NAMESPACE@_IOS_HAS_OSTREAM_LONG_LONG
  115. # define KWSYS_IOS_NEED_OPERATORS_LL @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL
  116. #endif
  117. #endif