IOStream.hxx.in 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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 <@KWSYS_NAMESPACE@/ios/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. # define kwsys_ios @KWSYS_NAMESPACE@_ios
  17. #endif
  18. /* Whether istream supports long long. */
  19. #define @KWSYS_NAMESPACE@_IOS_HAS_ISTREAM_LONG_LONG @KWSYS_IOS_HAS_ISTREAM_LONG_LONG@
  20. /* Whether ostream supports long long. */
  21. #define @KWSYS_NAMESPACE@_IOS_HAS_OSTREAM_LONG_LONG @KWSYS_IOS_HAS_OSTREAM_LONG_LONG@
  22. /* Size of type long long and 0 if not available. */
  23. #define @KWSYS_NAMESPACE@_IOS_SIZEOF_LONG_LONG @KWSYS_SIZEOF_LONG_LONG@
  24. /* Determine whether we need to define the streaming operators for
  25. long long or __int64. */
  26. #if @KWSYS_NAMESPACE@_IOS_SIZEOF_LONG_LONG
  27. # if !@KWSYS_NAMESPACE@_IOS_HAS_ISTREAM_LONG_LONG || \
  28. !@KWSYS_NAMESPACE@_IOS_HAS_OSTREAM_LONG_LONG
  29. # define @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL 1
  30. namespace @KWSYS_NAMESPACE@
  31. {
  32. typedef long long IOStreamSLL;
  33. typedef unsigned long long IOStreamULL;
  34. }
  35. # endif
  36. #elif defined(_MSC_VER) && _MSC_VER < 1300
  37. # define @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL 1
  38. namespace @KWSYS_NAMESPACE@
  39. {
  40. typedef __int64 IOStreamSLL;
  41. typedef unsigned __int64 IOStreamULL;
  42. }
  43. #endif
  44. #if !defined(@KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL)
  45. # define @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL 0
  46. #endif
  47. #if @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL
  48. # if !@KWSYS_NAMESPACE@_IOS_HAS_ISTREAM_LONG_LONG
  49. /* Input stream operator implementation functions. */
  50. namespace @KWSYS_NAMESPACE@
  51. {
  52. kwsysEXPORT kwsys_ios::istream& IOStreamScan(kwsys_ios::istream&,
  53. IOStreamSLL&);
  54. kwsysEXPORT kwsys_ios::istream& IOStreamScan(kwsys_ios::istream&,
  55. IOStreamULL&);
  56. }
  57. /* Provide input stream operator for long long. */
  58. # if !defined(@KWSYS_NAMESPACE@_IOS_NO_ISTREAM_LONG_LONG) && \
  59. !defined(KWSYS_IOS_ISTREAM_LONG_LONG_DEFINED)
  60. # define KWSYS_IOS_ISTREAM_LONG_LONG_DEFINED
  61. # define @KWSYS_NAMESPACE@_IOS_ISTREAM_LONG_LONG_DEFINED
  62. inline kwsys_ios::istream&
  63. operator>>(kwsys_ios::istream& is, @KWSYS_NAMESPACE@::IOStreamSLL& value)
  64. {
  65. return @KWSYS_NAMESPACE@::IOStreamScan(is, value);
  66. }
  67. # endif
  68. /* Provide input stream operator for unsigned long long. */
  69. # if !defined(@KWSYS_NAMESPACE@_IOS_NO_ISTREAM_UNSIGNED_LONG_LONG) && \
  70. !defined(KWSYS_IOS_ISTREAM_UNSIGNED_LONG_LONG_DEFINED)
  71. # define KWSYS_IOS_ISTREAM_UNSIGNED_LONG_LONG_DEFINED
  72. # define @KWSYS_NAMESPACE@_IOS_ISTREAM_UNSIGNED_LONG_LONG_DEFINED
  73. inline kwsys_ios::istream&
  74. operator>>(kwsys_ios::istream& is, @KWSYS_NAMESPACE@::IOStreamULL& value)
  75. {
  76. return @KWSYS_NAMESPACE@::IOStreamScan(is, value);
  77. }
  78. # endif
  79. # endif /* !@KWSYS_NAMESPACE@_IOS_HAS_ISTREAM_LONG_LONG */
  80. # if !@KWSYS_NAMESPACE@_IOS_HAS_OSTREAM_LONG_LONG
  81. /* Output stream operator implementation functions. */
  82. namespace @KWSYS_NAMESPACE@
  83. {
  84. kwsysEXPORT kwsys_ios::ostream& IOStreamPrint(kwsys_ios::ostream&,
  85. IOStreamSLL);
  86. kwsysEXPORT kwsys_ios::ostream& IOStreamPrint(kwsys_ios::ostream&,
  87. IOStreamULL);
  88. }
  89. /* Provide output stream operator for long long. */
  90. # if !defined(@KWSYS_NAMESPACE@_IOS_NO_OSTREAM_LONG_LONG) && \
  91. !defined(KWSYS_IOS_OSTREAM_LONG_LONG_DEFINED)
  92. # define KWSYS_IOS_OSTREAM_LONG_LONG_DEFINED
  93. # define @KWSYS_NAMESPACE@_IOS_OSTREAM_LONG_LONG_DEFINED
  94. inline kwsys_ios::ostream&
  95. operator<<(kwsys_ios::ostream& os, @KWSYS_NAMESPACE@::IOStreamSLL value)
  96. {
  97. return @KWSYS_NAMESPACE@::IOStreamPrint(os, value);
  98. }
  99. # endif
  100. /* Provide output stream operator for unsigned long long. */
  101. # if !defined(@KWSYS_NAMESPACE@_IOS_NO_OSTREAM_UNSIGNED_LONG_LONG) && \
  102. !defined(KWSYS_IOS_OSTREAM_UNSIGNED_LONG_LONG_DEFINED)
  103. # define KWSYS_IOS_OSTREAM_UNSIGNED_LONG_LONG_DEFINED
  104. # define @KWSYS_NAMESPACE@_IOS_OSTREAM_UNSIGNED_LONG_LONG_DEFINED
  105. inline kwsys_ios::ostream&
  106. operator<<(kwsys_ios::ostream& os, @KWSYS_NAMESPACE@::IOStreamULL value)
  107. {
  108. return @KWSYS_NAMESPACE@::IOStreamPrint(os, value);
  109. }
  110. # endif
  111. # endif /* !@KWSYS_NAMESPACE@_IOS_HAS_OSTREAM_LONG_LONG */
  112. #endif /* @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL */
  113. /* Undefine temporary macros. */
  114. #if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
  115. # undef kwsysEXPORT
  116. # undef kwsys_ios
  117. #endif
  118. /* If building a C++ file in kwsys itself, give the source file
  119. access to the macros without a configured namespace. */
  120. #if defined(KWSYS_NAMESPACE)
  121. # define KWSYS_IOS_SIZEOF_LONG_LONG @KWSYS_NAMESPACE@_IOS_SIZEOF_LONG_LONG
  122. # define KWSYS_IOS_HAS_ISTREAM_LONG_LONG @KWSYS_NAMESPACE@_IOS_HAS_ISTREAM_LONG_LONG
  123. # define KWSYS_IOS_HAS_OSTREAM_LONG_LONG @KWSYS_NAMESPACE@_IOS_HAS_OSTREAM_LONG_LONG
  124. # define KWSYS_IOS_NEED_OPERATORS_LL @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL
  125. #endif
  126. #endif