IOStream.hxx.in 4.8 KB
Newer Older
Kitware Robot's avatar
Kitware Robot committed
1 2
/* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
   file Copyright.txt or https://cmake.org/licensing#kwsys for details.  */
Kitware Robot's avatar
Kitware Robot committed
3 4 5
#ifndef @KWSYS_NAMESPACE@_IOStream_hxx
#define @KWSYS_NAMESPACE@_IOStream_hxx

Kitware Robot's avatar
Kitware Robot committed
6
#include <iosfwd>
Kitware Robot's avatar
Kitware Robot committed
7 8

/* Define these macros temporarily to keep the code readable.  */
Kitware Robot's avatar
Kitware Robot committed
9
#if !defined(KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
Kitware Robot's avatar
Kitware Robot committed
10
#  define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT
Kitware Robot's avatar
Kitware Robot committed
11 12 13
#endif

/* Whether istream supports long long.  */
Kitware Robot's avatar
Kitware Robot committed
14 15
#define @KWSYS_NAMESPACE@_IOS_HAS_ISTREAM_LONG_LONG                           \
  @KWSYS_IOS_HAS_ISTREAM_LONG_LONG@
Kitware Robot's avatar
Kitware Robot committed
16 17

/* Whether ostream supports long long.  */
Kitware Robot's avatar
Kitware Robot committed
18 19
#define @KWSYS_NAMESPACE@_IOS_HAS_OSTREAM_LONG_LONG                           \
  @KWSYS_IOS_HAS_OSTREAM_LONG_LONG@
Kitware Robot's avatar
Kitware Robot committed
20 21 22

/* Determine whether we need to define the streaming operators for
   long long or __int64.  */
Kitware Robot's avatar
Kitware Robot committed
23
#if @KWSYS_USE_LONG_LONG@
Kitware Robot's avatar
Kitware Robot committed
24 25 26
#  if !@KWSYS_NAMESPACE@_IOS_HAS_ISTREAM_LONG_LONG ||                         \
    !@KWSYS_NAMESPACE@_IOS_HAS_OSTREAM_LONG_LONG
#    define @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL 1
Kitware Robot's avatar
Kitware Robot committed
27 28 29 30
namespace @KWSYS_NAMESPACE@ {
typedef long long IOStreamSLL;
typedef unsigned long long IOStreamULL;
}
Kitware Robot's avatar
Kitware Robot committed
31
#  endif
Kitware Robot's avatar
Kitware Robot committed
32
#elif defined(_MSC_VER) && _MSC_VER < 1300
Kitware Robot's avatar
Kitware Robot committed
33
#  define @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL 1
Kitware Robot's avatar
Kitware Robot committed
34 35 36 37
namespace @KWSYS_NAMESPACE@ {
typedef __int64 IOStreamSLL;
typedef unsigned __int64 IOStreamULL;
}
Kitware Robot's avatar
Kitware Robot committed
38 39
#endif
#if !defined(@KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL)
Kitware Robot's avatar
Kitware Robot committed
40
#  define @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL 0
Kitware Robot's avatar
Kitware Robot committed
41 42 43
#endif

#if @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL
Kitware Robot's avatar
Kitware Robot committed
44
#  if !@KWSYS_NAMESPACE@_IOS_HAS_ISTREAM_LONG_LONG
Kitware Robot's avatar
Kitware Robot committed
45 46

/* Input stream operator implementation functions.  */
Kitware Robot's avatar
Kitware Robot committed
47
namespace @KWSYS_NAMESPACE@ {
Kitware Robot's avatar
Kitware Robot committed
48 49
kwsysEXPORT std::istream& IOStreamScan(std::istream&, IOStreamSLL&);
kwsysEXPORT std::istream& IOStreamScan(std::istream&, IOStreamULL&);
Kitware Robot's avatar
Kitware Robot committed
50 51 52
}

/* Provide input stream operator for long long.  */
Kitware Robot's avatar
Kitware Robot committed
53 54 55 56
#    if !defined(@KWSYS_NAMESPACE@_IOS_NO_ISTREAM_LONG_LONG) &&               \
      !defined(KWSYS_IOS_ISTREAM_LONG_LONG_DEFINED)
#      define KWSYS_IOS_ISTREAM_LONG_LONG_DEFINED
#      define @KWSYS_NAMESPACE@_IOS_ISTREAM_LONG_LONG_DEFINED
Kitware Robot's avatar
Kitware Robot committed
57 58
inline std::istream& operator>>(std::istream& is,
                                @KWSYS_NAMESPACE@::IOStreamSLL& value)
Kitware Robot's avatar
Kitware Robot committed
59 60 61
{
  return @KWSYS_NAMESPACE@::IOStreamScan(is, value);
}
Kitware Robot's avatar
Kitware Robot committed
62
#    endif
Kitware Robot's avatar
Kitware Robot committed
63 64

/* Provide input stream operator for unsigned long long.  */
Kitware Robot's avatar
Kitware Robot committed
65 66 67 68
#    if !defined(@KWSYS_NAMESPACE@_IOS_NO_ISTREAM_UNSIGNED_LONG_LONG) &&      \
      !defined(KWSYS_IOS_ISTREAM_UNSIGNED_LONG_LONG_DEFINED)
#      define KWSYS_IOS_ISTREAM_UNSIGNED_LONG_LONG_DEFINED
#      define @KWSYS_NAMESPACE@_IOS_ISTREAM_UNSIGNED_LONG_LONG_DEFINED
Kitware Robot's avatar
Kitware Robot committed
69 70
inline std::istream& operator>>(std::istream& is,
                                @KWSYS_NAMESPACE@::IOStreamULL& value)
Kitware Robot's avatar
Kitware Robot committed
71 72 73
{
  return @KWSYS_NAMESPACE@::IOStreamScan(is, value);
}
Kitware Robot's avatar
Kitware Robot committed
74 75
#    endif
#  endif /* !@KWSYS_NAMESPACE@_IOS_HAS_ISTREAM_LONG_LONG */
Kitware Robot's avatar
Kitware Robot committed
76

Kitware Robot's avatar
Kitware Robot committed
77
#  if !@KWSYS_NAMESPACE@_IOS_HAS_OSTREAM_LONG_LONG
Kitware Robot's avatar
Kitware Robot committed
78 79

/* Output stream operator implementation functions.  */
Kitware Robot's avatar
Kitware Robot committed
80
namespace @KWSYS_NAMESPACE@ {
Kitware Robot's avatar
Kitware Robot committed
81 82
kwsysEXPORT std::ostream& IOStreamPrint(std::ostream&, IOStreamSLL);
kwsysEXPORT std::ostream& IOStreamPrint(std::ostream&, IOStreamULL);
Kitware Robot's avatar
Kitware Robot committed
83 84 85
}

/* Provide output stream operator for long long.  */
Kitware Robot's avatar
Kitware Robot committed
86 87 88 89
#    if !defined(@KWSYS_NAMESPACE@_IOS_NO_OSTREAM_LONG_LONG) &&               \
      !defined(KWSYS_IOS_OSTREAM_LONG_LONG_DEFINED)
#      define KWSYS_IOS_OSTREAM_LONG_LONG_DEFINED
#      define @KWSYS_NAMESPACE@_IOS_OSTREAM_LONG_LONG_DEFINED
Kitware Robot's avatar
Kitware Robot committed
90 91
inline std::ostream& operator<<(std::ostream& os,
                                @KWSYS_NAMESPACE@::IOStreamSLL value)
Kitware Robot's avatar
Kitware Robot committed
92 93 94
{
  return @KWSYS_NAMESPACE@::IOStreamPrint(os, value);
}
Kitware Robot's avatar
Kitware Robot committed
95
#    endif
Kitware Robot's avatar
Kitware Robot committed
96 97

/* Provide output stream operator for unsigned long long.  */
Kitware Robot's avatar
Kitware Robot committed
98 99 100 101
#    if !defined(@KWSYS_NAMESPACE@_IOS_NO_OSTREAM_UNSIGNED_LONG_LONG) &&      \
      !defined(KWSYS_IOS_OSTREAM_UNSIGNED_LONG_LONG_DEFINED)
#      define KWSYS_IOS_OSTREAM_UNSIGNED_LONG_LONG_DEFINED
#      define @KWSYS_NAMESPACE@_IOS_OSTREAM_UNSIGNED_LONG_LONG_DEFINED
Kitware Robot's avatar
Kitware Robot committed
102 103
inline std::ostream& operator<<(std::ostream& os,
                                @KWSYS_NAMESPACE@::IOStreamULL value)
Kitware Robot's avatar
Kitware Robot committed
104 105 106
{
  return @KWSYS_NAMESPACE@::IOStreamPrint(os, value);
}
Kitware Robot's avatar
Kitware Robot committed
107 108 109
#    endif
#  endif /* !@KWSYS_NAMESPACE@_IOS_HAS_OSTREAM_LONG_LONG */
#endif   /* @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL */
Kitware Robot's avatar
Kitware Robot committed
110 111

/* Undefine temporary macros.  */
Kitware Robot's avatar
Kitware Robot committed
112
#if !defined(KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
Kitware Robot's avatar
Kitware Robot committed
113
#  undef kwsysEXPORT
Kitware Robot's avatar
Kitware Robot committed
114 115 116 117 118
#endif

/* If building a C++ file in kwsys itself, give the source file
   access to the macros without a configured namespace.  */
#if defined(KWSYS_NAMESPACE)
Kitware Robot's avatar
Kitware Robot committed
119 120 121 122 123
#  define KWSYS_IOS_HAS_ISTREAM_LONG_LONG                                     \
    @KWSYS_NAMESPACE@_IOS_HAS_ISTREAM_LONG_LONG
#  define KWSYS_IOS_HAS_OSTREAM_LONG_LONG                                     \
    @KWSYS_NAMESPACE@_IOS_HAS_OSTREAM_LONG_LONG
#  define KWSYS_IOS_NEED_OPERATORS_LL @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL
Kitware Robot's avatar
Kitware Robot committed
124 125 126
#endif

#endif