ENH: Merging changes from KWSys-IOS-bp to KWSys-IOS-b2t-1-mp to main tree. This introduces separate kwsys_ios and kwsys_stl macros needed to support all platforms.

This commit is contained in:
Brad King 2003-12-23 11:03:33 -05:00
parent 0bdb092a01
commit 032d1d8652
21 changed files with 705 additions and 608 deletions

View File

@ -47,13 +47,13 @@
# SET(KWSYS_LIBRARY_INSTALL_DIR /lib) # SET(KWSYS_LIBRARY_INSTALL_DIR /lib)
# SET(KWSYS_HEADER_INSTALL_DIR /include) # SET(KWSYS_HEADER_INSTALL_DIR /include)
# #
# KWSYS_FORCE_OLD_STREAMS = Force use of old non-ANSI C++ streams even if # KWSYS_IOS_FORCE_OLD = Force use of old non-ANSI C++ streams even if
# new streams are available. This may be used # new streams are available. This may be used
# by projects that cannot configure their # by projects that cannot configure their
# streams library. # streams library.
# Example: # Example:
# #
# SET(KWSYS_FORCE_OLD_STREAMS 1) # SET(KWSYS_IOS_FORCE_OLD 1)
# #
# Once configured, kwsys should be used as follows from C or C++ code: # Once configured, kwsys should be used as follows from C or C++ code:
@ -109,36 +109,43 @@ ENDIF(CMAKE_ANSI_CFLAGS)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Configure the standard library header wrappers based on compiler's # Configure the standard library header wrappers based on compiler's
# capabilities and parent project's request. # capabilities and parent project's request. Enforce 0/1 as only
INCLUDE(${CMAKE_ROOT}/Modules/CheckIncludeFileCXX.cmake) # possible values for configuration into Configure.hxx.
INCLUDE(${CMAKE_ROOT}/Modules/TestForSTDNamespace.cmake) INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/kwsysPlatformCxxTests.cmake)
CHECK_INCLUDE_FILE_CXX("sstream" CMAKE_HAS_ANSI_STRING_STREAM)
CHECK_INCLUDE_FILE_CXX("iosfwd" CMAKE_ANSI_IOSFWD_HEADER)
# Enforce 0/1 as only possible values. Needed for the means by which KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAVE_STD
# Configure.hxx is implemented. "Checking whether STL classes are in std namespace" DIRECT)
IF(CMAKE_NO_STD_NAMESPACE)
SET(CMAKE_NO_STD_NAMESPACE 1)
ELSE(CMAKE_NO_STD_NAMESPACE)
SET(CMAKE_NO_STD_NAMESPACE 0)
ENDIF(CMAKE_NO_STD_NAMESPACE)
IF(CMAKE_ANSI_IOSFWD_HEADER) IF(KWSYS_IOS_FORCE_OLD)
SET(CMAKE_NO_ANSI_STREAM_HEADERS 0) SET(KWSYS_IOS_HAVE_ANSI 0)
ELSE(CMAKE_ANSI_IOSFWD_HEADER) ELSE(KWSYS_IOS_FORCE_OLD)
SET(CMAKE_NO_ANSI_STREAM_HEADERS 1) KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAVE_ANSI
ENDIF(CMAKE_ANSI_IOSFWD_HEADER) "Checking whether ANSI stream headers are available" DIRECT)
ENDIF(KWSYS_IOS_FORCE_OLD)
IF(CMAKE_HAS_ANSI_STRING_STREAM) IF(KWSYS_IOS_HAVE_ANSI)
SET(CMAKE_NO_ANSI_STRING_STREAM 0) KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAVE_STD
ELSE(CMAKE_HAS_ANSI_STRING_STREAM) "Checking whether ANSI streams are in std namespace" DIRECT)
SET(CMAKE_NO_ANSI_STRING_STREAM 1) KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAVE_SSTREAM
ENDIF(CMAKE_HAS_ANSI_STRING_STREAM) "Checking whether ANSI string stream is available" DIRECT)
ELSE(KWSYS_IOS_HAVE_ANSI)
SET(KWSYS_IOS_HAVE_STD 0)
SET(KWSYS_IOS_HAVE_SSTREAM 0)
ENDIF(KWSYS_IOS_HAVE_ANSI)
IF(KWSYS_FORCE_OLD_STREAMS) IF(KWSYS_IOS_HAVE_SSTREAM)
SET(CMAKE_NO_ANSI_STREAM_HEADERS 1) SET(KWSYS_IOS_HAVE_STRSTREAM_H 0)
SET(CMAKE_NO_ANSI_STRING_STREAM 1) SET(KWSYS_IOS_HAVE_STRSTREA_H 0)
ENDIF(KWSYS_FORCE_OLD_STREAMS) ELSE(KWSYS_IOS_HAVE_SSTREAM)
KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAVE_STRSTREAM_H
"Checking whether strstream.h is available" DIRECT)
IF(KWSYS_IOS_HAVE_STRSTREAM_H)
SET(KWSYS_IOS_HAVE_STRSTREA_H 0)
ELSE(KWSYS_IOS_HAVE_STRSTREAM_H)
KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAVE_STRSTREA_H
"Checking whether strstrea.h is available" DIRECT)
ENDIF(KWSYS_IOS_HAVE_STRSTREAM_H)
ENDIF(KWSYS_IOS_HAVE_SSTREAM)
IF(KWSYS_NAMESPACE MATCHES "^kwsys$") IF(KWSYS_NAMESPACE MATCHES "^kwsys$")
SET(KWSYS_NAME_IS_KWSYS 1) SET(KWSYS_NAME_IS_KWSYS 1)
@ -146,12 +153,6 @@ ELSE(KWSYS_NAMESPACE MATCHES "^kwsys$")
SET(KWSYS_NAME_IS_KWSYS 0) SET(KWSYS_NAME_IS_KWSYS 0)
ENDIF(KWSYS_NAMESPACE MATCHES "^kwsys$") ENDIF(KWSYS_NAMESPACE MATCHES "^kwsys$")
# Set names that are used in creating Configure.hxx for these test
# results.
SET(KWSYS_NO_STD_NAMESPACE ${CMAKE_NO_STD_NAMESPACE})
SET(KWSYS_NO_ANSI_STREAM_HEADERS ${CMAKE_NO_ANSI_STREAM_HEADERS})
SET(KWSYS_NO_ANSI_STRING_STREAM ${CMAKE_NO_ANSI_STRING_STREAM})
# Choose default shared/static build if not specified. # Choose default shared/static build if not specified.
IF(KWSYS_BUILD_SHARED MATCHES "^KWSYS_BUILD_SHARED$") IF(KWSYS_BUILD_SHARED MATCHES "^KWSYS_BUILD_SHARED$")
SET(KWSYS_BUILD_SHARED ${BUILD_SHARED_LIBS}) SET(KWSYS_BUILD_SHARED ${BUILD_SHARED_LIBS})
@ -179,14 +180,14 @@ FOREACH(header algorithm deque iterator list map numeric queue set stack string
utility vector) utility vector)
# Configure the header wrapper. # Configure the header wrapper.
SET(KWSYS_STL_HEADER "${header}") SET(KWSYS_STL_HEADER "${header}")
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/kwsys_std.h.in CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/kwsys_stl.h.in
${KWSYS_HEADER_DIR}/std/${header} ${KWSYS_HEADER_DIR}/stl/${header}
@ONLY IMMEDIATE) @ONLY IMMEDIATE)
# Create an install target for the header wrapper. # Create an install target for the header wrapper.
IF(KWSYS_HEADER_INSTALL_DIR) IF(KWSYS_HEADER_INSTALL_DIR)
INSTALL_FILES(${KWSYS_HEADER_INSTALL_DIR}/${KWSYS_NAMESPACE}/std INSTALL_FILES(${KWSYS_HEADER_INSTALL_DIR}/${KWSYS_NAMESPACE}/stl
FILES ${KWSYS_HEADER_DIR}/std/${header}) FILES ${KWSYS_HEADER_DIR}/stl/${header})
ENDIF(KWSYS_HEADER_INSTALL_DIR) ENDIF(KWSYS_HEADER_INSTALL_DIR)
ENDFOREACH(header) ENDFOREACH(header)
@ -195,14 +196,14 @@ ENDFOREACH(header)
# may be included. # may be included.
FOREACH(header iostream fstream sstream iosfwd) FOREACH(header iostream fstream sstream iosfwd)
# Configure the header wrapper. # Configure the header wrapper.
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/kwsys_std_${header}.h.in CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/kwsys_ios_${header}.h.in
${KWSYS_HEADER_DIR}/std/${header} ${KWSYS_HEADER_DIR}/ios/${header}
@ONLY IMMEDIATE) @ONLY IMMEDIATE)
# Create an install target for the header wrapper. # Create an install target for the header wrapper.
IF(KWSYS_HEADER_INSTALL_DIR) IF(KWSYS_HEADER_INSTALL_DIR)
INSTALL_FILES(${KWSYS_HEADER_INSTALL_DIR}/${KWSYS_NAMESPACE}/std INSTALL_FILES(${KWSYS_HEADER_INSTALL_DIR}/${KWSYS_NAMESPACE}/ios
FILES ${KWSYS_HEADER_DIR}/std/${header}) FILES ${KWSYS_HEADER_DIR}/ios/${header})
ENDIF(KWSYS_HEADER_INSTALL_DIR) ENDIF(KWSYS_HEADER_INSTALL_DIR)
ENDFOREACH(header) ENDFOREACH(header)
@ -366,8 +367,10 @@ ENDIF(KWSYS_USE_Process)
# Setup testing if not being built as part of another project. # Setup testing if not being built as part of another project.
IF(KWSYS_STANDALONE) IF(KWSYS_STANDALONE)
INCLUDE_DIRECTORIES(${KWSYS_HEADER_ROOT}) INCLUDE_DIRECTORIES(${KWSYS_HEADER_ROOT})
ADD_EXECUTABLE(testIOS testIOS.cxx)
ADD_EXECUTABLE(testProcess testProcess.c) ADD_EXECUTABLE(testProcess testProcess.c)
ADD_EXECUTABLE(test1 test1.cxx) ADD_EXECUTABLE(test1 test1.cxx)
TARGET_LINK_LIBRARIES(testIOS ${KWSYS_NAMESPACE})
TARGET_LINK_LIBRARIES(testProcess ${KWSYS_NAMESPACE}) TARGET_LINK_LIBRARIES(testProcess ${KWSYS_NAMESPACE})
TARGET_LINK_LIBRARIES(test1 ${KWSYS_NAMESPACE}) TARGET_LINK_LIBRARIES(test1 ${KWSYS_NAMESPACE})
ENDIF(KWSYS_STANDALONE) ENDIF(KWSYS_STANDALONE)

View File

@ -14,53 +14,60 @@
#ifndef @KWSYS_NAMESPACE@_Configure_hxx #ifndef @KWSYS_NAMESPACE@_Configure_hxx
#define @KWSYS_NAMESPACE@_Configure_hxx #define @KWSYS_NAMESPACE@_Configure_hxx
/* Defined if kwsys namespace is "kwsys". */ /* Whether kwsys namespace is "kwsys". */
#if @KWSYS_NAME_IS_KWSYS@ #define @KWSYS_NAMESPACE@_NAME_IS_KWSYS @KWSYS_NAME_IS_KWSYS@
# define @KWSYS_NAMESPACE@_NAME_IS_KWSYS
#endif
/* Defined if no ANSI C++ stream headers are present. */ /* Whether ANSI C++ stream headers are to be used. */
#if @KWSYS_NO_ANSI_STREAM_HEADERS@ #define @KWSYS_NAMESPACE@_IOS_HAVE_ANSI @KWSYS_IOS_HAVE_ANSI@
# define @KWSYS_NAMESPACE@_NO_ANSI_STREAM_HEADERS
#endif
/* Defined if no ANSI C++ <sstream> header is present. */ /* Whether ANSI C++ streams are in std namespace. */
#if @KWSYS_NO_ANSI_STRING_STREAM@ #define @KWSYS_NAMESPACE@_IOS_HAVE_STD @KWSYS_IOS_HAVE_STD@
# define @KWSYS_NAMESPACE@_NO_ANSI_STRING_STREAM
#endif
/* Defined if no std namespace is present. */ /* Whether ANSI C++ <sstream> header is to be used. */
#if @KWSYS_NO_STD_NAMESPACE@ #define @KWSYS_NAMESPACE@_IOS_HAVE_SSTREAM @KWSYS_IOS_HAVE_SSTREAM@
# define @KWSYS_NAMESPACE@_NO_STD_NAMESPACE
#endif
/* Defined if std namespace is the GCC hack. */ /* Whether old C++ <strstream.h> header is to be used. */
#if defined(__GNUC__) && (__GNUC__ < 3) #define @KWSYS_NAMESPACE@_IOS_HAVE_STRSTREAM_H @KWSYS_IOS_HAVE_STRSTREAM_H@
# define @KWSYS_NAMESPACE@_FAKE_STD_NAMESPACE
#endif
/* Define the std namespace macro. */ /* Whether old C++ <strstrea.h> header is to be used. */
#if defined(@KWSYS_NAMESPACE@_NO_STD_NAMESPACE) #define @KWSYS_NAMESPACE@_IOS_HAVE_STRSTREA_H @KWSYS_IOS_HAVE_STRSTREA_H@
# define @KWSYS_NAMESPACE@_std
/* Whether STL is in std namespace. */
#define @KWSYS_NAMESPACE@_STL_HAVE_STD @KWSYS_STL_HAVE_STD@
/* Define the stl namespace macro. */
#if @KWSYS_NAMESPACE@_STL_HAVE_STD
# define @KWSYS_NAMESPACE@_stl std
#else #else
# define @KWSYS_NAMESPACE@_std std # define @KWSYS_NAMESPACE@_stl
#endif
/* Define the ios namespace macro. */
#if @KWSYS_NAMESPACE@_IOS_HAVE_STD
# define @KWSYS_NAMESPACE@_ios_namespace std
#else
# define @KWSYS_NAMESPACE@_ios_namespace
#endif
#if @KWSYS_NAMESPACE@_IOS_HAVE_SSTREAM
# define @KWSYS_NAMESPACE@_ios @KWSYS_NAMESPACE@_ios_namespace
#else
# define @KWSYS_NAMESPACE@_ios @KWSYS_NAMESPACE@_ios
#endif #endif
/* If building a C++ file in kwsys itself, give the source file /* If building a C++ file in kwsys itself, give the source file
access to the macros without a configured namespace. */ access to the macros without a configured namespace. */
#if defined(KWSYS_NAMESPACE) #if defined(KWSYS_NAMESPACE)
# if !defined(@KWSYS_NAMESPACE@_NAME_IS_KWSYS) # if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
# define kwsys_std @KWSYS_NAMESPACE@_std # define kwsys_stl @KWSYS_NAMESPACE@_stl
# endif # define kwsys_ios @KWSYS_NAMESPACE@_ios
# if defined(@KWSYS_NAMESPACE@_NO_STD_NAMESPACE)
# define KWSYS_NO_STD_NAMESPACE
# endif
# if defined(@KWSYS_NAMESPACE@_NO_ANSI_STREAM_HEADERS)
# define KWSYS_NO_ANSI_STREAM_HEADERS
# endif
# if defined(@KWSYS_NAMESPACE@_NO_ANSI_STRING_STREAM)
# define KWSYS_NO_ANSI_STRING_STREAM
# endif # endif
# define KWSYS_NAME_IS_KWSYS @KWSYS_NAMESPACE@_NAME_IS_KWSYS
# define KWSYS_IOS_HAVE_ANSI @KWSYS_NAMESPACE@_IOS_HAVE_ANSI
# define KWSYS_IOS_HAVE_STD @KWSYS_NAMESPACE@_IOS_HAVE_STD
# define KWSYS_IOS_HAVE_SSTREAM @KWSYS_NAMESPACE@_IOS_HAVE_SSTREAM
# define KWSYS_IOS_HAVE_STRSTREAM_H @KWSYS_NAMESPACE@_IOS_HAVE_STRSTREAM_H
# define KWSYS_IOS_HAVE_STRSTREA_H @KWSYS_NAMESPACE@_IOS_HAVE_STRSTREA_H
# define KWSYS_STL_HAVE_STD @KWSYS_NAMESPACE@_STL_HAVE_STD
#endif #endif
#endif #endif

View File

@ -16,8 +16,8 @@
#include KWSYS_HEADER(Configure.hxx) #include KWSYS_HEADER(Configure.hxx)
#include KWSYS_HEADER(std/string) #include KWSYS_HEADER(stl/string)
#include KWSYS_HEADER(std/vector) #include KWSYS_HEADER(stl/vector)
namespace KWSYS_NAMESPACE namespace KWSYS_NAMESPACE
{ {
@ -27,10 +27,10 @@ class DirectoryInternals
{ {
public: public:
// Array of Files // Array of Files
kwsys_std::vector<kwsys_std::string> Files; kwsys_stl::vector<kwsys_stl::string> Files;
// Path to Open'ed directory // Path to Open'ed directory
kwsys_std::string Path; kwsys_stl::string Path;
}; };
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -840,7 +840,7 @@ void regdump ();
static char* regprop (); static char* regprop ();
#endif #endif
bool RegularExpression::find (kwsys_std::string const& s) bool RegularExpression::find (kwsys_stl::string const& s)
{ {
return find(s.c_str()); return find(s.c_str());
} }

View File

@ -35,11 +35,11 @@
#include <@KWSYS_NAMESPACE@/Configure.h> #include <@KWSYS_NAMESPACE@/Configure.h>
#include <@KWSYS_NAMESPACE@/Configure.hxx> #include <@KWSYS_NAMESPACE@/Configure.hxx>
#include <@KWSYS_NAMESPACE@/std/string> #include <@KWSYS_NAMESPACE@/stl/string>
/* Define this macro temporarily to keep the code readable. */ /* Define this macro temporarily to keep the code readable. */
#if !defined (KWSYS_NAMESPACE) && !defined(@KWSYS_NAMESPACE@_NAME_IS_KWSYS) #if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
# define kwsys_std @KWSYS_NAMESPACE@_std # define kwsys_stl @KWSYS_NAMESPACE@_stl
#endif #endif
namespace @KWSYS_NAMESPACE@ namespace @KWSYS_NAMESPACE@
@ -221,17 +221,17 @@ public:
* Matches the regular expression to the given std string. * Matches the regular expression to the given std string.
* Returns true if found, and sets start and end indexes accordingly. * Returns true if found, and sets start and end indexes accordingly.
*/ */
bool find (kwsys_std::string const&); bool find (kwsys_stl::string const&);
/** /**
* Index to start of first find. * Index to start of first find.
*/ */
inline kwsys_std::string::size_type start() const; inline kwsys_stl::string::size_type start() const;
/** /**
* Index to end of first find. * Index to end of first find.
*/ */
inline kwsys_std::string::size_type end() const; inline kwsys_stl::string::size_type end() const;
/** /**
* Returns true if two regular expressions have the same * Returns true if two regular expressions have the same
@ -265,9 +265,9 @@ public:
* Destructor. * Destructor.
*/ */
// awf added // awf added
kwsys_std::string::size_type start(int n) const; kwsys_stl::string::size_type start(int n) const;
kwsys_std::string::size_type end(int n) const; kwsys_stl::string::size_type end(int n) const;
kwsys_std::string match(int n) const; kwsys_stl::string match(int n) const;
enum { NSUBEXP = 10 }; enum { NSUBEXP = 10 };
private: private:
@ -316,7 +316,7 @@ inline RegularExpression::~RegularExpression ()
/** /**
* Set the start position for the regular expression. * Set the start position for the regular expression.
*/ */
inline kwsys_std::string::size_type RegularExpression::start () const inline kwsys_stl::string::size_type RegularExpression::start () const
{ {
return(this->startp[0] - searchstring); return(this->startp[0] - searchstring);
} }
@ -325,7 +325,7 @@ inline kwsys_std::string::size_type RegularExpression::start () const
/** /**
* Returns the start/end index of the last item found. * Returns the start/end index of the last item found.
*/ */
inline kwsys_std::string::size_type RegularExpression::end () const inline kwsys_stl::string::size_type RegularExpression::end () const
{ {
return(this->endp[0] - searchstring); return(this->endp[0] - searchstring);
} }
@ -360,7 +360,7 @@ inline void RegularExpression::set_invalid ()
/** /**
* Return start index of nth submatch. start(0) is the start of the full match. * Return start index of nth submatch. start(0) is the start of the full match.
*/ */
inline kwsys_std::string::size_type RegularExpression::start(int n) const inline kwsys_stl::string::size_type RegularExpression::start(int n) const
{ {
return this->startp[n] - searchstring; return this->startp[n] - searchstring;
} }
@ -369,7 +369,7 @@ inline kwsys_std::string::size_type RegularExpression::start(int n) const
/** /**
* Return end index of nth submatch. end(0) is the end of the full match. * Return end index of nth submatch. end(0) is the end of the full match.
*/ */
inline kwsys_std::string::size_type RegularExpression::end(int n) const inline kwsys_stl::string::size_type RegularExpression::end(int n) const
{ {
return this->endp[n] - searchstring; return this->endp[n] - searchstring;
} }
@ -377,16 +377,16 @@ inline kwsys_std::string::size_type RegularExpression::end(int n) const
/** /**
* Return nth submatch as a string. * Return nth submatch as a string.
*/ */
inline kwsys_std::string RegularExpression::match(int n) const inline kwsys_stl::string RegularExpression::match(int n) const
{ {
return kwsys_std::string(this->startp[n], this->endp[n] - this->startp[n]); return kwsys_stl::string(this->startp[n], this->endp[n] - this->startp[n]);
} }
} // namespace @KWSYS_NAMESPACE@ } // namespace @KWSYS_NAMESPACE@
/* Undefine temporary macro. */ /* Undefine temporary macro. */
#if !defined (KWSYS_NAMESPACE) && !defined(@KWSYS_NAMESPACE@_NAME_IS_KWSYS) #if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
# undef kwsys_std # undef kwsys_stl
#endif #endif
#endif #endif

View File

@ -15,8 +15,8 @@
#include KWSYS_HEADER(SystemTools.hxx) #include KWSYS_HEADER(SystemTools.hxx)
#include KWSYS_HEADER(Directory.hxx) #include KWSYS_HEADER(Directory.hxx)
#include KWSYS_HEADER(std/iostream) #include KWSYS_HEADER(ios/iostream)
#include KWSYS_HEADER(std/fstream) #include KWSYS_HEADER(ios/fstream)
#ifdef _MSC_VER #ifdef _MSC_VER
# pragma warning (disable: 4786) # pragma warning (disable: 4786)
@ -155,25 +155,25 @@ SystemTools::GetTime(void)
} }
// adds the elements of the env variable path to the arg passed in // adds the elements of the env variable path to the arg passed in
void SystemTools::GetPath(kwsys_std::vector<kwsys_std::string>& path) void SystemTools::GetPath(kwsys_stl::vector<kwsys_stl::string>& path)
{ {
#if defined(_WIN32) && !defined(__CYGWIN__) #if defined(_WIN32) && !defined(__CYGWIN__)
const char* pathSep = ";"; const char* pathSep = ";";
#else #else
const char* pathSep = ":"; const char* pathSep = ":";
#endif #endif
kwsys_std::string pathEnv = getenv("PATH"); kwsys_stl::string pathEnv = getenv("PATH");
// A hack to make the below algorithm work. // A hack to make the below algorithm work.
if(pathEnv[pathEnv.length()-1] != ':') if(pathEnv[pathEnv.length()-1] != ':')
{ {
pathEnv += pathSep; pathEnv += pathSep;
} }
kwsys_std::string::size_type start =0; kwsys_stl::string::size_type start =0;
bool done = false; bool done = false;
while(!done) while(!done)
{ {
kwsys_std::string::size_type endpos = pathEnv.find(pathSep, start); kwsys_stl::string::size_type endpos = pathEnv.find(pathSep, start);
if(endpos != kwsys_std::string::npos) if(endpos != kwsys_stl::string::npos)
{ {
path.push_back(pathEnv.substr(start, endpos-start)); path.push_back(pathEnv.substr(start, endpos-start));
start = endpos+1; start = endpos+1;
@ -183,7 +183,7 @@ void SystemTools::GetPath(kwsys_std::vector<kwsys_std::string>& path)
done = true; done = true;
} }
} }
for(kwsys_std::vector<kwsys_std::string>::iterator i = path.begin(); for(kwsys_stl::vector<kwsys_stl::string>::iterator i = path.begin();
i != path.end(); ++i) i != path.end(); ++i)
{ {
SystemTools::ConvertToUnixSlashes(*i); SystemTools::ConvertToUnixSlashes(*i);
@ -195,7 +195,7 @@ const char* SystemTools::GetEnv(const char* key)
return getenv(key); return getenv(key);
} }
bool SystemTools::GetEnv(const char* key, kwsys_std::string& result) bool SystemTools::GetEnv(const char* key, kwsys_stl::string& result)
{ {
const char* v = getenv(key); const char* v = getenv(key);
if(v) if(v)
@ -225,20 +225,20 @@ bool SystemTools::MakeDirectory(const char* path)
{ {
return true; return true;
} }
kwsys_std::string dir = path; kwsys_stl::string dir = path;
if(dir.size() == 0) if(dir.size() == 0)
{ {
return false; return false;
} }
SystemTools::ConvertToUnixSlashes(dir); SystemTools::ConvertToUnixSlashes(dir);
kwsys_std::string::size_type pos = dir.find(':'); kwsys_stl::string::size_type pos = dir.find(':');
if(pos == kwsys_std::string::npos) if(pos == kwsys_stl::string::npos)
{ {
pos = 0; pos = 0;
} }
kwsys_std::string topdir; kwsys_stl::string topdir;
while((pos = dir.find('/', pos)) != kwsys_std::string::npos) while((pos = dir.find('/', pos)) != kwsys_stl::string::npos)
{ {
topdir = dir.substr(0, pos); topdir = dir.substr(0, pos);
Mkdir(topdir.c_str()); Mkdir(topdir.c_str());
@ -273,7 +273,7 @@ bool SystemTools::MakeDirectory(const char* path)
// replace replace with with as many times as it shows up in source. // replace replace with with as many times as it shows up in source.
// write the result into source. // write the result into source.
void SystemTools::ReplaceString(kwsys_std::string& source, void SystemTools::ReplaceString(kwsys_stl::string& source,
const char* replace, const char* replace,
const char* with) const char* with)
{ {
@ -318,21 +318,21 @@ void SystemTools::ReplaceString(kwsys_std::string& source,
// => will return the data of the "Root" value of the key // => will return the data of the "Root" value of the key
#if defined(_WIN32) && !defined(__CYGWIN__) #if defined(_WIN32) && !defined(__CYGWIN__)
bool SystemTools::ReadRegistryValue(const char *key, kwsys_std::string &value) bool SystemTools::ReadRegistryValue(const char *key, kwsys_stl::string &value)
{ {
kwsys_std::string primary = key; kwsys_stl::string primary = key;
kwsys_std::string second; kwsys_stl::string second;
kwsys_std::string valuename; kwsys_stl::string valuename;
size_t start = primary.find("\\"); size_t start = primary.find("\\");
if (start == kwsys_std::string::npos) if (start == kwsys_stl::string::npos)
{ {
return false; return false;
} }
size_t valuenamepos = primary.find(";"); size_t valuenamepos = primary.find(";");
if (valuenamepos != kwsys_std::string::npos) if (valuenamepos != kwsys_stl::string::npos)
{ {
valuename = primary.substr(valuenamepos+1); valuename = primary.substr(valuenamepos+1);
} }
@ -393,7 +393,7 @@ bool SystemTools::ReadRegistryValue(const char *key, kwsys_std::string &value)
return false; return false;
} }
#else #else
bool SystemTools::ReadRegistryValue(const char *, kwsys_std::string &) bool SystemTools::ReadRegistryValue(const char *, kwsys_stl::string &)
{ {
return false; return false;
} }
@ -410,18 +410,18 @@ bool SystemTools::ReadRegistryValue(const char *, kwsys_std::string &)
#if defined(_WIN32) && !defined(__CYGWIN__) #if defined(_WIN32) && !defined(__CYGWIN__)
bool SystemTools::WriteRegistryValue(const char *key, const char *value) bool SystemTools::WriteRegistryValue(const char *key, const char *value)
{ {
kwsys_std::string primary = key; kwsys_stl::string primary = key;
kwsys_std::string second; kwsys_stl::string second;
kwsys_std::string valuename; kwsys_stl::string valuename;
size_t start = primary.find("\\"); size_t start = primary.find("\\");
if (start == kwsys_std::string::npos) if (start == kwsys_stl::string::npos)
{ {
return false; return false;
} }
size_t valuenamepos = primary.find(";"); size_t valuenamepos = primary.find(";");
if (valuenamepos != kwsys_std::string::npos) if (valuenamepos != kwsys_stl::string::npos)
{ {
valuename = primary.substr(valuenamepos+1); valuename = primary.substr(valuenamepos+1);
} }
@ -494,18 +494,18 @@ bool SystemTools::WriteRegistryValue(const char *, const char *)
#if defined(_WIN32) && !defined(__CYGWIN__) #if defined(_WIN32) && !defined(__CYGWIN__)
bool SystemTools::DeleteRegistryValue(const char *key) bool SystemTools::DeleteRegistryValue(const char *key)
{ {
kwsys_std::string primary = key; kwsys_stl::string primary = key;
kwsys_std::string second; kwsys_stl::string second;
kwsys_std::string valuename; kwsys_stl::string valuename;
size_t start = primary.find("\\"); size_t start = primary.find("\\");
if (start == kwsys_std::string::npos) if (start == kwsys_stl::string::npos)
{ {
return false; return false;
} }
size_t valuenamepos = primary.find(";"); size_t valuenamepos = primary.find(";");
if (valuenamepos != kwsys_std::string::npos) if (valuenamepos != kwsys_stl::string::npos)
{ {
valuename = primary.substr(valuenamepos+1); valuename = primary.substr(valuenamepos+1);
} }
@ -640,9 +640,9 @@ bool SystemTools::FileExists(const char* filename)
// Return a capitalized string (i.e the first letter is uppercased, all other // Return a capitalized string (i.e the first letter is uppercased, all other
// are lowercased) // are lowercased)
kwsys_std::string SystemTools::Capitalized(const kwsys_std::string& s) kwsys_stl::string SystemTools::Capitalized(const kwsys_stl::string& s)
{ {
kwsys_std::string n; kwsys_stl::string n;
n.resize(s.size()); n.resize(s.size());
n[0] = toupper(s[0]); n[0] = toupper(s[0]);
for (size_t i = 1; i < s.size(); i++) for (size_t i = 1; i < s.size(); i++)
@ -654,9 +654,9 @@ kwsys_std::string SystemTools::Capitalized(const kwsys_std::string& s)
// Return a lower case string // Return a lower case string
kwsys_std::string SystemTools::LowerCase(const kwsys_std::string& s) kwsys_stl::string SystemTools::LowerCase(const kwsys_stl::string& s)
{ {
kwsys_std::string n; kwsys_stl::string n;
n.resize(s.size()); n.resize(s.size());
for (size_t i = 0; i < s.size(); i++) for (size_t i = 0; i < s.size(); i++)
{ {
@ -666,9 +666,9 @@ kwsys_std::string SystemTools::LowerCase(const kwsys_std::string& s)
} }
// Return a lower case string // Return a lower case string
kwsys_std::string SystemTools::UpperCase(const kwsys_std::string& s) kwsys_stl::string SystemTools::UpperCase(const kwsys_stl::string& s)
{ {
kwsys_std::string n; kwsys_stl::string n;
n.resize(s.size()); n.resize(s.size());
for (size_t i = 0; i < s.size(); i++) for (size_t i = 0; i < s.size(); i++)
{ {
@ -679,10 +679,10 @@ kwsys_std::string SystemTools::UpperCase(const kwsys_std::string& s)
// convert windows slashes to unix slashes // convert windows slashes to unix slashes
void SystemTools::ConvertToUnixSlashes(kwsys_std::string& path) void SystemTools::ConvertToUnixSlashes(kwsys_stl::string& path)
{ {
kwsys_std::string::size_type pos = 0; kwsys_stl::string::size_type pos = 0;
while((pos = path.find('\\', pos)) != kwsys_std::string::npos) while((pos = path.find('\\', pos)) != kwsys_stl::string::npos)
{ {
path[pos] = '/'; path[pos] = '/';
pos++; pos++;
@ -696,7 +696,7 @@ void SystemTools::ConvertToUnixSlashes(kwsys_std::string& path)
start_find = 1; start_find = 1;
#endif #endif
while((pos = path.find("//", start_find)) != kwsys_std::string::npos) while((pos = path.find("//", start_find)) != kwsys_stl::string::npos)
{ {
SystemTools::ReplaceString(path, "//", "/"); SystemTools::ReplaceString(path, "//", "/");
} }
@ -712,7 +712,7 @@ void SystemTools::ConvertToUnixSlashes(kwsys_std::string& path)
{ {
if (getenv("HOME")) if (getenv("HOME"))
{ {
path = kwsys_std::string(getenv("HOME")) + path.substr(1); path = kwsys_stl::string(getenv("HOME")) + path.substr(1);
} }
} }
@ -724,20 +724,20 @@ void SystemTools::ConvertToUnixSlashes(kwsys_std::string& path)
} }
// change // to /, and escape any spaces in the path // change // to /, and escape any spaces in the path
kwsys_std::string SystemTools::ConvertToUnixOutputPath(const char* path) kwsys_stl::string SystemTools::ConvertToUnixOutputPath(const char* path)
{ {
kwsys_std::string ret = path; kwsys_stl::string ret = path;
// remove // except at the beginning might be a cygwin drive // remove // except at the beginning might be a cygwin drive
kwsys_std::string::size_type pos = 1; kwsys_stl::string::size_type pos = 1;
while((pos = ret.find("//", pos)) != kwsys_std::string::npos) while((pos = ret.find("//", pos)) != kwsys_stl::string::npos)
{ {
ret.erase(pos, 1); ret.erase(pos, 1);
} }
// now escape spaces if there is a space in the path // now escape spaces if there is a space in the path
if(ret.find(" ") != kwsys_std::string::npos) if(ret.find(" ") != kwsys_stl::string::npos)
{ {
kwsys_std::string result = ""; kwsys_stl::string result = "";
char lastch = 1; char lastch = 1;
for(const char* ch = ret.c_str(); *ch != '\0'; ++ch) for(const char* ch = ret.c_str(); *ch != '\0'; ++ch)
{ {
@ -754,7 +754,7 @@ kwsys_std::string SystemTools::ConvertToUnixOutputPath(const char* path)
return ret; return ret;
} }
kwsys_std::string SystemTools::ConvertToOutputPath(const char* path) kwsys_stl::string SystemTools::ConvertToOutputPath(const char* path)
{ {
#if defined(_WIN32) && !defined(__CYGWIN__) #if defined(_WIN32) && !defined(__CYGWIN__)
return SystemTools::ConvertToWindowsOutputPath(path); return SystemTools::ConvertToWindowsOutputPath(path);
@ -764,12 +764,12 @@ kwsys_std::string SystemTools::ConvertToOutputPath(const char* path)
} }
// remove double slashes not at the start // remove double slashes not at the start
kwsys_std::string SystemTools::ConvertToWindowsOutputPath(const char* path) kwsys_stl::string SystemTools::ConvertToWindowsOutputPath(const char* path)
{ {
kwsys_std::string ret = path; kwsys_stl::string ret = path;
kwsys_std::string::size_type pos = 0; kwsys_stl::string::size_type pos = 0;
// first convert all of the slashes // first convert all of the slashes
while((pos = ret.find('/', pos)) != kwsys_std::string::npos) while((pos = ret.find('/', pos)) != kwsys_stl::string::npos)
{ {
ret[pos] = '\\'; ret[pos] = '\\';
pos++; pos++;
@ -791,16 +791,16 @@ kwsys_std::string SystemTools::ConvertToWindowsOutputPath(const char* path)
return ret; return ret;
} }
} }
while((pos = ret.find("\\\\", pos)) != kwsys_std::string::npos) while((pos = ret.find("\\\\", pos)) != kwsys_stl::string::npos)
{ {
ret.erase(pos, 1); ret.erase(pos, 1);
} }
// now double quote the path if it has spaces in it // now double quote the path if it has spaces in it
// and is not already double quoted // and is not already double quoted
if(ret.find(" ") != kwsys_std::string::npos if(ret.find(" ") != kwsys_stl::string::npos
&& ret[0] != '\"') && ret[0] != '\"')
{ {
kwsys_std::string result; kwsys_stl::string result;
result = "\"" + ret + "\""; result = "\"" + ret + "\"";
ret = result; ret = result;
} }
@ -845,13 +845,13 @@ bool SystemTools::FilesDiffer(const char* source,
} }
#if defined(_WIN32) || defined(__CYGWIN__) #if defined(_WIN32) || defined(__CYGWIN__)
kwsys_std::ifstream finSource(source, (kwsys_std::ios::binary | kwsys_ios::ifstream finSource(source, (kwsys_ios::ios::binary |
kwsys_std::ios::in)); kwsys_ios::ios::in));
kwsys_std::ifstream finDestination(destination, (kwsys_std::ios::binary | kwsys_ios::ifstream finDestination(destination, (kwsys_ios::ios::binary |
kwsys_std::ios::in)); kwsys_ios::ios::in));
#else #else
kwsys_std::ifstream finSource(source); kwsys_ios::ifstream finSource(source);
kwsys_std::ifstream finDestination(destination); kwsys_ios::ifstream finDestination(destination);
#endif #endif
if(!finSource || !finDestination) if(!finSource || !finDestination)
{ {
@ -894,31 +894,31 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination)
// If destination is a directory, try to create a file with the same // If destination is a directory, try to create a file with the same
// name as the source in that directory. // name as the source in that directory.
kwsys_std::string new_destination; kwsys_stl::string new_destination;
if(SystemTools::FileExists(destination) && if(SystemTools::FileExists(destination) &&
SystemTools::FileIsDirectory(destination)) SystemTools::FileIsDirectory(destination))
{ {
new_destination = destination; new_destination = destination;
SystemTools::ConvertToUnixSlashes(new_destination); SystemTools::ConvertToUnixSlashes(new_destination);
new_destination += '/'; new_destination += '/';
kwsys_std::string source_name = source; kwsys_stl::string source_name = source;
new_destination += SystemTools::GetFilenameName(source_name); new_destination += SystemTools::GetFilenameName(source_name);
destination = new_destination.c_str(); destination = new_destination.c_str();
} }
// Create destination directory // Create destination directory
kwsys_std::string destination_dir = destination; kwsys_stl::string destination_dir = destination;
destination_dir = SystemTools::GetFilenamePath(destination_dir); destination_dir = SystemTools::GetFilenamePath(destination_dir);
SystemTools::MakeDirectory(destination_dir.c_str()); SystemTools::MakeDirectory(destination_dir.c_str());
// Open files // Open files
#if defined(_WIN32) || defined(__CYGWIN__) #if defined(_WIN32) || defined(__CYGWIN__)
kwsys_std::ifstream fin(source, kwsys_ios::ifstream fin(source,
kwsys_std::ios::binary | kwsys_std::ios::in); kwsys_ios::ios::binary | kwsys_ios::ios::in);
#else #else
kwsys_std::ifstream fin(source); kwsys_ios::ifstream fin(source);
#endif #endif
if(!fin) if(!fin)
{ {
@ -926,11 +926,11 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination)
} }
#if defined(_WIN32) || defined(__CYGWIN__) #if defined(_WIN32) || defined(__CYGWIN__)
kwsys_std::ofstream fout(destination, kwsys_ios::ofstream fout(destination,
kwsys_std::ios::binary | kwsys_std::ios::out | kwsys_std::ios::trunc); kwsys_ios::ios::binary | kwsys_ios::ios::out | kwsys_ios::ios::trunc);
#else #else
kwsys_std::ofstream fout(destination, kwsys_ios::ofstream fout(destination,
kwsys_std::ios::out | kwsys_std::ios::trunc); kwsys_ios::ios::out | kwsys_ios::ios::trunc);
#endif #endif
if(!fout) if(!fout)
{ {
@ -1021,7 +1021,7 @@ long int SystemTools::ModifiedTime(const char* filename)
} }
kwsys_std::string SystemTools::GetLastSystemError() kwsys_stl::string SystemTools::GetLastSystemError()
{ {
int e = errno; int e = errno;
return strerror(e); return strerror(e);
@ -1042,7 +1042,7 @@ bool SystemTools::RemoveADirectory(const char* source)
if (strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)),".") && if (strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)),".") &&
strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)),"..")) strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)),".."))
{ {
kwsys_std::string fullPath = source; kwsys_stl::string fullPath = source;
fullPath += "/"; fullPath += "/";
fullPath += dir.GetFile(static_cast<unsigned long>(fileNum)); fullPath += dir.GetFile(static_cast<unsigned long>(fileNum));
if(SystemTools::FileIsDirectory(fullPath.c_str())) if(SystemTools::FileIsDirectory(fullPath.c_str()))
@ -1070,17 +1070,17 @@ bool SystemTools::RemoveADirectory(const char* source)
* the system search path. Returns the full path to the file if it is * the system search path. Returns the full path to the file if it is
* found. Otherwise, the empty string is returned. * found. Otherwise, the empty string is returned.
*/ */
kwsys_std::string SystemTools::FindFile(const char* name, kwsys_stl::string SystemTools::FindFile(const char* name,
const kwsys_std::vector<kwsys_std::string>& userPaths) const kwsys_stl::vector<kwsys_stl::string>& userPaths)
{ {
// Add the system search path to our path first // Add the system search path to our path first
kwsys_std::vector<kwsys_std::string> path; kwsys_stl::vector<kwsys_stl::string> path;
SystemTools::GetPath(path); SystemTools::GetPath(path);
// now add the additional paths // now add the additional paths
path.insert(path.end(), userPaths.begin(), userPaths.end()); path.insert(path.end(), userPaths.begin(), userPaths.end());
// now look for the file // now look for the file
kwsys_std::string tryPath; kwsys_stl::string tryPath;
for(kwsys_std::vector<kwsys_std::string>::const_iterator p = path.begin(); for(kwsys_stl::vector<kwsys_stl::string>::const_iterator p = path.begin();
p != path.end(); ++p) p != path.end(); ++p)
{ {
tryPath = *p; tryPath = *p;
@ -1101,9 +1101,9 @@ kwsys_std::string SystemTools::FindFile(const char* name,
* the system search path. Returns the full path to the executable if it is * the system search path. Returns the full path to the executable if it is
* found. Otherwise, the empty string is returned. * found. Otherwise, the empty string is returned.
*/ */
kwsys_std::string SystemTools::FindProgram( kwsys_stl::string SystemTools::FindProgram(
const char* name, const char* name,
const kwsys_std::vector<kwsys_std::string>& userPaths, const kwsys_stl::vector<kwsys_stl::string>& userPaths,
bool no_system_path) bool no_system_path)
{ {
if(!name) if(!name)
@ -1116,7 +1116,7 @@ kwsys_std::string SystemTools::FindProgram(
{ {
return SystemTools::CollapseFullPath(name); return SystemTools::CollapseFullPath(name);
} }
kwsys_std::string tryPath = name; kwsys_stl::string tryPath = name;
tryPath += SystemTools::GetExecutableExtension(); tryPath += SystemTools::GetExecutableExtension();
if(SystemTools::FileExists(tryPath.c_str()) && if(SystemTools::FileExists(tryPath.c_str()) &&
!SystemTools::FileIsDirectory(tryPath.c_str())) !SystemTools::FileIsDirectory(tryPath.c_str()))
@ -1125,7 +1125,7 @@ kwsys_std::string SystemTools::FindProgram(
} }
// Add the system search path to our path. // Add the system search path to our path.
kwsys_std::vector<kwsys_std::string> path; kwsys_stl::vector<kwsys_stl::string> path;
if (!no_system_path) if (!no_system_path)
{ {
SystemTools::GetPath(path); SystemTools::GetPath(path);
@ -1133,7 +1133,7 @@ kwsys_std::string SystemTools::FindProgram(
// now add the additional paths // now add the additional paths
path.insert(path.end(), userPaths.begin(), userPaths.end()); path.insert(path.end(), userPaths.begin(), userPaths.end());
for(kwsys_std::vector<kwsys_std::string>::const_iterator p = path.begin(); for(kwsys_stl::vector<kwsys_stl::string>::const_iterator p = path.begin();
p != path.end(); ++p) p != path.end(); ++p)
{ {
tryPath = *p; tryPath = *p;
@ -1173,8 +1173,8 @@ kwsys_std::string SystemTools::FindProgram(
* the system search path. Returns the full path to the library if it is * the system search path. Returns the full path to the library if it is
* found. Otherwise, the empty string is returned. * found. Otherwise, the empty string is returned.
*/ */
kwsys_std::string SystemTools::FindLibrary(const char* name, kwsys_stl::string SystemTools::FindLibrary(const char* name,
const kwsys_std::vector<kwsys_std::string>& userPaths) const kwsys_stl::vector<kwsys_stl::string>& userPaths)
{ {
// See if the executable exists as written. // See if the executable exists as written.
if(SystemTools::FileExists(name) && if(SystemTools::FileExists(name) &&
@ -1184,12 +1184,12 @@ kwsys_std::string SystemTools::FindLibrary(const char* name,
} }
// Add the system search path to our path. // Add the system search path to our path.
kwsys_std::vector<kwsys_std::string> path; kwsys_stl::vector<kwsys_stl::string> path;
SystemTools::GetPath(path); SystemTools::GetPath(path);
// now add the additional paths // now add the additional paths
path.insert(path.end(), userPaths.begin(), userPaths.end()); path.insert(path.end(), userPaths.begin(), userPaths.end());
kwsys_std::string tryPath; kwsys_stl::string tryPath;
for(kwsys_std::vector<kwsys_std::string>::const_iterator p = path.begin(); for(kwsys_stl::vector<kwsys_stl::string>::const_iterator p = path.begin();
p != path.end(); ++p) p != path.end(); ++p)
{ {
#if defined(_WIN32) && !defined(__CYGWIN__) #if defined(_WIN32) && !defined(__CYGWIN__)
@ -1263,23 +1263,23 @@ int SystemTools::ChangeDirectory(const char *dir)
return Chdir(dir); return Chdir(dir);
} }
kwsys_std::string SystemTools::GetCurrentWorkingDirectory() kwsys_stl::string SystemTools::GetCurrentWorkingDirectory()
{ {
char buf[2048]; char buf[2048];
kwsys_std::string path = Getcwd(buf, 2048); kwsys_stl::string path = Getcwd(buf, 2048);
return path; return path;
} }
kwsys_std::string SystemTools::GetProgramPath(const char* in_name) kwsys_stl::string SystemTools::GetProgramPath(const char* in_name)
{ {
kwsys_std::string dir, file; kwsys_stl::string dir, file;
SystemTools::SplitProgramPath(in_name, dir, file); SystemTools::SplitProgramPath(in_name, dir, file);
return dir; return dir;
} }
bool SystemTools::SplitProgramPath(const char* in_name, bool SystemTools::SplitProgramPath(const char* in_name,
kwsys_std::string& dir, kwsys_stl::string& dir,
kwsys_std::string& file, kwsys_stl::string& file,
bool) bool)
{ {
dir = in_name; dir = in_name;
@ -1288,8 +1288,8 @@ bool SystemTools::SplitProgramPath(const char* in_name,
if(!SystemTools::FileIsDirectory(dir.c_str())) if(!SystemTools::FileIsDirectory(dir.c_str()))
{ {
kwsys_std::string::size_type slashPos = dir.rfind("/"); kwsys_stl::string::size_type slashPos = dir.rfind("/");
if(slashPos != kwsys_std::string::npos) if(slashPos != kwsys_stl::string::npos)
{ {
file = dir.substr(slashPos+1); file = dir.substr(slashPos+1);
dir = dir.substr(0, slashPos); dir = dir.substr(0, slashPos);
@ -1302,7 +1302,7 @@ bool SystemTools::SplitProgramPath(const char* in_name,
} }
if(!(dir == "") && !SystemTools::FileIsDirectory(dir.c_str())) if(!(dir == "") && !SystemTools::FileIsDirectory(dir.c_str()))
{ {
kwsys_std::string oldDir = in_name; kwsys_stl::string oldDir = in_name;
SystemTools::ConvertToUnixSlashes(oldDir); SystemTools::ConvertToUnixSlashes(oldDir);
dir = in_name; dir = in_name;
return false; return false;
@ -1310,19 +1310,19 @@ bool SystemTools::SplitProgramPath(const char* in_name,
return true; return true;
} }
kwsys_std::string SystemTools::CollapseFullPath(const char* in_relative) kwsys_stl::string SystemTools::CollapseFullPath(const char* in_relative)
{ {
return SystemTools::CollapseFullPath(in_relative, 0); return SystemTools::CollapseFullPath(in_relative, 0);
} }
kwsys_std::string SystemTools::CollapseFullPath(const char* in_relative, kwsys_stl::string SystemTools::CollapseFullPath(const char* in_relative,
const char* in_base) const char* in_base)
{ {
kwsys_std::string dir, file; kwsys_stl::string dir, file;
SystemTools::SplitProgramPath(in_relative, dir, file, false); SystemTools::SplitProgramPath(in_relative, dir, file, false);
// Save original working directory. // Save original working directory.
kwsys_std::string orig = SystemTools::GetCurrentWorkingDirectory(); kwsys_stl::string orig = SystemTools::GetCurrentWorkingDirectory();
// Change to base of relative path. // Change to base of relative path.
if(in_base) if(in_base)
@ -1338,7 +1338,7 @@ kwsys_std::string SystemTools::CollapseFullPath(const char* in_relative,
} }
// Get the resulting directory. // Get the resulting directory.
kwsys_std::string newDir = SystemTools::GetCurrentWorkingDirectory(); kwsys_stl::string newDir = SystemTools::GetCurrentWorkingDirectory();
// Add the file back on to the directory. // Add the file back on to the directory.
SystemTools::ConvertToUnixSlashes(newDir); SystemTools::ConvertToUnixSlashes(newDir);
@ -1354,7 +1354,7 @@ kwsys_std::string SystemTools::CollapseFullPath(const char* in_relative,
# endif # endif
// Resolve relative path. // Resolve relative path.
kwsys_std::string newDir; kwsys_stl::string newDir;
if(!(dir == "")) if(!(dir == ""))
{ {
realpath(dir.c_str(), resolved_name); realpath(dir.c_str(), resolved_name);
@ -1375,7 +1375,7 @@ kwsys_std::string SystemTools::CollapseFullPath(const char* in_relative,
Chdir(orig.c_str()); Chdir(orig.c_str());
// Construct and return the full path. // Construct and return the full path.
kwsys_std::string newPath = newDir; kwsys_stl::string newPath = newDir;
if(!(file == "")) if(!(file == ""))
{ {
newPath += "/"; newPath += "/";
@ -1384,14 +1384,14 @@ kwsys_std::string SystemTools::CollapseFullPath(const char* in_relative,
return newPath; return newPath;
} }
bool SystemTools::Split(const char* str, kwsys_std::vector<kwsys_std::string>& lines) bool SystemTools::Split(const char* str, kwsys_stl::vector<kwsys_stl::string>& lines)
{ {
kwsys_std::string data(str); kwsys_stl::string data(str);
kwsys_std::string::size_type lpos = 0; kwsys_stl::string::size_type lpos = 0;
while(lpos < data.length()) while(lpos < data.length())
{ {
kwsys_std::string::size_type rpos = data.find_first_of("\n", lpos); kwsys_stl::string::size_type rpos = data.find_first_of("\n", lpos);
if(rpos == kwsys_std::string::npos) if(rpos == kwsys_stl::string::npos)
{ {
// Line ends at end of string without a newline. // Line ends at end of string without a newline.
lines.push_back(data.substr(lpos)); lines.push_back(data.substr(lpos));
@ -1416,13 +1416,13 @@ bool SystemTools::Split(const char* str, kwsys_std::vector<kwsys_std::string>& l
* Return path of a full filename (no trailing slashes). * Return path of a full filename (no trailing slashes).
* Warning: returned path is converted to Unix slashes format. * Warning: returned path is converted to Unix slashes format.
*/ */
kwsys_std::string SystemTools::GetFilenamePath(const kwsys_std::string& filename) kwsys_stl::string SystemTools::GetFilenamePath(const kwsys_stl::string& filename)
{ {
kwsys_std::string fn = filename; kwsys_stl::string fn = filename;
SystemTools::ConvertToUnixSlashes(fn); SystemTools::ConvertToUnixSlashes(fn);
kwsys_std::string::size_type slash_pos = fn.rfind("/"); kwsys_stl::string::size_type slash_pos = fn.rfind("/");
if(slash_pos != kwsys_std::string::npos) if(slash_pos != kwsys_stl::string::npos)
{ {
return fn.substr(0, slash_pos); return fn.substr(0, slash_pos);
} }
@ -1436,13 +1436,13 @@ kwsys_std::string SystemTools::GetFilenamePath(const kwsys_std::string& filename
/** /**
* Return file name of a full filename (i.e. file name without path). * Return file name of a full filename (i.e. file name without path).
*/ */
kwsys_std::string SystemTools::GetFilenameName(const kwsys_std::string& filename) kwsys_stl::string SystemTools::GetFilenameName(const kwsys_stl::string& filename)
{ {
kwsys_std::string fn = filename; kwsys_stl::string fn = filename;
SystemTools::ConvertToUnixSlashes(fn); SystemTools::ConvertToUnixSlashes(fn);
kwsys_std::string::size_type slash_pos = fn.rfind("/"); kwsys_stl::string::size_type slash_pos = fn.rfind("/");
if(slash_pos != kwsys_std::string::npos) if(slash_pos != kwsys_stl::string::npos)
{ {
return fn.substr(slash_pos + 1); return fn.substr(slash_pos + 1);
} }
@ -1457,11 +1457,11 @@ kwsys_std::string SystemTools::GetFilenameName(const kwsys_std::string& filename
* Return file extension of a full filename (dot included). * Return file extension of a full filename (dot included).
* Warning: this is the longest extension (for example: .tar.gz) * Warning: this is the longest extension (for example: .tar.gz)
*/ */
kwsys_std::string SystemTools::GetFilenameExtension(const kwsys_std::string& filename) kwsys_stl::string SystemTools::GetFilenameExtension(const kwsys_stl::string& filename)
{ {
kwsys_std::string name = SystemTools::GetFilenameName(filename); kwsys_stl::string name = SystemTools::GetFilenameName(filename);
kwsys_std::string::size_type dot_pos = name.find("."); kwsys_stl::string::size_type dot_pos = name.find(".");
if(dot_pos != kwsys_std::string::npos) if(dot_pos != kwsys_stl::string::npos)
{ {
return name.substr(dot_pos); return name.substr(dot_pos);
} }
@ -1475,11 +1475,11 @@ kwsys_std::string SystemTools::GetFilenameExtension(const kwsys_std::string& fil
* Return file extension of a full filename (dot included). * Return file extension of a full filename (dot included).
* Warning: this is the shortest extension (for example: .tar.gz) * Warning: this is the shortest extension (for example: .tar.gz)
*/ */
kwsys_std::string SystemTools::GetFilenameLastExtension(const kwsys_std::string& filename) kwsys_stl::string SystemTools::GetFilenameLastExtension(const kwsys_stl::string& filename)
{ {
kwsys_std::string name = SystemTools::GetFilenameName(filename); kwsys_stl::string name = SystemTools::GetFilenameName(filename);
kwsys_std::string::size_type dot_pos = name.rfind("."); kwsys_stl::string::size_type dot_pos = name.rfind(".");
if(dot_pos != kwsys_std::string::npos) if(dot_pos != kwsys_stl::string::npos)
{ {
return name.substr(dot_pos); return name.substr(dot_pos);
} }
@ -1493,11 +1493,11 @@ kwsys_std::string SystemTools::GetFilenameLastExtension(const kwsys_std::string&
* Return file name without extension of a full filename (i.e. without path). * Return file name without extension of a full filename (i.e. without path).
* Warning: it considers the longest extension (for example: .tar.gz) * Warning: it considers the longest extension (for example: .tar.gz)
*/ */
kwsys_std::string SystemTools::GetFilenameWithoutExtension(const kwsys_std::string& filename) kwsys_stl::string SystemTools::GetFilenameWithoutExtension(const kwsys_stl::string& filename)
{ {
kwsys_std::string name = SystemTools::GetFilenameName(filename); kwsys_stl::string name = SystemTools::GetFilenameName(filename);
kwsys_std::string::size_type dot_pos = name.find("."); kwsys_stl::string::size_type dot_pos = name.find(".");
if(dot_pos != kwsys_std::string::npos) if(dot_pos != kwsys_stl::string::npos)
{ {
return name.substr(0, dot_pos); return name.substr(0, dot_pos);
} }
@ -1513,12 +1513,12 @@ kwsys_std::string SystemTools::GetFilenameWithoutExtension(const kwsys_std::stri
* Warning: it considers the last extension (for example: removes .gz * Warning: it considers the last extension (for example: removes .gz
* from .tar.gz) * from .tar.gz)
*/ */
kwsys_std::string kwsys_stl::string
SystemTools::GetFilenameWithoutLastExtension(const kwsys_std::string& filename) SystemTools::GetFilenameWithoutLastExtension(const kwsys_stl::string& filename)
{ {
kwsys_std::string name = SystemTools::GetFilenameName(filename); kwsys_stl::string name = SystemTools::GetFilenameName(filename);
kwsys_std::string::size_type dot_pos = name.rfind("."); kwsys_stl::string::size_type dot_pos = name.rfind(".");
if(dot_pos != kwsys_std::string::npos) if(dot_pos != kwsys_stl::string::npos)
{ {
return name.substr(0, dot_pos); return name.substr(0, dot_pos);
} }
@ -1530,7 +1530,7 @@ SystemTools::GetFilenameWithoutLastExtension(const kwsys_std::string& filename)
bool SystemTools::FileIsFullPath(const char* in_name) bool SystemTools::FileIsFullPath(const char* in_name)
{ {
kwsys_std::string name = in_name; kwsys_stl::string name = in_name;
#if defined(_WIN32) #if defined(_WIN32)
// On Windows, the name must be at least two characters long. // On Windows, the name must be at least two characters long.
if(name.length() < 2) if(name.length() < 2)
@ -1562,7 +1562,7 @@ bool SystemTools::FileIsFullPath(const char* in_name)
return false; return false;
} }
bool SystemTools::GetShortPath(const char* path, kwsys_std::string& shortPath) bool SystemTools::GetShortPath(const char* path, kwsys_stl::string& shortPath)
{ {
#if defined(WIN32) && !defined(__CYGWIN__) #if defined(WIN32) && !defined(__CYGWIN__)
const int size = int(strlen(path)) +1; // size of return const int size = int(strlen(path)) +1; // size of return
@ -1604,7 +1604,7 @@ bool SystemTools::GetShortPath(const char* path, kwsys_std::string& shortPath)
} }
void SystemTools::SplitProgramFromArgs(const char* path, void SystemTools::SplitProgramFromArgs(const char* path,
kwsys_std::string& program, kwsys_std::string& args) kwsys_stl::string& program, kwsys_stl::string& args)
{ {
if(SystemTools::FileExists(path)) if(SystemTools::FileExists(path))
{ {
@ -1612,25 +1612,25 @@ void SystemTools::SplitProgramFromArgs(const char* path,
args = ""; args = "";
return; return;
} }
kwsys_std::vector<kwsys_std::string> e; kwsys_stl::vector<kwsys_stl::string> e;
kwsys_std::string findProg = SystemTools::FindProgram(path, e); kwsys_stl::string findProg = SystemTools::FindProgram(path, e);
if(findProg.size()) if(findProg.size())
{ {
program = findProg; program = findProg;
args = ""; args = "";
return; return;
} }
kwsys_std::string dir = path; kwsys_stl::string dir = path;
kwsys_std::string::size_type spacePos = dir.rfind(' '); kwsys_stl::string::size_type spacePos = dir.rfind(' ');
if(spacePos == kwsys_std::string::npos) if(spacePos == kwsys_stl::string::npos)
{ {
program = ""; program = "";
args = ""; args = "";
return; return;
} }
while(spacePos != kwsys_std::string::npos) while(spacePos != kwsys_stl::string::npos)
{ {
kwsys_std::string tryProg = dir.substr(0, spacePos); kwsys_stl::string tryProg = dir.substr(0, spacePos);
if(SystemTools::FileExists(tryProg.c_str())) if(SystemTools::FileExists(tryProg.c_str()))
{ {
program = tryProg; program = tryProg;
@ -1650,7 +1650,7 @@ void SystemTools::SplitProgramFromArgs(const char* path,
args = ""; args = "";
} }
kwsys_std::string SystemTools::GetCurrentDateTime(const char* format) kwsys_stl::string SystemTools::GetCurrentDateTime(const char* format)
{ {
char buf[1024]; char buf[1024];
time_t t; time_t t;
@ -1659,20 +1659,20 @@ kwsys_std::string SystemTools::GetCurrentDateTime(const char* format)
return buf; return buf;
} }
kwsys_std::string SystemTools::MakeCindentifier(const char* s) kwsys_stl::string SystemTools::MakeCindentifier(const char* s)
{ {
kwsys_std::string str(s); kwsys_stl::string str(s);
if (str.find_first_of("0123456789") == 0) if (str.find_first_of("0123456789") == 0)
{ {
str = "_" + str; str = "_" + str;
} }
kwsys_std::string permited_chars("_" kwsys_stl::string permited_chars("_"
"abcdefghijklmnopqrstuvwxyz" "abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"0123456789"); "0123456789");
kwsys_std::string::size_type pos = 0; kwsys_stl::string::size_type pos = 0;
while ((pos = str.find_first_not_of(permited_chars, pos)) != kwsys_std::string::npos) while ((pos = str.find_first_not_of(permited_chars, pos)) != kwsys_stl::string::npos)
{ {
str[pos] = '_'; str[pos] = '_';
} }
@ -1682,7 +1682,7 @@ kwsys_std::string SystemTools::MakeCindentifier(const char* s)
// Due to a buggy stream library on the HP and another on Mac OSX, we // Due to a buggy stream library on the HP and another on Mac OSX, we
// need this very carefully written version of getline. Returns true // need this very carefully written version of getline. Returns true
// if any data were read before the end-of-file was reached. // if any data were read before the end-of-file was reached.
bool SystemTools::GetLineFromStream(kwsys_std::istream& is, kwsys_std::string& line, bool SystemTools::GetLineFromStream(kwsys_ios::istream& is, kwsys_stl::string& line,
bool *has_newline /* = 0 */) bool *has_newline /* = 0 */)
{ {
const int bufferSize = 1024; const int bufferSize = 1024;
@ -1714,7 +1714,7 @@ bool SystemTools::GetLineFromStream(kwsys_std::istream& is, kwsys_std::string& l
} }
// The fail bit may be set. Clear it. // The fail bit may be set. Clear it.
is.clear(is.rdstate() & ~kwsys_std::ios::failbit); is.clear(is.rdstate() & ~kwsys_ios::ios::failbit);
} }
return haveData; return haveData;
} }

View File

@ -14,15 +14,16 @@
#ifndef @KWSYS_NAMESPACE@_SystemTools_hxx #ifndef @KWSYS_NAMESPACE@_SystemTools_hxx
#define @KWSYS_NAMESPACE@_SystemTools_hxx #define @KWSYS_NAMESPACE@_SystemTools_hxx
#include <@KWSYS_NAMESPACE@/std/iosfwd> #include <@KWSYS_NAMESPACE@/ios/iosfwd>
#include <@KWSYS_NAMESPACE@/std/string> #include <@KWSYS_NAMESPACE@/stl/string>
#include <@KWSYS_NAMESPACE@/std/vector> #include <@KWSYS_NAMESPACE@/stl/vector>
#include <@KWSYS_NAMESPACE@/Configure.h> #include <@KWSYS_NAMESPACE@/Configure.h>
/* Define this macro temporarily to keep the code readable. */ /* Define these macros temporarily to keep the code readable. */
#if !defined (KWSYS_NAMESPACE) && !defined(@KWSYS_NAMESPACE@_NAME_IS_KWSYS) #if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
# define kwsys_std @KWSYS_NAMESPACE@_std # define kwsys_stl @KWSYS_NAMESPACE@_stl
# define kwsys_ios @KWSYS_NAMESPACE@_ios
#endif #endif
namespace @KWSYS_NAMESPACE@ namespace @KWSYS_NAMESPACE@
@ -41,7 +42,7 @@ public:
* then an underscore is prepended. Note that this can produce * then an underscore is prepended. Note that this can produce
* identifiers that the standard reserves (_[A-Z].* and __.*). * identifiers that the standard reserves (_[A-Z].* and __.*).
*/ */
static kwsys_std::string MakeCindentifier(const char* s); static kwsys_stl::string MakeCindentifier(const char* s);
/** /**
* Make a new directory if it is not there. This function * Make a new directory if it is not there. This function
@ -63,14 +64,14 @@ public:
* Replace replace all occurances of the string in * Replace replace all occurances of the string in
* the source string. * the source string.
*/ */
static void ReplaceString(kwsys_std::string& source, static void ReplaceString(kwsys_stl::string& source,
const char* replace, const char* replace,
const char* with); const char* with);
/** /**
* Read a registry value * Read a registry value
*/ */
static bool ReadRegistryValue(const char *key, kwsys_std::string &value); static bool ReadRegistryValue(const char *key, kwsys_stl::string &value);
/** /**
* Write a registry value * Write a registry value
@ -86,17 +87,17 @@ public:
* Return a capitalized string (i.e the first letter is uppercased, * Return a capitalized string (i.e the first letter is uppercased,
* all other are lowercased). * all other are lowercased).
*/ */
static kwsys_std::string Capitalized(const kwsys_std::string&); static kwsys_stl::string Capitalized(const kwsys_stl::string&);
/** /**
* Return a lower case string * Return a lower case string
*/ */
static kwsys_std::string LowerCase(const kwsys_std::string&); static kwsys_stl::string LowerCase(const kwsys_stl::string&);
/** /**
* Return a lower case string * Return a lower case string
*/ */
static kwsys_std::string UpperCase(const kwsys_std::string&); static kwsys_stl::string UpperCase(const kwsys_stl::string&);
/** /**
* do a case-independent string comparison * do a case-independent string comparison
@ -106,13 +107,13 @@ public:
/** /**
* Replace Windows file system slashes with Unix-style slashes. * Replace Windows file system slashes with Unix-style slashes.
*/ */
static void ConvertToUnixSlashes(kwsys_std::string& path); static void ConvertToUnixSlashes(kwsys_stl::string& path);
/** /**
* For windows this calles ConvertToWindowsOutputPath and for unix * For windows this calles ConvertToWindowsOutputPath and for unix
* it calls ConvertToUnixOutputPath * it calls ConvertToUnixOutputPath
*/ */
static kwsys_std::string ConvertToOutputPath(const char*); static kwsys_stl::string ConvertToOutputPath(const char*);
/** Return true if a file exists in the current directory. */ /** Return true if a file exists in the current directory. */
static bool FileExists(const char* filename); static bool FileExists(const char* filename);
@ -122,11 +123,11 @@ public:
* Add the paths from the environment variable PATH to the * Add the paths from the environment variable PATH to the
* string vector passed in. * string vector passed in.
*/ */
static void GetPath(kwsys_std::vector<kwsys_std::string>& path); static void GetPath(kwsys_stl::vector<kwsys_stl::string>& path);
/** Read an environment variable. */ /** Read an environment variable. */
static const char* GetEnv(const char* key); static const char* GetEnv(const char* key);
static bool GetEnv(const char* key, kwsys_std::string& result); static bool GetEnv(const char* key, kwsys_stl::string& result);
/** /**
* Get the file extension (including ".") needed for an executable * Get the file extension (including ".") needed for an executable
@ -158,32 +159,32 @@ public:
static bool RemoveADirectory(const char* source); static bool RemoveADirectory(const char* source);
///! Find a file in the system PATH, with optional extra paths. ///! Find a file in the system PATH, with optional extra paths.
static kwsys_std::string FindFile(const char* name, static kwsys_stl::string FindFile(const char* name,
const kwsys_std::vector<kwsys_std::string>& path= kwsys_std::vector<kwsys_std::string>()); const kwsys_stl::vector<kwsys_stl::string>& path= kwsys_stl::vector<kwsys_stl::string>());
///! Find an executable in the system PATH, with optional extra paths. ///! Find an executable in the system PATH, with optional extra paths.
static kwsys_std::string FindProgram(const char* name, static kwsys_stl::string FindProgram(const char* name,
const kwsys_std::vector<kwsys_std::string>& path = kwsys_std::vector<kwsys_std::string>(), const kwsys_stl::vector<kwsys_stl::string>& path = kwsys_stl::vector<kwsys_stl::string>(),
bool no_system_path = false); bool no_system_path = false);
///! Find a library in the system PATH, with optional extra paths. ///! Find a library in the system PATH, with optional extra paths.
static kwsys_std::string FindLibrary(const char* name, static kwsys_stl::string FindLibrary(const char* name,
const kwsys_std::vector<kwsys_std::string>& path); const kwsys_stl::vector<kwsys_stl::string>& path);
///! return true if the file is a directory. ///! return true if the file is a directory.
static bool FileIsDirectory(const char* name); static bool FileIsDirectory(const char* name);
static kwsys_std::string GetCurrentWorkingDirectory(); static kwsys_stl::string GetCurrentWorkingDirectory();
/** /**
* Given the path to a program executable, get the directory part of * Given the path to a program executable, get the directory part of
* the path with the file stripped off. If there is no directory * the path with the file stripped off. If there is no directory
* part, the empty string is returned. * part, the empty string is returned.
*/ */
static kwsys_std::string GetProgramPath(const char*); static kwsys_stl::string GetProgramPath(const char*);
static bool SplitProgramPath(const char* in_name, static bool SplitProgramPath(const char* in_name,
kwsys_std::string& dir, kwsys_stl::string& dir,
kwsys_std::string& file, kwsys_stl::string& file,
bool errorReport = true); bool errorReport = true);
/** /**
@ -192,32 +193,32 @@ public:
* (which defaults to the current working directory). The full path * (which defaults to the current working directory). The full path
* is returned. * is returned.
*/ */
static kwsys_std::string CollapseFullPath(const char* in_relative); static kwsys_stl::string CollapseFullPath(const char* in_relative);
static kwsys_std::string CollapseFullPath(const char* in_relative, static kwsys_stl::string CollapseFullPath(const char* in_relative,
const char* in_base); const char* in_base);
///! return path of a full filename (no trailing slashes). ///! return path of a full filename (no trailing slashes).
static kwsys_std::string GetFilenamePath(const kwsys_std::string&); static kwsys_stl::string GetFilenamePath(const kwsys_stl::string&);
///! return file name of a full filename (i.e. file name without path). ///! return file name of a full filename (i.e. file name without path).
static kwsys_std::string GetFilenameName(const kwsys_std::string&); static kwsys_stl::string GetFilenameName(const kwsys_stl::string&);
///! Split a program from its arguments and handle spaces in the paths. ///! Split a program from its arguments and handle spaces in the paths.
static void SplitProgramFromArgs(const char* path, static void SplitProgramFromArgs(const char* path,
kwsys_std::string& program, kwsys_std::string& args); kwsys_stl::string& program, kwsys_stl::string& args);
///! return longest file extension of a full filename (dot included). ///! return longest file extension of a full filename (dot included).
static kwsys_std::string GetFilenameExtension(const kwsys_std::string&); static kwsys_stl::string GetFilenameExtension(const kwsys_stl::string&);
///! return shortest file extension of a full filename (dot included). ///! return shortest file extension of a full filename (dot included).
static kwsys_std::string GetFilenameLastExtension(const kwsys_std::string& filename); static kwsys_stl::string GetFilenameLastExtension(const kwsys_stl::string& filename);
///! return file name without extension of a full filename. ///! return file name without extension of a full filename.
static kwsys_std::string GetFilenameWithoutExtension(const kwsys_std::string&); static kwsys_stl::string GetFilenameWithoutExtension(const kwsys_stl::string&);
///! return file name without its last (shortest) extension. ///! return file name without its last (shortest) extension.
static kwsys_std::string GetFilenameWithoutLastExtension(const kwsys_std::string&); static kwsys_stl::string GetFilenameWithoutLastExtension(const kwsys_stl::string&);
/** Return whether the path represents a full path (not relative). */ /** Return whether the path represents a full path (not relative). */
static bool FileIsFullPath(const char*); static bool FileIsFullPath(const char*);
@ -225,19 +226,19 @@ public:
static long int ModifiedTime(const char* filename); static long int ModifiedTime(const char* filename);
///! for windows return the short path for the given path, unix just a pass through ///! for windows return the short path for the given path, unix just a pass through
static bool GetShortPath(const char* path, kwsys_std::string& result); static bool GetShortPath(const char* path, kwsys_stl::string& result);
///! change directory the the directory specified ///! change directory the the directory specified
static int ChangeDirectory(const char* dir); static int ChangeDirectory(const char* dir);
/** Split a string on its newlines into multiple lines. Returns /** Split a string on its newlines into multiple lines. Returns
false only if the last line stored had no newline. */ false only if the last line stored had no newline. */
static bool Split(const char* s, kwsys_std::vector<kwsys_std::string>& l); static bool Split(const char* s, kwsys_stl::vector<kwsys_stl::string>& l);
static kwsys_std::string GetCurrentDateTime(const char* format); static kwsys_stl::string GetCurrentDateTime(const char* format);
/** Get the result of strerror(errno). */ /** Get the result of strerror(errno). */
static kwsys_std::string GetLastSystemError(); static kwsys_stl::string GetLastSystemError();
/** When building DEBUG with MSVC, this enables a hook that prevents /** When building DEBUG with MSVC, this enables a hook that prevents
* error dialogs from popping up if the program is being run from * error dialogs from popping up if the program is being run from
@ -252,7 +253,7 @@ public:
* end-of-file was reached. If the has_newline argument is specified, it will * end-of-file was reached. If the has_newline argument is specified, it will
* be true when the line read had a newline character. * be true when the line read had a newline character.
*/ */
static bool GetLineFromStream(kwsys_std::istream& istr, kwsys_std::string& line, static bool GetLineFromStream(kwsys_ios::istream& istr, kwsys_stl::string& line,
bool* has_newline=0); bool* has_newline=0);
protected: protected:
@ -261,7 +262,7 @@ protected:
* Convert the path to a string that can be used in a unix makefile. * Convert the path to a string that can be used in a unix makefile.
* double slashes are removed, and spaces are escaped. * double slashes are removed, and spaces are escaped.
*/ */
static kwsys_std::string ConvertToUnixOutputPath(const char*); static kwsys_stl::string ConvertToUnixOutputPath(const char*);
/** /**
* Convert the path to string that can be used in a windows project or * Convert the path to string that can be used in a windows project or
@ -269,14 +270,15 @@ protected:
* the string, the slashes are converted to windows style backslashes, and * the string, the slashes are converted to windows style backslashes, and
* if there are spaces in the string it is double quoted. * if there are spaces in the string it is double quoted.
*/ */
static kwsys_std::string ConvertToWindowsOutputPath(const char*); static kwsys_stl::string ConvertToWindowsOutputPath(const char*);
}; };
} // namespace @KWSYS_NAMESPACE@ } // namespace @KWSYS_NAMESPACE@
/* Undefine temporary macro. */ /* Undefine temporary macros. */
#if !defined (KWSYS_NAMESPACE) && !defined(@KWSYS_NAMESPACE@_NAME_IS_KWSYS) #if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
# undef kwsys_std # undef kwsys_stl
# undef kwsys_ios
#endif #endif
#endif #endif

View File

@ -0,0 +1,43 @@
MACRO(KWSYS_PLATFORM_CXX_TEST var description invert)
IF("${var}_COMPILED" MATCHES "^${var}_COMPILED$")
MESSAGE(STATUS "${description}")
TRY_COMPILE(${var}_COMPILED
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/kwsysPlatformCxxTests.cxx
COMPILE_DEFINITIONS -DTEST_${var}
OUTPUT_VARIABLE OUTPUT)
IF(${var}_COMPILED)
FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/CMakeOutput.log
"${description} compiled with the following output:\n${OUTPUT}\n\n")
ELSE(${var}_COMPILED)
FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/CMakeError.log
"${description} failed to compile with the following output:\n${OUTPUT}\n\n")
ENDIF(${var}_COMPILED)
IF(${invert} MATCHES INVERT)
IF(${var}_COMPILED)
MESSAGE(STATUS "${description} - no")
ELSE(${var}_COMPILED)
MESSAGE(STATUS "${description} - yes")
ENDIF(${var}_COMPILED)
ELSE(${invert} MATCHES INVERT)
IF(${var}_COMPILED)
MESSAGE(STATUS "${description} - yes")
ELSE(${var}_COMPILED)
MESSAGE(STATUS "${description} - no")
ENDIF(${var}_COMPILED)
ENDIF(${invert} MATCHES INVERT)
ENDIF("${var}_COMPILED" MATCHES "^${var}_COMPILED$")
IF(${invert} MATCHES INVERT)
IF(${var}_COMPILED)
SET(${var} 0)
ELSE(${var}_COMPILED)
SET(${var} 1)
ENDIF(${var}_COMPILED)
ELSE(${invert} MATCHES INVERT)
IF(${var}_COMPILED)
SET(${var} 1)
ELSE(${var}_COMPILED)
SET(${var} 0)
ENDIF(${var}_COMPILED)
ENDIF(${invert} MATCHES INVERT)
ENDMACRO(KWSYS_PLATFORM_CXX_TEST)

View File

@ -0,0 +1,31 @@
#ifdef TEST_KWSYS_STL_HAVE_STD
#include <list>
void f(std::list<int>*) {}
int main() { return 0; }
#endif
#ifdef TEST_KWSYS_IOS_HAVE_ANSI
#include <iosfwd>
int main() { return 0; }
#endif
#ifdef TEST_KWSYS_IOS_HAVE_STD
#include <iosfwd>
void f(std::ostream*) {}
int main() { return 0; }
#endif
#ifdef TEST_KWSYS_IOS_HAVE_SSTREAM
#include <sstream>
int main() { return 0; }
#endif
#ifdef TEST_KWSYS_IOS_HAVE_STRSTREAM_H
#include <strstream.h>
int main() { return 0; }
#endif
#ifdef TEST_KWSYS_IOS_HAVE_STRSTREA_H
#include <strstrea.h>
int main() { return 0; }
#endif

View File

@ -0,0 +1,47 @@
/*=========================================================================
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@_ios_fstream
#define @KWSYS_NAMESPACE@_ios_fstream
#include <@KWSYS_NAMESPACE@/Configure.hxx>
#ifdef _MSC_VER
#pragma warning (push, 1)
#pragma warning (disable: 4702)
#endif
#if @KWSYS_NAMESPACE@_IOS_HAVE_ANSI
# include <fstream>
#else
# include <fstream.h>
#endif
#if !@KWSYS_NAMESPACE@_IOS_HAVE_SSTREAM
namespace @KWSYS_NAMESPACE@_ios
{
using @KWSYS_NAMESPACE@_ios_namespace::ostream;
using @KWSYS_NAMESPACE@_ios_namespace::istream;
using @KWSYS_NAMESPACE@_ios_namespace::ofstream;
using @KWSYS_NAMESPACE@_ios_namespace::ifstream;
using @KWSYS_NAMESPACE@_ios_namespace::ios;
using @KWSYS_NAMESPACE@_ios_namespace::endl;
using @KWSYS_NAMESPACE@_ios_namespace::flush;
}
#endif
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif

View File

@ -0,0 +1,51 @@
/*=========================================================================
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@_ios_iosfwd
#define @KWSYS_NAMESPACE@_ios_iosfwd
#include <@KWSYS_NAMESPACE@/Configure.hxx>
#ifdef _MSC_VER
#pragma warning (push, 1)
#pragma warning (disable: 4702)
#endif
#if @KWSYS_NAMESPACE@_IOS_HAVE_ANSI
# include <iosfwd>
#else
class fstream;
class ifstream;
class ios;
class istream;
class ofstream;
class ostream;
#endif
#if !@KWSYS_NAMESPACE@_IOS_HAVE_SSTREAM
namespace @KWSYS_NAMESPACE@_ios
{
using @KWSYS_NAMESPACE@_ios_namespace::fstream;
using @KWSYS_NAMESPACE@_ios_namespace::ifstream;
using @KWSYS_NAMESPACE@_ios_namespace::ios;
using @KWSYS_NAMESPACE@_ios_namespace::istream;
using @KWSYS_NAMESPACE@_ios_namespace::ofstream;
using @KWSYS_NAMESPACE@_ios_namespace::ostream;
}
#endif
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif

View File

@ -0,0 +1,48 @@
/*=========================================================================
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@_ios_iostream
#define @KWSYS_NAMESPACE@_ios_iostream
#include <@KWSYS_NAMESPACE@/Configure.hxx>
#ifdef _MSC_VER
#pragma warning (push, 1)
#pragma warning (disable: 4702)
#endif
#if @KWSYS_NAMESPACE@_IOS_HAVE_ANSI
# include <iostream>
#else
# include <iostream.h>
#endif
#if !@KWSYS_NAMESPACE@_IOS_HAVE_SSTREAM
namespace @KWSYS_NAMESPACE@_ios
{
using @KWSYS_NAMESPACE@_ios_namespace::ostream;
using @KWSYS_NAMESPACE@_ios_namespace::istream;
using @KWSYS_NAMESPACE@_ios_namespace::ios;
using @KWSYS_NAMESPACE@_ios_namespace::cout;
using @KWSYS_NAMESPACE@_ios_namespace::cerr;
using @KWSYS_NAMESPACE@_ios_namespace::cin;
using @KWSYS_NAMESPACE@_ios_namespace::endl;
using @KWSYS_NAMESPACE@_ios_namespace::flush;
}
#endif
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif

View File

@ -0,0 +1,122 @@
/*=========================================================================
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@_ios_sstream
#define @KWSYS_NAMESPACE@_ios_sstream
#include <@KWSYS_NAMESPACE@/Configure.hxx>
/* Define this macro temporarily to keep the code readable. */
#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
# define kwsys_stl @KWSYS_NAMESPACE@_stl
#endif
#if @KWSYS_NAMESPACE@_IOS_HAVE_SSTREAM
# 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 @KWSYS_NAMESPACE@_IOS_HAVE_ANSI
# include <strstream>
# elif @KWSYS_NAMESPACE@_IOS_HAVE_STRSTREAM_H
# include <strstream.h>
# elif @KWSYS_NAMESPACE@_IOS_HAVE_STRSTREA_H
# include <strstrea.h>
# 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@/stl/string>
namespace @KWSYS_NAMESPACE@_ios
{
using @KWSYS_NAMESPACE@_ios_namespace::ostream;
using @KWSYS_NAMESPACE@_ios_namespace::istream;
using @KWSYS_NAMESPACE@_ios_namespace::istrstream;
using @KWSYS_NAMESPACE@_ios_namespace::ostrstream;
using @KWSYS_NAMESPACE@_ios_namespace::ios;
using @KWSYS_NAMESPACE@_ios_namespace::endl;
using @KWSYS_NAMESPACE@_ios_namespace::ends;
using @KWSYS_NAMESPACE@_ios_namespace::flush;
class ostringstream_cleanup
{
public:
ostringstream_cleanup(ostrstream& ostr): m_OStrStream(ostr) {}
~ostringstream_cleanup() { m_OStrStream.rdbuf()->freeze(0); }
static void IgnoreUnusedVariable(const ostringstream_cleanup&) {}
protected:
ostrstream& m_OStrStream;
};
class ostringstream: public ostrstream
{
public:
typedef ostrstream Superclass;
ostringstream() {}
kwsys_stl::string str()
{
ostringstream_cleanup cleanup(*this);
ostringstream_cleanup::IgnoreUnusedVariable(cleanup);
int pcount = this->pcount();
const char* ptr = this->Superclass::str();
return kwsys_stl::string(ptr?ptr:"", pcount);
}
private:
ostringstream(const ostringstream&);
void operator=(const ostringstream&);
};
class istringstream: private kwsys_stl::string, public istrstream
{
public:
typedef kwsys_stl::string StdString;
typedef istrstream IStrStream;
istringstream(): StdString(),
IStrStream(const_cast<char*>(StdString::c_str())) {}
istringstream(const kwsys_stl::string& s):
StdString(s), IStrStream(const_cast<char*>(StdString::c_str())) {}
kwsys_stl::string str() const { return *this; }
void str(const kwsys_stl::string& s)
{
this->~istringstream();
new (this) istringstream(s);
}
private:
istringstream(const istringstream&);
void operator=(const istringstream&);
};
} // namespace @KWSYS_NAMESPACE@_ios
#endif
/* Undefine temporary macro. */
#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
# undef kwsys_stl
#endif
#endif

View File

@ -1,31 +1 @@
/*========================================================================= /* Empty until make dependencies are updated. */
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@_std_@KWSYS_STL_HEADER@
#define @KWSYS_NAMESPACE@_std_@KWSYS_STL_HEADER@
#include <@KWSYS_NAMESPACE@/Configure.hxx>
#ifdef _MSC_VER
# pragma warning (push, 1)
# pragma warning (disable: 4702)
# pragma warning (disable: 4786)
#endif
#include <@KWSYS_STL_HEADER@>
#ifdef _MSC_VER
# pragma warning(pop)
#endif
#endif

View File

@ -1,46 +1 @@
/*========================================================================= /* Empty until make dependencies are updated. */
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@_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_NAMESPACE@_NO_ANSI_STREAM_HEADERS)
# include <fstream>
#else
# include <fstream.h>
# if !defined(@KWSYS_NAMESPACE@_NO_STD_NAMESPACE) && !defined(@KWSYS_NAMESPACE@_FAKE_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

View File

@ -1,50 +1 @@
/*========================================================================= /* Empty until make dependencies are updated. */
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@_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_NAMESPACE@_NO_ANSI_STREAM_HEADERS)
# include <iosfwd>
#else
class fstream;
class ifstream;
class ios;
class istream;
class ofstream;
class ostream;
# if !defined(@KWSYS_NAMESPACE@_NO_STD_NAMESPACE) && !defined(@KWSYS_NAMESPACE@_FAKE_STD_NAMESPACE)
namespace std
{
using ::fstream;
using ::ifstream;
using ::ios;
using ::istream;
using ::ofstream;
using ::ostream;
}
# endif
#endif
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif

View File

@ -1,47 +1 @@
/*========================================================================= /* Empty until make dependencies are updated. */
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@_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_NAMESPACE@_NO_ANSI_STREAM_HEADERS)
# include <iostream>
#else
# include <iostream.h>
# if !defined(@KWSYS_NAMESPACE@_NO_STD_NAMESPACE) && !defined(@KWSYS_NAMESPACE@_FAKE_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

View File

@ -1,130 +1 @@
/*========================================================================= /* Empty until make dependencies are updated. */
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@_std_sstream
#define @KWSYS_NAMESPACE@_std_sstream
#include <@KWSYS_NAMESPACE@/Configure.hxx>
/* Define this macro temporarily to keep the code readable. */
#if !defined (KWSYS_NAMESPACE) && !defined(@KWSYS_NAMESPACE@_NAME_IS_KWSYS)
# define kwsys_std @KWSYS_NAMESPACE@_std
#endif
#if !defined(@KWSYS_NAMESPACE@_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_NAMESPACE@_NO_ANSI_STREAM_HEADERS)
# include <strstream>
# else
# include <strstream.h>
# if !defined(@KWSYS_NAMESPACE@_NO_STD_NAMESPACE) && !defined(@KWSYS_NAMESPACE@_FAKE_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_NAMESPACE@_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_NAMESPACE@_NO_STD_NAMESPACE)
}
# endif
#endif
/* Undefine temporary macro. */
#if !defined (KWSYS_NAMESPACE) && !defined(@KWSYS_NAMESPACE@_NAME_IS_KWSYS)
# undef kwsys_std
#endif
#endif

View File

@ -0,0 +1,31 @@
/*=========================================================================
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@_stl_@KWSYS_STL_HEADER@
#define @KWSYS_NAMESPACE@_stl_@KWSYS_STL_HEADER@
#include <@KWSYS_NAMESPACE@/Configure.hxx>
#ifdef _MSC_VER
# pragma warning (push, 1)
# pragma warning (disable: 4702)
# pragma warning (disable: 4786)
#endif
#include <@KWSYS_STL_HEADER@>
#ifdef _MSC_VER
# pragma warning(pop)
#endif
#endif

View File

@ -13,7 +13,7 @@
=========================================================================*/ =========================================================================*/
#include <kwsys/Directory.hxx> #include <kwsys/Directory.hxx>
#include <kwsys/Process.h> #include <kwsys/Process.h>
#include <kwsys/std/iostream> #include <kwsys/ios/iostream>
int main() int main()
{ {
@ -26,9 +26,9 @@ int main()
int length = 0; int length = 0;
while(kwsysProcess_WaitForData(kp, &data, &length, 0)) while(kwsysProcess_WaitForData(kp, &data, &length, 0))
{ {
kwsys_std::cout.write(data, length); kwsys_ios::cout.write(data, length);
} }
kwsysProcess_Delete(kp); kwsysProcess_Delete(kp);
kwsys_std::cout << kwsys_std::endl; kwsys_ios::cout << kwsys_ios::endl;
return 0; return 0;
} }

11
Source/kwsys/testIOS.cxx Normal file
View File

@ -0,0 +1,11 @@
#include <kwsys/stl/vector>
#include <kwsys/ios/sstream>
#include <kwsys/ios/iostream>
int main()
{
kwsys_ios::ostringstream ostr;
ostr << "Hello, World!";
kwsys_ios::cout << ostr.str() << kwsys_ios::endl;
return 0;
}