diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/kwsys/CMakeLists.txt | 10 | ||||
-rw-r--r-- | Source/kwsys/Configure.hxx.in | 16 | ||||
-rw-r--r-- | Source/kwsys/SystemTools.cxx | 4 | ||||
-rw-r--r-- | Source/kwsys/SystemTools.hxx.in | 7 | ||||
-rw-r--r-- | Source/kwsys/kwsys_std.h.in | 16 | ||||
-rw-r--r-- | Source/kwsys/kwsys_std_fstream.h.in | 51 | ||||
-rw-r--r-- | Source/kwsys/kwsys_std_iosfwd.h.in | 49 | ||||
-rw-r--r-- | Source/kwsys/kwsys_std_iostream.h.in | 52 | ||||
-rw-r--r-- | Source/kwsys/kwsys_std_sstream.h.in | 125 |
9 files changed, 324 insertions, 6 deletions
diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index cdd7353..daa2d2c 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -69,6 +69,16 @@ FOREACH(header algorithm deque iterator list map numeric queue set stack string ENDIF(KWSYS_INCLUDE_INSTALL_DIR) ENDFOREACH(header) +FOREACH(header iostream fstream sstream iosfwd) + CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/kwsys_std_${header}.h.in + ${PROJECT_BINARY_DIR}/../${KWSYS_NAMESPACE}/std/${header} + @ONLY IMMEDIATE) + IF(KWSYS_INCLUDE_INSTALL_DIR) + INSTALL_FILES(${KWSYS_INCLUDE_INSTALL_DIR}/${KWSYS_NAMESPACE} + FILES ${PROJECT_BINARY_DIR}/../${KWSYS_NAMESPACE}/std/${header}) + ENDIF(KWSYS_INCLUDE_INSTALL_DIR) +ENDFOREACH(header) + IF(KWSYS_DEFAULTS) INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}/..) ADD_EXECUTABLE(test1 test1.cxx) diff --git a/Source/kwsys/Configure.hxx.in b/Source/kwsys/Configure.hxx.in index 68c8024..1c548ba 100644 --- a/Source/kwsys/Configure.hxx.in +++ b/Source/kwsys/Configure.hxx.in @@ -1,3 +1,19 @@ +/*========================================================================= + + Program: KWSys - Kitware System Library + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See http://www.cmake.org/HTML/Copyright.html 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@_Configure_hxx #define @KWSYS_NAMESPACE@_Configure_hxx diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 7c31ec3..50215ee 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -21,8 +21,8 @@ #include <SystemTools.hxx> #include <RegularExpression.hxx> #include <Directory.hxx> - -#include <fstream> +#include <std/iostream> +#include <std/fstream> #include <stdio.h> #include <sys/stat.h> diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in index 7c7d302..cceb278 100644 --- a/Source/kwsys/SystemTools.hxx.in +++ b/Source/kwsys/SystemTools.hxx.in @@ -17,10 +17,9 @@ #ifndef @KWSYS_NAMESPACE@_SystemTools_hxx #define @KWSYS_NAMESPACE@_SystemTools_hxx -#include <@KWSYS_NAMESPACE@/StandardIncludes.hxx> - -#include <string> -#include <vector> +#include <@KWSYS_NAMESPACE@/std/iosfwd> +#include <@KWSYS_NAMESPACE@/std/string> +#include <@KWSYS_NAMESPACE@/std/vector> namespace @KWSYS_NAMESPACE@ { diff --git a/Source/kwsys/kwsys_std.h.in b/Source/kwsys/kwsys_std.h.in index efb504a..8cf71d0 100644 --- a/Source/kwsys/kwsys_std.h.in +++ b/Source/kwsys/kwsys_std.h.in @@ -1,3 +1,19 @@ +/*========================================================================= + + Program: KWSys - Kitware System Library + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See http://www.cmake.org/HTML/Copyright.html 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@_std_@KWSYS_STL_HEADER@ #define @KWSYS_NAMESPACE@_std_@KWSYS_STL_HEADER@ diff --git a/Source/kwsys/kwsys_std_fstream.h.in b/Source/kwsys/kwsys_std_fstream.h.in new file mode 100644 index 0000000..057247b --- /dev/null +++ b/Source/kwsys/kwsys_std_fstream.h.in @@ -0,0 +1,51 @@ +/*========================================================================= + + Program: KWSys - Kitware System Library + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See http://www.cmake.org/HTML/Copyright.html 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@_std_fstream +#define @KWSYS_NAMESPACE@_std_fstream + +#include <@KWSYS_NAMESPACE@/Configure.hxx> + +#ifdef _MSC_VER +#pragma warning (push, 1) +#pragma warning (disable: 4702) +#endif + +#if !defined(KWSYS_NO_ANSI_STREAM_HEADERS) +# include <fstream> +#else +# include <fstream.h> +# if !defined(KWSYS_NO_STD_NAMESPACE) + +namespace std +{ + using ::ostream; + using ::istream; + using ::ofstream; + using ::ifstream; + using ::ios; + using ::endl; + using ::flush; +} + +# endif +#endif + +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#endif diff --git a/Source/kwsys/kwsys_std_iosfwd.h.in b/Source/kwsys/kwsys_std_iosfwd.h.in new file mode 100644 index 0000000..52a85d0 --- /dev/null +++ b/Source/kwsys/kwsys_std_iosfwd.h.in @@ -0,0 +1,49 @@ +/*========================================================================= + + Program: KWSys - Kitware System Library + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See http://www.cmake.org/HTML/Copyright.html 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@_std_iosfwd +#define @KWSYS_NAMESPACE@_std_iosfwd + +#include <@KWSYS_NAMESPACE@/Configure.hxx> + +#ifdef _MSC_VER +#pragma warning (push, 1) +#pragma warning (disable: 4702) +#endif + +#if !defined(KWSYS_NO_ANSI_STREAM_HEADERS) +# include <iosfwd> +#else +# if !defined(KWSYS_NO_STD_NAMESPACE) +namespace std +{ +# endif + class fstream; + class ifstream; + class ios; + class istream; + class ofstream; + class ostream; +# if !defined(KWSYS_NO_STD_NAMESPACE) +} +# endif +#endif + +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#endif diff --git a/Source/kwsys/kwsys_std_iostream.h.in b/Source/kwsys/kwsys_std_iostream.h.in new file mode 100644 index 0000000..57b3e7f --- /dev/null +++ b/Source/kwsys/kwsys_std_iostream.h.in @@ -0,0 +1,52 @@ +/*========================================================================= + + Program: KWSys - Kitware System Library + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See http://www.cmake.org/HTML/Copyright.html 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@_std_iostream +#define @KWSYS_NAMESPACE@_std_iostream + +#include <@KWSYS_NAMESPACE@/Configure.hxx> + +#ifdef _MSC_VER +#pragma warning (push, 1) +#pragma warning (disable: 4702) +#endif + +#if !defined(KWSYS_NO_ANSI_STREAM_HEADERS) +# include <iostream> +#else +# include <iostream.h> +# if !defined(KWSYS_NO_STD_NAMESPACE) + +namespace std +{ + using ::ostream; + using ::istream; + using ::ios; + using ::cout; + using ::cerr; + using ::cin; + using ::endl; + using ::flush; +} + +# endif +#endif + +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +#endif diff --git a/Source/kwsys/kwsys_std_sstream.h.in b/Source/kwsys/kwsys_std_sstream.h.in new file mode 100644 index 0000000..3bd32af --- /dev/null +++ b/Source/kwsys/kwsys_std_sstream.h.in @@ -0,0 +1,125 @@ +/*========================================================================= + + Program: KWSys - Kitware System Library + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See http://www.cmake.org/HTML/Copyright.html 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@_std_sstream +#define @KWSYS_NAMESPACE@_std_sstream + +#include <@KWSYS_NAMESPACE@/Configure.hxx> + +#if !defined(KWSYS_NO_ANSI_STRING_STREAM) +# ifdef _MSC_VER +# pragma warning (push, 1) +# pragma warning (disable: 4702) +# endif +# include <sstream> +# ifdef _MSC_VER +# pragma warning(pop) +# endif +#else +# ifdef _MSC_VER +# pragma warning (push, 1) +# pragma warning (disable: 4702) +# endif +# if !defined(KWSYS_NO_ANSI_STREAM_HEADERS) +# include <strstream> +# else +# include <strstream.h> +# if !defined(KWSYS_NO_STD_NAMESPACE) + +namespace std +{ + using ::ostream; + using ::istream; + using ::istrstream; + using ::ostrstream; + using ::ios; + using ::endl; + using ::ends; + using ::flush; +} + +# endif +# endif +# ifdef _MSC_VER +# pragma warning(pop) +# endif + +// Only have old std::strstream classes. Wrap them to look like new +// ostringstream and istringstream classes. + +# include <@KWSYS_NAMESPACE@/std/string> + +# if !defined(KWSYS_NO_STD_NAMESPACE) +namespace std +{ +# endif + +class ostringstream_cleanup +{ +public: + ostringstream_cleanup(kwsys_std::ostrstream& ostr): m_OStrStream(ostr) {} + ~ostringstream_cleanup() { m_OStrStream.rdbuf()->freeze(0); } + static void IgnoreUnusedVariable(const ostringstream_cleanup&) {} +protected: + kwsys_std::ostrstream& m_OStrStream; +}; + +class ostringstream: public kwsys_std::ostrstream +{ +public: + typedef kwsys_std::ostrstream Superclass; + ostringstream() {} + kwsys_std::string str() + { + ostringstream_cleanup cleanup(*this); + ostringstream_cleanup::IgnoreUnusedVariable(cleanup); + int pcount = this->pcount(); + const char* ptr = this->Superclass::str(); + return kwsys_std::string(ptr?ptr:"", pcount); + } +private: + ostringstream(const ostringstream&); + void operator=(const ostringstream&); +}; + +class istringstream: private kwsys_std::string, public kwsys_std::istrstream +{ +public: + typedef kwsys_std::string StdString; + typedef kwsys_std::istrstream IStrStream; + istringstream(): StdString(), IStrStream(StdString::c_str()) {} + istringstream(const kwsys_std::string& s): + StdString(s), IStrStream(StdString::c_str()) {} + kwsys_std::string str() const { return *this; } + void str(const kwsys_std::string& s) + { + // Very dangerous. If this throws, the object is hosed. When the + // destructor is later called, the program is hosed too. + this->~istringstream(); + new (this) istringstream(s); + } +private: + istringstream(const istringstream&); + void operator=(const istringstream&); +}; + +# if !defined(KWSYS_NO_STD_NAMESPACE) +} +# endif + +#endif + +#endif |