summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/IOStream.hxx.in
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2006-08-27 17:17:23 (GMT)
committerBrad King <brad.king@kitware.com>2006-08-27 17:17:23 (GMT)
commitc500078dccbc0a82e33eaac1ca1b55ede1332860 (patch)
treee19ac1300dc5f35cc4a8827af159c8da9fba7f27 /Source/kwsys/IOStream.hxx.in
parent2b602ea738f4ed99b67085f3f035f8eb2f43de88 (diff)
downloadCMake-c500078dccbc0a82e33eaac1ca1b55ede1332860.zip
CMake-c500078dccbc0a82e33eaac1ca1b55ede1332860.tar.gz
CMake-c500078dccbc0a82e33eaac1ca1b55ede1332860.tar.bz2
ENH: Adding KWSys component IOStream to provide help with broken C++ stream libraries.
Diffstat (limited to 'Source/kwsys/IOStream.hxx.in')
-rw-r--r--Source/kwsys/IOStream.hxx.in148
1 files changed, 148 insertions, 0 deletions
diff --git a/Source/kwsys/IOStream.hxx.in b/Source/kwsys/IOStream.hxx.in
new file mode 100644
index 0000000..5b08689
--- /dev/null
+++ b/Source/kwsys/IOStream.hxx.in
@@ -0,0 +1,148 @@
+/*=========================================================================
+
+ Program: KWSys - Kitware System Library
+ Module: $RCSfile$
+
+ Copyright (c) Kitware, Inc., Insight Consortium. All rights reserved.
+ See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#ifndef @KWSYS_NAMESPACE@_IOStream_hxx
+#define @KWSYS_NAMESPACE@_IOStream_hxx
+
+#include <@KWSYS_NAMESPACE@/ios/iosfwd>
+
+/* Define these macros temporarily to keep the code readable. */
+#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
+# define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT
+# define kwsys_ios @KWSYS_NAMESPACE@_ios
+#endif
+
+/* Whether istream supports long long. */
+#define @KWSYS_NAMESPACE@_IOS_HAS_ISTREAM_LONG_LONG @KWSYS_IOS_HAS_ISTREAM_LONG_LONG@
+
+/* Whether ostream supports long long. */
+#define @KWSYS_NAMESPACE@_IOS_HAS_OSTREAM_LONG_LONG @KWSYS_IOS_HAS_OSTREAM_LONG_LONG@
+
+/* Size of type long long and 0 if not available. */
+#define @KWSYS_NAMESPACE@_IOS_SIZEOF_LONG_LONG @KWSYS_SIZEOF_LONG_LONG@
+
+/* Determine whether we need to define the streaming operators for
+ long long or __int64. */
+#if @KWSYS_NAMESPACE@_IOS_SIZEOF_LONG_LONG
+# if !@KWSYS_NAMESPACE@_IOS_HAS_ISTREAM_LONG_LONG || \
+ !@KWSYS_NAMESPACE@_IOS_HAS_OSTREAM_LONG_LONG
+# define @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL 1
+ namespace @KWSYS_NAMESPACE@
+ {
+ typedef long long IOStreamSLL;
+ typedef unsigned long long IOStreamULL;
+ }
+# endif
+#elif defined(_MSC_VER) && _MSC_VER < 1300
+# define @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL 1
+ namespace @KWSYS_NAMESPACE@
+ {
+ typedef __int64 IOStreamSLL;
+ typedef unsigned __int64 IOStreamULL;
+ }
+#endif
+#if !defined(@KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL)
+# define @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL 0
+#endif
+
+#if @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL
+# if !@KWSYS_NAMESPACE@_IOS_HAS_ISTREAM_LONG_LONG
+
+/* Input stream operator implementation functions. */
+namespace @KWSYS_NAMESPACE@
+{
+kwsysEXPORT kwsys_ios::istream& IOStreamScan(kwsys_ios::istream&,
+ IOStreamSLL&);
+kwsysEXPORT kwsys_ios::istream& IOStreamScan(kwsys_ios::istream&,
+ IOStreamULL&);
+}
+
+/* Provide input stream operator for long long. */
+# 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
+inline kwsys_ios::istream&
+operator>>(kwsys_ios::istream& is, @KWSYS_NAMESPACE@::IOStreamSLL& value)
+{
+ return @KWSYS_NAMESPACE@::IOStreamScan(is, value);
+}
+# endif
+
+/* Provide input stream operator for unsigned long long. */
+# 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
+inline kwsys_ios::istream&
+operator>>(kwsys_ios::istream& is, @KWSYS_NAMESPACE@::IOStreamULL& value)
+{
+ return @KWSYS_NAMESPACE@::IOStreamScan(is, value);
+}
+# endif
+# endif /* !@KWSYS_NAMESPACE@_IOS_HAS_ISTREAM_LONG_LONG */
+
+# if !@KWSYS_NAMESPACE@_IOS_HAS_OSTREAM_LONG_LONG
+
+/* Output stream operator implementation functions. */
+namespace @KWSYS_NAMESPACE@
+{
+kwsysEXPORT kwsys_ios::ostream& IOStreamPrint(kwsys_ios::ostream&,
+ IOStreamSLL);
+kwsysEXPORT kwsys_ios::ostream& IOStreamPrint(kwsys_ios::ostream&,
+ IOStreamULL);
+}
+
+/* Provide output stream operator for long long. */
+# 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
+inline kwsys_ios::ostream&
+operator<<(kwsys_ios::ostream& os, @KWSYS_NAMESPACE@::IOStreamSLL value)
+{
+ return @KWSYS_NAMESPACE@::IOStreamPrint(os, value);
+}
+# endif
+
+/* Provide output stream operator for unsigned long long. */
+# 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
+inline kwsys_ios::ostream&
+operator<<(kwsys_ios::ostream& os, @KWSYS_NAMESPACE@::IOStreamULL value)
+{
+ return @KWSYS_NAMESPACE@::IOStreamPrint(os, value);
+}
+# endif
+# endif /* !@KWSYS_NAMESPACE@_IOS_HAS_OSTREAM_LONG_LONG */
+#endif /* @KWSYS_NAMESPACE@_IOS_NEED_OPERATORS_LL */
+
+/* Undefine temporary macros. */
+#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
+# undef kwsysEXPORT
+# undef kwsys_ios
+#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)
+# define KWSYS_IOS_SIZEOF_LONG_LONG @KWSYS_NAMESPACE@_IOS_SIZEOF_LONG_LONG
+# 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
+#endif
+
+#endif
+