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:
parent
0bdb092a01
commit
032d1d8652
|
@ -47,13 +47,13 @@
|
|||
# SET(KWSYS_LIBRARY_INSTALL_DIR /lib)
|
||||
# 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
|
||||
# by projects that cannot configure their
|
||||
# streams library.
|
||||
# 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:
|
||||
|
@ -109,36 +109,43 @@ ENDIF(CMAKE_ANSI_CFLAGS)
|
|||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Configure the standard library header wrappers based on compiler's
|
||||
# capabilities and parent project's request.
|
||||
INCLUDE(${CMAKE_ROOT}/Modules/CheckIncludeFileCXX.cmake)
|
||||
INCLUDE(${CMAKE_ROOT}/Modules/TestForSTDNamespace.cmake)
|
||||
CHECK_INCLUDE_FILE_CXX("sstream" CMAKE_HAS_ANSI_STRING_STREAM)
|
||||
CHECK_INCLUDE_FILE_CXX("iosfwd" CMAKE_ANSI_IOSFWD_HEADER)
|
||||
# capabilities and parent project's request. Enforce 0/1 as only
|
||||
# possible values for configuration into Configure.hxx.
|
||||
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/kwsysPlatformCxxTests.cmake)
|
||||
|
||||
# Enforce 0/1 as only possible values. Needed for the means by which
|
||||
# Configure.hxx is implemented.
|
||||
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)
|
||||
KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAVE_STD
|
||||
"Checking whether STL classes are in std namespace" DIRECT)
|
||||
|
||||
IF(CMAKE_ANSI_IOSFWD_HEADER)
|
||||
SET(CMAKE_NO_ANSI_STREAM_HEADERS 0)
|
||||
ELSE(CMAKE_ANSI_IOSFWD_HEADER)
|
||||
SET(CMAKE_NO_ANSI_STREAM_HEADERS 1)
|
||||
ENDIF(CMAKE_ANSI_IOSFWD_HEADER)
|
||||
IF(KWSYS_IOS_FORCE_OLD)
|
||||
SET(KWSYS_IOS_HAVE_ANSI 0)
|
||||
ELSE(KWSYS_IOS_FORCE_OLD)
|
||||
KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAVE_ANSI
|
||||
"Checking whether ANSI stream headers are available" DIRECT)
|
||||
ENDIF(KWSYS_IOS_FORCE_OLD)
|
||||
|
||||
IF(CMAKE_HAS_ANSI_STRING_STREAM)
|
||||
SET(CMAKE_NO_ANSI_STRING_STREAM 0)
|
||||
ELSE(CMAKE_HAS_ANSI_STRING_STREAM)
|
||||
SET(CMAKE_NO_ANSI_STRING_STREAM 1)
|
||||
ENDIF(CMAKE_HAS_ANSI_STRING_STREAM)
|
||||
IF(KWSYS_IOS_HAVE_ANSI)
|
||||
KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAVE_STD
|
||||
"Checking whether ANSI streams are in std namespace" DIRECT)
|
||||
KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAVE_SSTREAM
|
||||
"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)
|
||||
SET(CMAKE_NO_ANSI_STREAM_HEADERS 1)
|
||||
SET(CMAKE_NO_ANSI_STRING_STREAM 1)
|
||||
ENDIF(KWSYS_FORCE_OLD_STREAMS)
|
||||
IF(KWSYS_IOS_HAVE_SSTREAM)
|
||||
SET(KWSYS_IOS_HAVE_STRSTREAM_H 0)
|
||||
SET(KWSYS_IOS_HAVE_STRSTREA_H 0)
|
||||
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$")
|
||||
SET(KWSYS_NAME_IS_KWSYS 1)
|
||||
|
@ -146,12 +153,6 @@ ELSE(KWSYS_NAMESPACE MATCHES "^kwsys$")
|
|||
SET(KWSYS_NAME_IS_KWSYS 0)
|
||||
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.
|
||||
IF(KWSYS_BUILD_SHARED MATCHES "^KWSYS_BUILD_SHARED$")
|
||||
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)
|
||||
# Configure the header wrapper.
|
||||
SET(KWSYS_STL_HEADER "${header}")
|
||||
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/kwsys_std.h.in
|
||||
${KWSYS_HEADER_DIR}/std/${header}
|
||||
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/kwsys_stl.h.in
|
||||
${KWSYS_HEADER_DIR}/stl/${header}
|
||||
@ONLY IMMEDIATE)
|
||||
|
||||
# Create an install target for the header wrapper.
|
||||
IF(KWSYS_HEADER_INSTALL_DIR)
|
||||
INSTALL_FILES(${KWSYS_HEADER_INSTALL_DIR}/${KWSYS_NAMESPACE}/std
|
||||
FILES ${KWSYS_HEADER_DIR}/std/${header})
|
||||
INSTALL_FILES(${KWSYS_HEADER_INSTALL_DIR}/${KWSYS_NAMESPACE}/stl
|
||||
FILES ${KWSYS_HEADER_DIR}/stl/${header})
|
||||
ENDIF(KWSYS_HEADER_INSTALL_DIR)
|
||||
ENDFOREACH(header)
|
||||
|
||||
|
@ -195,14 +196,14 @@ ENDFOREACH(header)
|
|||
# may be included.
|
||||
FOREACH(header iostream fstream sstream iosfwd)
|
||||
# Configure the header wrapper.
|
||||
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/kwsys_std_${header}.h.in
|
||||
${KWSYS_HEADER_DIR}/std/${header}
|
||||
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/kwsys_ios_${header}.h.in
|
||||
${KWSYS_HEADER_DIR}/ios/${header}
|
||||
@ONLY IMMEDIATE)
|
||||
|
||||
# Create an install target for the header wrapper.
|
||||
IF(KWSYS_HEADER_INSTALL_DIR)
|
||||
INSTALL_FILES(${KWSYS_HEADER_INSTALL_DIR}/${KWSYS_NAMESPACE}/std
|
||||
FILES ${KWSYS_HEADER_DIR}/std/${header})
|
||||
INSTALL_FILES(${KWSYS_HEADER_INSTALL_DIR}/${KWSYS_NAMESPACE}/ios
|
||||
FILES ${KWSYS_HEADER_DIR}/ios/${header})
|
||||
ENDIF(KWSYS_HEADER_INSTALL_DIR)
|
||||
ENDFOREACH(header)
|
||||
|
||||
|
@ -366,8 +367,10 @@ ENDIF(KWSYS_USE_Process)
|
|||
# Setup testing if not being built as part of another project.
|
||||
IF(KWSYS_STANDALONE)
|
||||
INCLUDE_DIRECTORIES(${KWSYS_HEADER_ROOT})
|
||||
ADD_EXECUTABLE(testIOS testIOS.cxx)
|
||||
ADD_EXECUTABLE(testProcess testProcess.c)
|
||||
ADD_EXECUTABLE(test1 test1.cxx)
|
||||
TARGET_LINK_LIBRARIES(testIOS ${KWSYS_NAMESPACE})
|
||||
TARGET_LINK_LIBRARIES(testProcess ${KWSYS_NAMESPACE})
|
||||
TARGET_LINK_LIBRARIES(test1 ${KWSYS_NAMESPACE})
|
||||
ENDIF(KWSYS_STANDALONE)
|
||||
|
|
|
@ -14,53 +14,60 @@
|
|||
#ifndef @KWSYS_NAMESPACE@_Configure_hxx
|
||||
#define @KWSYS_NAMESPACE@_Configure_hxx
|
||||
|
||||
/* Defined if kwsys namespace is "kwsys". */
|
||||
#if @KWSYS_NAME_IS_KWSYS@
|
||||
# define @KWSYS_NAMESPACE@_NAME_IS_KWSYS
|
||||
#endif
|
||||
/* Whether kwsys namespace is "kwsys". */
|
||||
#define @KWSYS_NAMESPACE@_NAME_IS_KWSYS @KWSYS_NAME_IS_KWSYS@
|
||||
|
||||
/* Defined if no ANSI C++ stream headers are present. */
|
||||
#if @KWSYS_NO_ANSI_STREAM_HEADERS@
|
||||
# define @KWSYS_NAMESPACE@_NO_ANSI_STREAM_HEADERS
|
||||
#endif
|
||||
/* Whether ANSI C++ stream headers are to be used. */
|
||||
#define @KWSYS_NAMESPACE@_IOS_HAVE_ANSI @KWSYS_IOS_HAVE_ANSI@
|
||||
|
||||
/* Defined if no ANSI C++ <sstream> header is present. */
|
||||
#if @KWSYS_NO_ANSI_STRING_STREAM@
|
||||
# define @KWSYS_NAMESPACE@_NO_ANSI_STRING_STREAM
|
||||
#endif
|
||||
/* Whether ANSI C++ streams are in std namespace. */
|
||||
#define @KWSYS_NAMESPACE@_IOS_HAVE_STD @KWSYS_IOS_HAVE_STD@
|
||||
|
||||
/* Defined if no std namespace is present. */
|
||||
#if @KWSYS_NO_STD_NAMESPACE@
|
||||
# define @KWSYS_NAMESPACE@_NO_STD_NAMESPACE
|
||||
#endif
|
||||
/* Whether ANSI C++ <sstream> header is to be used. */
|
||||
#define @KWSYS_NAMESPACE@_IOS_HAVE_SSTREAM @KWSYS_IOS_HAVE_SSTREAM@
|
||||
|
||||
/* Defined if std namespace is the GCC hack. */
|
||||
#if defined(__GNUC__) && (__GNUC__ < 3)
|
||||
# define @KWSYS_NAMESPACE@_FAKE_STD_NAMESPACE
|
||||
#endif
|
||||
/* Whether old C++ <strstream.h> header is to be used. */
|
||||
#define @KWSYS_NAMESPACE@_IOS_HAVE_STRSTREAM_H @KWSYS_IOS_HAVE_STRSTREAM_H@
|
||||
|
||||
/* Define the std namespace macro. */
|
||||
#if defined(@KWSYS_NAMESPACE@_NO_STD_NAMESPACE)
|
||||
# define @KWSYS_NAMESPACE@_std
|
||||
/* Whether old C++ <strstrea.h> header is to be used. */
|
||||
#define @KWSYS_NAMESPACE@_IOS_HAVE_STRSTREA_H @KWSYS_IOS_HAVE_STRSTREA_H@
|
||||
|
||||
/* 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
|
||||
# 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
|
||||
|
||||
/* If building a C++ file in kwsys itself, give the source file
|
||||
access to the macros without a configured namespace. */
|
||||
#if defined(KWSYS_NAMESPACE)
|
||||
# if !defined(@KWSYS_NAMESPACE@_NAME_IS_KWSYS)
|
||||
# define kwsys_std @KWSYS_NAMESPACE@_std
|
||||
# endif
|
||||
# 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
|
||||
# if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
|
||||
# define kwsys_stl @KWSYS_NAMESPACE@_stl
|
||||
# define kwsys_ios @KWSYS_NAMESPACE@_ios
|
||||
# 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
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
|
||||
#include KWSYS_HEADER(Configure.hxx)
|
||||
|
||||
#include KWSYS_HEADER(std/string)
|
||||
#include KWSYS_HEADER(std/vector)
|
||||
#include KWSYS_HEADER(stl/string)
|
||||
#include KWSYS_HEADER(stl/vector)
|
||||
|
||||
namespace KWSYS_NAMESPACE
|
||||
{
|
||||
|
@ -27,10 +27,10 @@ class DirectoryInternals
|
|||
{
|
||||
public:
|
||||
// Array of Files
|
||||
kwsys_std::vector<kwsys_std::string> Files;
|
||||
kwsys_stl::vector<kwsys_stl::string> Files;
|
||||
|
||||
// Path to Open'ed directory
|
||||
kwsys_std::string Path;
|
||||
kwsys_stl::string Path;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
|
|
@ -840,7 +840,7 @@ void regdump ();
|
|||
static char* regprop ();
|
||||
#endif
|
||||
|
||||
bool RegularExpression::find (kwsys_std::string const& s)
|
||||
bool RegularExpression::find (kwsys_stl::string const& s)
|
||||
{
|
||||
return find(s.c_str());
|
||||
}
|
||||
|
|
|
@ -35,11 +35,11 @@
|
|||
#include <@KWSYS_NAMESPACE@/Configure.h>
|
||||
#include <@KWSYS_NAMESPACE@/Configure.hxx>
|
||||
|
||||
#include <@KWSYS_NAMESPACE@/std/string>
|
||||
#include <@KWSYS_NAMESPACE@/stl/string>
|
||||
|
||||
/* 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
|
||||
#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
|
||||
# define kwsys_stl @KWSYS_NAMESPACE@_stl
|
||||
#endif
|
||||
|
||||
namespace @KWSYS_NAMESPACE@
|
||||
|
@ -221,17 +221,17 @@ public:
|
|||
* Matches the regular expression to the given std string.
|
||||
* 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.
|
||||
*/
|
||||
inline kwsys_std::string::size_type start() const;
|
||||
inline kwsys_stl::string::size_type start() const;
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
@ -265,9 +265,9 @@ public:
|
|||
* Destructor.
|
||||
*/
|
||||
// awf added
|
||||
kwsys_std::string::size_type start(int n) const;
|
||||
kwsys_std::string::size_type end(int n) const;
|
||||
kwsys_std::string match(int n) const;
|
||||
kwsys_stl::string::size_type start(int n) const;
|
||||
kwsys_stl::string::size_type end(int n) const;
|
||||
kwsys_stl::string match(int n) const;
|
||||
|
||||
enum { NSUBEXP = 10 };
|
||||
private:
|
||||
|
@ -316,7 +316,7 @@ inline RegularExpression::~RegularExpression ()
|
|||
/**
|
||||
* 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);
|
||||
}
|
||||
|
@ -325,7 +325,7 @@ inline kwsys_std::string::size_type RegularExpression::start () const
|
|||
/**
|
||||
* 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);
|
||||
}
|
||||
|
@ -360,7 +360,7 @@ inline void RegularExpression::set_invalid ()
|
|||
/**
|
||||
* 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;
|
||||
}
|
||||
|
@ -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.
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
@ -377,16 +377,16 @@ inline kwsys_std::string::size_type RegularExpression::end(int n) const
|
|||
/**
|
||||
* 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@
|
||||
|
||||
/* Undefine temporary macro. */
|
||||
#if !defined (KWSYS_NAMESPACE) && !defined(@KWSYS_NAMESPACE@_NAME_IS_KWSYS)
|
||||
# undef kwsys_std
|
||||
#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
|
||||
# undef kwsys_stl
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
#include KWSYS_HEADER(SystemTools.hxx)
|
||||
#include KWSYS_HEADER(Directory.hxx)
|
||||
|
||||
#include KWSYS_HEADER(std/iostream)
|
||||
#include KWSYS_HEADER(std/fstream)
|
||||
#include KWSYS_HEADER(ios/iostream)
|
||||
#include KWSYS_HEADER(ios/fstream)
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning (disable: 4786)
|
||||
|
@ -155,25 +155,25 @@ SystemTools::GetTime(void)
|
|||
}
|
||||
|
||||
// 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__)
|
||||
const char* pathSep = ";";
|
||||
#else
|
||||
const char* pathSep = ":";
|
||||
#endif
|
||||
kwsys_std::string pathEnv = getenv("PATH");
|
||||
kwsys_stl::string pathEnv = getenv("PATH");
|
||||
// A hack to make the below algorithm work.
|
||||
if(pathEnv[pathEnv.length()-1] != ':')
|
||||
{
|
||||
pathEnv += pathSep;
|
||||
}
|
||||
kwsys_std::string::size_type start =0;
|
||||
kwsys_stl::string::size_type start =0;
|
||||
bool done = false;
|
||||
while(!done)
|
||||
{
|
||||
kwsys_std::string::size_type endpos = pathEnv.find(pathSep, start);
|
||||
if(endpos != kwsys_std::string::npos)
|
||||
kwsys_stl::string::size_type endpos = pathEnv.find(pathSep, start);
|
||||
if(endpos != kwsys_stl::string::npos)
|
||||
{
|
||||
path.push_back(pathEnv.substr(start, endpos-start));
|
||||
start = endpos+1;
|
||||
|
@ -183,7 +183,7 @@ void SystemTools::GetPath(kwsys_std::vector<kwsys_std::string>& path)
|
|||
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)
|
||||
{
|
||||
SystemTools::ConvertToUnixSlashes(*i);
|
||||
|
@ -195,7 +195,7 @@ const char* SystemTools::GetEnv(const char* 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);
|
||||
if(v)
|
||||
|
@ -225,20 +225,20 @@ bool SystemTools::MakeDirectory(const char* path)
|
|||
{
|
||||
return true;
|
||||
}
|
||||
kwsys_std::string dir = path;
|
||||
kwsys_stl::string dir = path;
|
||||
if(dir.size() == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
SystemTools::ConvertToUnixSlashes(dir);
|
||||
|
||||
kwsys_std::string::size_type pos = dir.find(':');
|
||||
if(pos == kwsys_std::string::npos)
|
||||
kwsys_stl::string::size_type pos = dir.find(':');
|
||||
if(pos == kwsys_stl::string::npos)
|
||||
{
|
||||
pos = 0;
|
||||
}
|
||||
kwsys_std::string topdir;
|
||||
while((pos = dir.find('/', pos)) != kwsys_std::string::npos)
|
||||
kwsys_stl::string topdir;
|
||||
while((pos = dir.find('/', pos)) != kwsys_stl::string::npos)
|
||||
{
|
||||
topdir = dir.substr(0, pos);
|
||||
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.
|
||||
// write the result into source.
|
||||
void SystemTools::ReplaceString(kwsys_std::string& source,
|
||||
void SystemTools::ReplaceString(kwsys_stl::string& source,
|
||||
const char* replace,
|
||||
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
|
||||
|
||||
#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_std::string second;
|
||||
kwsys_std::string valuename;
|
||||
kwsys_stl::string primary = key;
|
||||
kwsys_stl::string second;
|
||||
kwsys_stl::string valuename;
|
||||
|
||||
size_t start = primary.find("\\");
|
||||
if (start == kwsys_std::string::npos)
|
||||
if (start == kwsys_stl::string::npos)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t valuenamepos = primary.find(";");
|
||||
if (valuenamepos != kwsys_std::string::npos)
|
||||
if (valuenamepos != kwsys_stl::string::npos)
|
||||
{
|
||||
valuename = primary.substr(valuenamepos+1);
|
||||
}
|
||||
|
@ -393,7 +393,7 @@ bool SystemTools::ReadRegistryValue(const char *key, kwsys_std::string &value)
|
|||
return false;
|
||||
}
|
||||
#else
|
||||
bool SystemTools::ReadRegistryValue(const char *, kwsys_std::string &)
|
||||
bool SystemTools::ReadRegistryValue(const char *, kwsys_stl::string &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -410,18 +410,18 @@ bool SystemTools::ReadRegistryValue(const char *, kwsys_std::string &)
|
|||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
bool SystemTools::WriteRegistryValue(const char *key, const char *value)
|
||||
{
|
||||
kwsys_std::string primary = key;
|
||||
kwsys_std::string second;
|
||||
kwsys_std::string valuename;
|
||||
kwsys_stl::string primary = key;
|
||||
kwsys_stl::string second;
|
||||
kwsys_stl::string valuename;
|
||||
|
||||
size_t start = primary.find("\\");
|
||||
if (start == kwsys_std::string::npos)
|
||||
if (start == kwsys_stl::string::npos)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t valuenamepos = primary.find(";");
|
||||
if (valuenamepos != kwsys_std::string::npos)
|
||||
if (valuenamepos != kwsys_stl::string::npos)
|
||||
{
|
||||
valuename = primary.substr(valuenamepos+1);
|
||||
}
|
||||
|
@ -494,18 +494,18 @@ bool SystemTools::WriteRegistryValue(const char *, const char *)
|
|||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
bool SystemTools::DeleteRegistryValue(const char *key)
|
||||
{
|
||||
kwsys_std::string primary = key;
|
||||
kwsys_std::string second;
|
||||
kwsys_std::string valuename;
|
||||
kwsys_stl::string primary = key;
|
||||
kwsys_stl::string second;
|
||||
kwsys_stl::string valuename;
|
||||
|
||||
size_t start = primary.find("\\");
|
||||
if (start == kwsys_std::string::npos)
|
||||
if (start == kwsys_stl::string::npos)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t valuenamepos = primary.find(";");
|
||||
if (valuenamepos != kwsys_std::string::npos)
|
||||
if (valuenamepos != kwsys_stl::string::npos)
|
||||
{
|
||||
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
|
||||
// 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[0] = toupper(s[0]);
|
||||
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
|
||||
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());
|
||||
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
|
||||
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());
|
||||
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
|
||||
void SystemTools::ConvertToUnixSlashes(kwsys_std::string& path)
|
||||
void SystemTools::ConvertToUnixSlashes(kwsys_stl::string& path)
|
||||
{
|
||||
kwsys_std::string::size_type pos = 0;
|
||||
while((pos = path.find('\\', pos)) != kwsys_std::string::npos)
|
||||
kwsys_stl::string::size_type pos = 0;
|
||||
while((pos = path.find('\\', pos)) != kwsys_stl::string::npos)
|
||||
{
|
||||
path[pos] = '/';
|
||||
pos++;
|
||||
|
@ -696,7 +696,7 @@ void SystemTools::ConvertToUnixSlashes(kwsys_std::string& path)
|
|||
start_find = 1;
|
||||
#endif
|
||||
|
||||
while((pos = path.find("//", start_find)) != kwsys_std::string::npos)
|
||||
while((pos = path.find("//", start_find)) != kwsys_stl::string::npos)
|
||||
{
|
||||
SystemTools::ReplaceString(path, "//", "/");
|
||||
}
|
||||
|
@ -712,7 +712,7 @@ void SystemTools::ConvertToUnixSlashes(kwsys_std::string& path)
|
|||
{
|
||||
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
|
||||
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
|
||||
kwsys_std::string::size_type pos = 1;
|
||||
while((pos = ret.find("//", pos)) != kwsys_std::string::npos)
|
||||
kwsys_stl::string::size_type pos = 1;
|
||||
while((pos = ret.find("//", pos)) != kwsys_stl::string::npos)
|
||||
{
|
||||
ret.erase(pos, 1);
|
||||
}
|
||||
// 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;
|
||||
for(const char* ch = ret.c_str(); *ch != '\0'; ++ch)
|
||||
{
|
||||
|
@ -754,7 +754,7 @@ kwsys_std::string SystemTools::ConvertToUnixOutputPath(const char* path)
|
|||
return ret;
|
||||
}
|
||||
|
||||
kwsys_std::string SystemTools::ConvertToOutputPath(const char* path)
|
||||
kwsys_stl::string SystemTools::ConvertToOutputPath(const char* path)
|
||||
{
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
return SystemTools::ConvertToWindowsOutputPath(path);
|
||||
|
@ -764,12 +764,12 @@ kwsys_std::string SystemTools::ConvertToOutputPath(const char* path)
|
|||
}
|
||||
|
||||
// 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_std::string::size_type pos = 0;
|
||||
kwsys_stl::string ret = path;
|
||||
kwsys_stl::string::size_type pos = 0;
|
||||
// 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] = '\\';
|
||||
pos++;
|
||||
|
@ -791,16 +791,16 @@ kwsys_std::string SystemTools::ConvertToWindowsOutputPath(const char* path)
|
|||
return ret;
|
||||
}
|
||||
}
|
||||
while((pos = ret.find("\\\\", pos)) != kwsys_std::string::npos)
|
||||
while((pos = ret.find("\\\\", pos)) != kwsys_stl::string::npos)
|
||||
{
|
||||
ret.erase(pos, 1);
|
||||
}
|
||||
// now double quote the path if it has spaces in it
|
||||
// and is not already double quoted
|
||||
if(ret.find(" ") != kwsys_std::string::npos
|
||||
if(ret.find(" ") != kwsys_stl::string::npos
|
||||
&& ret[0] != '\"')
|
||||
{
|
||||
kwsys_std::string result;
|
||||
kwsys_stl::string result;
|
||||
result = "\"" + ret + "\"";
|
||||
ret = result;
|
||||
}
|
||||
|
@ -845,13 +845,13 @@ bool SystemTools::FilesDiffer(const char* source,
|
|||
}
|
||||
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
kwsys_std::ifstream finSource(source, (kwsys_std::ios::binary |
|
||||
kwsys_std::ios::in));
|
||||
kwsys_std::ifstream finDestination(destination, (kwsys_std::ios::binary |
|
||||
kwsys_std::ios::in));
|
||||
kwsys_ios::ifstream finSource(source, (kwsys_ios::ios::binary |
|
||||
kwsys_ios::ios::in));
|
||||
kwsys_ios::ifstream finDestination(destination, (kwsys_ios::ios::binary |
|
||||
kwsys_ios::ios::in));
|
||||
#else
|
||||
kwsys_std::ifstream finSource(source);
|
||||
kwsys_std::ifstream finDestination(destination);
|
||||
kwsys_ios::ifstream finSource(source);
|
||||
kwsys_ios::ifstream finDestination(destination);
|
||||
#endif
|
||||
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
|
||||
// name as the source in that directory.
|
||||
|
||||
kwsys_std::string new_destination;
|
||||
kwsys_stl::string new_destination;
|
||||
if(SystemTools::FileExists(destination) &&
|
||||
SystemTools::FileIsDirectory(destination))
|
||||
{
|
||||
new_destination = destination;
|
||||
SystemTools::ConvertToUnixSlashes(new_destination);
|
||||
new_destination += '/';
|
||||
kwsys_std::string source_name = source;
|
||||
kwsys_stl::string source_name = source;
|
||||
new_destination += SystemTools::GetFilenameName(source_name);
|
||||
destination = new_destination.c_str();
|
||||
}
|
||||
|
||||
// Create destination directory
|
||||
|
||||
kwsys_std::string destination_dir = destination;
|
||||
kwsys_stl::string destination_dir = destination;
|
||||
destination_dir = SystemTools::GetFilenamePath(destination_dir);
|
||||
SystemTools::MakeDirectory(destination_dir.c_str());
|
||||
|
||||
// Open files
|
||||
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
kwsys_std::ifstream fin(source,
|
||||
kwsys_std::ios::binary | kwsys_std::ios::in);
|
||||
kwsys_ios::ifstream fin(source,
|
||||
kwsys_ios::ios::binary | kwsys_ios::ios::in);
|
||||
#else
|
||||
kwsys_std::ifstream fin(source);
|
||||
kwsys_ios::ifstream fin(source);
|
||||
#endif
|
||||
if(!fin)
|
||||
{
|
||||
|
@ -926,11 +926,11 @@ bool SystemTools::CopyFileAlways(const char* source, const char* destination)
|
|||
}
|
||||
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
kwsys_std::ofstream fout(destination,
|
||||
kwsys_std::ios::binary | kwsys_std::ios::out | kwsys_std::ios::trunc);
|
||||
kwsys_ios::ofstream fout(destination,
|
||||
kwsys_ios::ios::binary | kwsys_ios::ios::out | kwsys_ios::ios::trunc);
|
||||
#else
|
||||
kwsys_std::ofstream fout(destination,
|
||||
kwsys_std::ios::out | kwsys_std::ios::trunc);
|
||||
kwsys_ios::ofstream fout(destination,
|
||||
kwsys_ios::ios::out | kwsys_ios::ios::trunc);
|
||||
#endif
|
||||
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;
|
||||
return strerror(e);
|
||||
|
@ -1042,7 +1042,7 @@ bool SystemTools::RemoveADirectory(const char* source)
|
|||
if (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 += dir.GetFile(static_cast<unsigned long>(fileNum));
|
||||
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
|
||||
* found. Otherwise, the empty string is returned.
|
||||
*/
|
||||
kwsys_std::string SystemTools::FindFile(const char* name,
|
||||
const kwsys_std::vector<kwsys_std::string>& userPaths)
|
||||
kwsys_stl::string SystemTools::FindFile(const char* name,
|
||||
const kwsys_stl::vector<kwsys_stl::string>& userPaths)
|
||||
{
|
||||
// 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);
|
||||
// now add the additional paths
|
||||
path.insert(path.end(), userPaths.begin(), userPaths.end());
|
||||
// now look for the file
|
||||
kwsys_std::string tryPath;
|
||||
for(kwsys_std::vector<kwsys_std::string>::const_iterator p = path.begin();
|
||||
kwsys_stl::string tryPath;
|
||||
for(kwsys_stl::vector<kwsys_stl::string>::const_iterator p = path.begin();
|
||||
p != path.end(); ++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
|
||||
* found. Otherwise, the empty string is returned.
|
||||
*/
|
||||
kwsys_std::string SystemTools::FindProgram(
|
||||
kwsys_stl::string SystemTools::FindProgram(
|
||||
const char* name,
|
||||
const kwsys_std::vector<kwsys_std::string>& userPaths,
|
||||
const kwsys_stl::vector<kwsys_stl::string>& userPaths,
|
||||
bool no_system_path)
|
||||
{
|
||||
if(!name)
|
||||
|
@ -1116,7 +1116,7 @@ kwsys_std::string SystemTools::FindProgram(
|
|||
{
|
||||
return SystemTools::CollapseFullPath(name);
|
||||
}
|
||||
kwsys_std::string tryPath = name;
|
||||
kwsys_stl::string tryPath = name;
|
||||
tryPath += SystemTools::GetExecutableExtension();
|
||||
if(SystemTools::FileExists(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.
|
||||
kwsys_std::vector<kwsys_std::string> path;
|
||||
kwsys_stl::vector<kwsys_stl::string> path;
|
||||
if (!no_system_path)
|
||||
{
|
||||
SystemTools::GetPath(path);
|
||||
|
@ -1133,7 +1133,7 @@ kwsys_std::string SystemTools::FindProgram(
|
|||
// now add the additional paths
|
||||
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)
|
||||
{
|
||||
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
|
||||
* found. Otherwise, the empty string is returned.
|
||||
*/
|
||||
kwsys_std::string SystemTools::FindLibrary(const char* name,
|
||||
const kwsys_std::vector<kwsys_std::string>& userPaths)
|
||||
kwsys_stl::string SystemTools::FindLibrary(const char* name,
|
||||
const kwsys_stl::vector<kwsys_stl::string>& userPaths)
|
||||
{
|
||||
// See if the executable exists as written.
|
||||
if(SystemTools::FileExists(name) &&
|
||||
|
@ -1184,12 +1184,12 @@ kwsys_std::string SystemTools::FindLibrary(const char* name,
|
|||
}
|
||||
|
||||
// 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);
|
||||
// now add the additional paths
|
||||
path.insert(path.end(), userPaths.begin(), userPaths.end());
|
||||
kwsys_std::string tryPath;
|
||||
for(kwsys_std::vector<kwsys_std::string>::const_iterator p = path.begin();
|
||||
kwsys_stl::string tryPath;
|
||||
for(kwsys_stl::vector<kwsys_stl::string>::const_iterator p = path.begin();
|
||||
p != path.end(); ++p)
|
||||
{
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
|
@ -1263,23 +1263,23 @@ int SystemTools::ChangeDirectory(const char *dir)
|
|||
return Chdir(dir);
|
||||
}
|
||||
|
||||
kwsys_std::string SystemTools::GetCurrentWorkingDirectory()
|
||||
kwsys_stl::string SystemTools::GetCurrentWorkingDirectory()
|
||||
{
|
||||
char buf[2048];
|
||||
kwsys_std::string path = Getcwd(buf, 2048);
|
||||
kwsys_stl::string path = Getcwd(buf, 2048);
|
||||
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);
|
||||
return dir;
|
||||
}
|
||||
|
||||
bool SystemTools::SplitProgramPath(const char* in_name,
|
||||
kwsys_std::string& dir,
|
||||
kwsys_std::string& file,
|
||||
kwsys_stl::string& dir,
|
||||
kwsys_stl::string& file,
|
||||
bool)
|
||||
{
|
||||
dir = in_name;
|
||||
|
@ -1288,8 +1288,8 @@ bool SystemTools::SplitProgramPath(const char* in_name,
|
|||
|
||||
if(!SystemTools::FileIsDirectory(dir.c_str()))
|
||||
{
|
||||
kwsys_std::string::size_type slashPos = dir.rfind("/");
|
||||
if(slashPos != kwsys_std::string::npos)
|
||||
kwsys_stl::string::size_type slashPos = dir.rfind("/");
|
||||
if(slashPos != kwsys_stl::string::npos)
|
||||
{
|
||||
file = dir.substr(slashPos+1);
|
||||
dir = dir.substr(0, slashPos);
|
||||
|
@ -1302,7 +1302,7 @@ bool SystemTools::SplitProgramPath(const char* in_name,
|
|||
}
|
||||
if(!(dir == "") && !SystemTools::FileIsDirectory(dir.c_str()))
|
||||
{
|
||||
kwsys_std::string oldDir = in_name;
|
||||
kwsys_stl::string oldDir = in_name;
|
||||
SystemTools::ConvertToUnixSlashes(oldDir);
|
||||
dir = in_name;
|
||||
return false;
|
||||
|
@ -1310,19 +1310,19 @@ bool SystemTools::SplitProgramPath(const char* in_name,
|
|||
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);
|
||||
}
|
||||
|
||||
kwsys_std::string SystemTools::CollapseFullPath(const char* in_relative,
|
||||
kwsys_stl::string SystemTools::CollapseFullPath(const char* in_relative,
|
||||
const char* in_base)
|
||||
{
|
||||
kwsys_std::string dir, file;
|
||||
kwsys_stl::string dir, file;
|
||||
SystemTools::SplitProgramPath(in_relative, dir, file, false);
|
||||
|
||||
// Save original working directory.
|
||||
kwsys_std::string orig = SystemTools::GetCurrentWorkingDirectory();
|
||||
kwsys_stl::string orig = SystemTools::GetCurrentWorkingDirectory();
|
||||
|
||||
// Change to base of relative path.
|
||||
if(in_base)
|
||||
|
@ -1338,7 +1338,7 @@ kwsys_std::string SystemTools::CollapseFullPath(const char* in_relative,
|
|||
}
|
||||
|
||||
// Get the resulting directory.
|
||||
kwsys_std::string newDir = SystemTools::GetCurrentWorkingDirectory();
|
||||
kwsys_stl::string newDir = SystemTools::GetCurrentWorkingDirectory();
|
||||
|
||||
// Add the file back on to the directory.
|
||||
SystemTools::ConvertToUnixSlashes(newDir);
|
||||
|
@ -1354,7 +1354,7 @@ kwsys_std::string SystemTools::CollapseFullPath(const char* in_relative,
|
|||
# endif
|
||||
|
||||
// Resolve relative path.
|
||||
kwsys_std::string newDir;
|
||||
kwsys_stl::string newDir;
|
||||
if(!(dir == ""))
|
||||
{
|
||||
realpath(dir.c_str(), resolved_name);
|
||||
|
@ -1375,7 +1375,7 @@ kwsys_std::string SystemTools::CollapseFullPath(const char* in_relative,
|
|||
Chdir(orig.c_str());
|
||||
|
||||
// Construct and return the full path.
|
||||
kwsys_std::string newPath = newDir;
|
||||
kwsys_stl::string newPath = newDir;
|
||||
if(!(file == ""))
|
||||
{
|
||||
newPath += "/";
|
||||
|
@ -1384,14 +1384,14 @@ kwsys_std::string SystemTools::CollapseFullPath(const char* in_relative,
|
|||
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_std::string::size_type lpos = 0;
|
||||
kwsys_stl::string data(str);
|
||||
kwsys_stl::string::size_type lpos = 0;
|
||||
while(lpos < data.length())
|
||||
{
|
||||
kwsys_std::string::size_type rpos = data.find_first_of("\n", lpos);
|
||||
if(rpos == kwsys_std::string::npos)
|
||||
kwsys_stl::string::size_type rpos = data.find_first_of("\n", lpos);
|
||||
if(rpos == kwsys_stl::string::npos)
|
||||
{
|
||||
// Line ends at end of string without a newline.
|
||||
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).
|
||||
* 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);
|
||||
|
||||
kwsys_std::string::size_type slash_pos = fn.rfind("/");
|
||||
if(slash_pos != kwsys_std::string::npos)
|
||||
kwsys_stl::string::size_type slash_pos = fn.rfind("/");
|
||||
if(slash_pos != kwsys_stl::string::npos)
|
||||
{
|
||||
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).
|
||||
*/
|
||||
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);
|
||||
|
||||
kwsys_std::string::size_type slash_pos = fn.rfind("/");
|
||||
if(slash_pos != kwsys_std::string::npos)
|
||||
kwsys_stl::string::size_type slash_pos = fn.rfind("/");
|
||||
if(slash_pos != kwsys_stl::string::npos)
|
||||
{
|
||||
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).
|
||||
* 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_std::string::size_type dot_pos = name.find(".");
|
||||
if(dot_pos != kwsys_std::string::npos)
|
||||
kwsys_stl::string name = SystemTools::GetFilenameName(filename);
|
||||
kwsys_stl::string::size_type dot_pos = name.find(".");
|
||||
if(dot_pos != kwsys_stl::string::npos)
|
||||
{
|
||||
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).
|
||||
* 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_std::string::size_type dot_pos = name.rfind(".");
|
||||
if(dot_pos != kwsys_std::string::npos)
|
||||
kwsys_stl::string name = SystemTools::GetFilenameName(filename);
|
||||
kwsys_stl::string::size_type dot_pos = name.rfind(".");
|
||||
if(dot_pos != kwsys_stl::string::npos)
|
||||
{
|
||||
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).
|
||||
* 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_std::string::size_type dot_pos = name.find(".");
|
||||
if(dot_pos != kwsys_std::string::npos)
|
||||
kwsys_stl::string name = SystemTools::GetFilenameName(filename);
|
||||
kwsys_stl::string::size_type dot_pos = name.find(".");
|
||||
if(dot_pos != kwsys_stl::string::npos)
|
||||
{
|
||||
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
|
||||
* from .tar.gz)
|
||||
*/
|
||||
kwsys_std::string
|
||||
SystemTools::GetFilenameWithoutLastExtension(const kwsys_std::string& filename)
|
||||
kwsys_stl::string
|
||||
SystemTools::GetFilenameWithoutLastExtension(const kwsys_stl::string& filename)
|
||||
{
|
||||
kwsys_std::string name = SystemTools::GetFilenameName(filename);
|
||||
kwsys_std::string::size_type dot_pos = name.rfind(".");
|
||||
if(dot_pos != kwsys_std::string::npos)
|
||||
kwsys_stl::string name = SystemTools::GetFilenameName(filename);
|
||||
kwsys_stl::string::size_type dot_pos = name.rfind(".");
|
||||
if(dot_pos != kwsys_stl::string::npos)
|
||||
{
|
||||
return name.substr(0, dot_pos);
|
||||
}
|
||||
|
@ -1530,7 +1530,7 @@ SystemTools::GetFilenameWithoutLastExtension(const kwsys_std::string& filename)
|
|||
|
||||
bool SystemTools::FileIsFullPath(const char* in_name)
|
||||
{
|
||||
kwsys_std::string name = in_name;
|
||||
kwsys_stl::string name = in_name;
|
||||
#if defined(_WIN32)
|
||||
// On Windows, the name must be at least two characters long.
|
||||
if(name.length() < 2)
|
||||
|
@ -1562,7 +1562,7 @@ bool SystemTools::FileIsFullPath(const char* in_name)
|
|||
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__)
|
||||
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,
|
||||
kwsys_std::string& program, kwsys_std::string& args)
|
||||
kwsys_stl::string& program, kwsys_stl::string& args)
|
||||
{
|
||||
if(SystemTools::FileExists(path))
|
||||
{
|
||||
|
@ -1612,25 +1612,25 @@ void SystemTools::SplitProgramFromArgs(const char* path,
|
|||
args = "";
|
||||
return;
|
||||
}
|
||||
kwsys_std::vector<kwsys_std::string> e;
|
||||
kwsys_std::string findProg = SystemTools::FindProgram(path, e);
|
||||
kwsys_stl::vector<kwsys_stl::string> e;
|
||||
kwsys_stl::string findProg = SystemTools::FindProgram(path, e);
|
||||
if(findProg.size())
|
||||
{
|
||||
program = findProg;
|
||||
args = "";
|
||||
return;
|
||||
}
|
||||
kwsys_std::string dir = path;
|
||||
kwsys_std::string::size_type spacePos = dir.rfind(' ');
|
||||
if(spacePos == kwsys_std::string::npos)
|
||||
kwsys_stl::string dir = path;
|
||||
kwsys_stl::string::size_type spacePos = dir.rfind(' ');
|
||||
if(spacePos == kwsys_stl::string::npos)
|
||||
{
|
||||
program = "";
|
||||
args = "";
|
||||
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()))
|
||||
{
|
||||
program = tryProg;
|
||||
|
@ -1650,7 +1650,7 @@ void SystemTools::SplitProgramFromArgs(const char* path,
|
|||
args = "";
|
||||
}
|
||||
|
||||
kwsys_std::string SystemTools::GetCurrentDateTime(const char* format)
|
||||
kwsys_stl::string SystemTools::GetCurrentDateTime(const char* format)
|
||||
{
|
||||
char buf[1024];
|
||||
time_t t;
|
||||
|
@ -1659,20 +1659,20 @@ kwsys_std::string SystemTools::GetCurrentDateTime(const char* format)
|
|||
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)
|
||||
{
|
||||
str = "_" + str;
|
||||
}
|
||||
|
||||
kwsys_std::string permited_chars("_"
|
||||
kwsys_stl::string permited_chars("_"
|
||||
"abcdefghijklmnopqrstuvwxyz"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
"0123456789");
|
||||
kwsys_std::string::size_type pos = 0;
|
||||
while ((pos = str.find_first_not_of(permited_chars, pos)) != kwsys_std::string::npos)
|
||||
kwsys_stl::string::size_type pos = 0;
|
||||
while ((pos = str.find_first_not_of(permited_chars, pos)) != kwsys_stl::string::npos)
|
||||
{
|
||||
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
|
||||
// need this very carefully written version of getline. Returns true
|
||||
// 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 */)
|
||||
{
|
||||
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.
|
||||
is.clear(is.rdstate() & ~kwsys_std::ios::failbit);
|
||||
is.clear(is.rdstate() & ~kwsys_ios::ios::failbit);
|
||||
}
|
||||
return haveData;
|
||||
}
|
||||
|
|
|
@ -14,15 +14,16 @@
|
|||
#ifndef @KWSYS_NAMESPACE@_SystemTools_hxx
|
||||
#define @KWSYS_NAMESPACE@_SystemTools_hxx
|
||||
|
||||
#include <@KWSYS_NAMESPACE@/std/iosfwd>
|
||||
#include <@KWSYS_NAMESPACE@/std/string>
|
||||
#include <@KWSYS_NAMESPACE@/std/vector>
|
||||
#include <@KWSYS_NAMESPACE@/ios/iosfwd>
|
||||
#include <@KWSYS_NAMESPACE@/stl/string>
|
||||
#include <@KWSYS_NAMESPACE@/stl/vector>
|
||||
|
||||
#include <@KWSYS_NAMESPACE@/Configure.h>
|
||||
|
||||
/* 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
|
||||
/* Define these macros temporarily to keep the code readable. */
|
||||
#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
|
||||
# define kwsys_stl @KWSYS_NAMESPACE@_stl
|
||||
# define kwsys_ios @KWSYS_NAMESPACE@_ios
|
||||
#endif
|
||||
|
||||
namespace @KWSYS_NAMESPACE@
|
||||
|
@ -41,7 +42,7 @@ public:
|
|||
* then an underscore is prepended. Note that this can produce
|
||||
* 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
|
||||
|
@ -63,14 +64,14 @@ public:
|
|||
* Replace replace all occurances of the string in
|
||||
* the source string.
|
||||
*/
|
||||
static void ReplaceString(kwsys_std::string& source,
|
||||
static void ReplaceString(kwsys_stl::string& source,
|
||||
const char* replace,
|
||||
const char* with);
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
@ -86,17 +87,17 @@ public:
|
|||
* Return a capitalized string (i.e the first letter is uppercased,
|
||||
* 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
|
||||
*/
|
||||
static kwsys_std::string LowerCase(const kwsys_std::string&);
|
||||
static kwsys_stl::string LowerCase(const kwsys_stl::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
|
||||
|
@ -106,13 +107,13 @@ public:
|
|||
/**
|
||||
* 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
|
||||
* 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. */
|
||||
static bool FileExists(const char* filename);
|
||||
|
@ -122,11 +123,11 @@ public:
|
|||
* Add the paths from the environment variable PATH to the
|
||||
* 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. */
|
||||
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
|
||||
|
@ -158,32 +159,32 @@ public:
|
|||
static bool RemoveADirectory(const char* source);
|
||||
|
||||
///! Find a file in the system PATH, with optional extra paths.
|
||||
static kwsys_std::string FindFile(const char* name,
|
||||
const kwsys_std::vector<kwsys_std::string>& path= kwsys_std::vector<kwsys_std::string>());
|
||||
static kwsys_stl::string FindFile(const char* name,
|
||||
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.
|
||||
static kwsys_std::string FindProgram(const char* name,
|
||||
const kwsys_std::vector<kwsys_std::string>& path = kwsys_std::vector<kwsys_std::string>(),
|
||||
static kwsys_stl::string FindProgram(const char* name,
|
||||
const kwsys_stl::vector<kwsys_stl::string>& path = kwsys_stl::vector<kwsys_stl::string>(),
|
||||
bool no_system_path = false);
|
||||
|
||||
///! Find a library in the system PATH, with optional extra paths.
|
||||
static kwsys_std::string FindLibrary(const char* name,
|
||||
const kwsys_std::vector<kwsys_std::string>& path);
|
||||
static kwsys_stl::string FindLibrary(const char* name,
|
||||
const kwsys_stl::vector<kwsys_stl::string>& path);
|
||||
|
||||
///! return true if the file is a directory.
|
||||
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
|
||||
* the path with the file stripped off. If there is no directory
|
||||
* 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,
|
||||
kwsys_std::string& dir,
|
||||
kwsys_std::string& file,
|
||||
kwsys_stl::string& dir,
|
||||
kwsys_stl::string& file,
|
||||
bool errorReport = true);
|
||||
|
||||
/**
|
||||
|
@ -192,32 +193,32 @@ public:
|
|||
* (which defaults to the current working directory). The full path
|
||||
* is returned.
|
||||
*/
|
||||
static kwsys_std::string CollapseFullPath(const char* in_relative);
|
||||
static kwsys_std::string CollapseFullPath(const char* in_relative,
|
||||
static kwsys_stl::string CollapseFullPath(const char* in_relative);
|
||||
static kwsys_stl::string CollapseFullPath(const char* in_relative,
|
||||
const char* in_base);
|
||||
|
||||
///! 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).
|
||||
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.
|
||||
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).
|
||||
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).
|
||||
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.
|
||||
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.
|
||||
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). */
|
||||
static bool FileIsFullPath(const char*);
|
||||
|
@ -225,19 +226,19 @@ public:
|
|||
static long int ModifiedTime(const char* filename);
|
||||
|
||||
///! 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
|
||||
static int ChangeDirectory(const char* dir);
|
||||
|
||||
/** Split a string on its newlines into multiple lines. Returns
|
||||
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). */
|
||||
static kwsys_std::string GetLastSystemError();
|
||||
static kwsys_stl::string GetLastSystemError();
|
||||
|
||||
/** When building DEBUG with MSVC, this enables a hook that prevents
|
||||
* 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
|
||||
* 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);
|
||||
|
||||
protected:
|
||||
|
@ -261,7 +262,7 @@ protected:
|
|||
* Convert the path to a string that can be used in a unix makefile.
|
||||
* 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
|
||||
|
@ -269,14 +270,15 @@ protected:
|
|||
* the string, the slashes are converted to windows style backslashes, and
|
||||
* 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@
|
||||
|
||||
/* Undefine temporary macro. */
|
||||
#if !defined (KWSYS_NAMESPACE) && !defined(@KWSYS_NAMESPACE@_NAME_IS_KWSYS)
|
||||
# undef kwsys_std
|
||||
/* Undefine temporary macros. */
|
||||
#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
|
||||
# undef kwsys_stl
|
||||
# undef kwsys_ios
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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)
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -1,31 +1 @@
|
|||
/*=========================================================================
|
||||
|
||||
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
|
||||
/* Empty until make dependencies are updated. */
|
||||
|
|
|
@ -1,46 +1 @@
|
|||
/*=========================================================================
|
||||
|
||||
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
|
||||
/* Empty until make dependencies are updated. */
|
||||
|
|
|
@ -1,50 +1 @@
|
|||
/*=========================================================================
|
||||
|
||||
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
|
||||
/* Empty until make dependencies are updated. */
|
||||
|
|
|
@ -1,47 +1 @@
|
|||
/*=========================================================================
|
||||
|
||||
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
|
||||
/* Empty until make dependencies are updated. */
|
||||
|
|
|
@ -1,130 +1 @@
|
|||
/*=========================================================================
|
||||
|
||||
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
|
||||
/* Empty until make dependencies are updated. */
|
||||
|
|
|
@ -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
|
|
@ -13,7 +13,7 @@
|
|||
=========================================================================*/
|
||||
#include <kwsys/Directory.hxx>
|
||||
#include <kwsys/Process.h>
|
||||
#include <kwsys/std/iostream>
|
||||
#include <kwsys/ios/iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
|
@ -26,9 +26,9 @@ int main()
|
|||
int length = 0;
|
||||
while(kwsysProcess_WaitForData(kp, &data, &length, 0))
|
||||
{
|
||||
kwsys_std::cout.write(data, length);
|
||||
kwsys_ios::cout.write(data, length);
|
||||
}
|
||||
kwsysProcess_Delete(kp);
|
||||
kwsys_std::cout << kwsys_std::endl;
|
||||
kwsys_ios::cout << kwsys_ios::endl;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
Loading…
Reference in New Issue