Commit 43605853 authored by Brad King's avatar Brad King
Browse files

ENH: Split kwsys_std into kwsys_ios and kwsys_stl in order to avoid std...

ENH: Split kwsys_std into kwsys_ios and kwsys_stl in order to avoid std namespace pollution and support more platforms.
parent ccf5114c
......@@ -109,49 +109,66 @@ ENDIF(CMAKE_ANSI_CFLAGS)
#-----------------------------------------------------------------------------
# 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
# possible values for configuration into Configure.hxx.
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/kwsysPlatformCxxTests.cmake)
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)
# 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)
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(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)
KWSYS_PLATFORM_CXX_TEST(KWSYS_HAVE_STL_STD
"Checking whether STL classes are in std" DIRECT)
# Select ANSI or old streams.
IF(KWSYS_FORCE_OLD_STREAMS)
SET(CMAKE_NO_ANSI_STREAM_HEADERS 1)
SET(CMAKE_NO_ANSI_STRING_STREAM 1)
SET(KWSYS_HAVE_ANSI_STREAMS 0)
ELSE(KWSYS_FORCE_OLD_STREAMS)
CHECK_INCLUDE_FILE_CXX("iosfwd" KWSYS_HAVE_ANSI_STREAMS)
IF(KWSYS_HAVE_ANSI_STREAMS)
SET(KWSYS_HAVE_ANSI_STREAMS 1)
ELSE(KWSYS_HAVE_ANSI_STREAMS)
SET(KWSYS_HAVE_ANSI_STREAMS 0)
ENDIF(KWSYS_HAVE_ANSI_STREAMS)
ENDIF(KWSYS_FORCE_OLD_STREAMS)
# Select string stream.
IF(KWSYS_HAVE_ANSI_STREAMS)
KWSYS_PLATFORM_CXX_TEST(KWSYS_HAVE_ANSI_STREAMS_STD
"Checking whether ANSI streams are in std" DIRECT)
CHECK_INCLUDE_FILE_CXX("sstream" KWSYS_HAVE_ANSI_SSTREAM)
IF(KWSYS_HAVE_ANSI_SSTREAM)
SET(KWSYS_HAVE_ANSI_SSTREAM 1)
ELSE(KWSYS_HAVE_ANSI_SSTREAM)
SET(KWSYS_HAVE_ANSI_SSTREAM 0)
ENDIF(KWSYS_HAVE_ANSI_SSTREAM)
ELSE(KWSYS_HAVE_ANSI_STREAMS)
SET(KWSYS_HAVE_ANSI_STREAMS_STD 0)
SET(KWSYS_HAVE_ANSI_SSTREAM 0)
ENDIF(KWSYS_HAVE_ANSI_STREAMS)
IF(KWSYS_HAVE_ANSI_SSTREAM)
SET(KWSYS_HAVE_OLD_STRSTREA_H 0)
SET(KWSYS_HAVE_OLD_STRSTREAM_H 0)
ELSE(KWSYS_HAVE_ANSI_SSTREAM)
CHECK_INCLUDE_FILE_CXX("strstream.h" KWSYS_HAVE_OLD_STRSTREAM_H)
IF(KWSYS_HAVE_OLD_STRSTREAM_H)
SET(KWSYS_HAVE_OLD_STRSTREAM_H 1)
SET(KWSYS_HAVE_OLD_STRSTREA_H 0)
ELSE(KWSYS_HAVE_OLD_STRSTREAM_H)
SET(KWSYS_HAVE_OLD_STRSTREAM_H 0)
CHECK_INCLUDE_FILE_CXX("strstrea.h" KWSYS_HAVE_OLD_STRSTREA_H)
IF(KWSYS_HAVE_OLD_STRSTREA_H)
SET(KWSYS_HAVE_OLD_STRSTREA_H 1)
ELSE(KWSYS_HAVE_OLD_STRSTREA_H)
SET(KWSYS_HAVE_OLD_STRSTREA_H 0)
ENDIF(KWSYS_HAVE_OLD_STRSTREA_H)
ENDIF(KWSYS_HAVE_OLD_STRSTREAM_H)
ENDIF(KWSYS_HAVE_ANSI_SSTREAM)
IF(KWSYS_NAMESPACE MATCHES "^kwsys$")
SET(KWSYS_NAME_IS_KWSYS 1)
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 +196,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 +212,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)
......
......@@ -14,53 +14,64 @@
#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 present. */
#define @KWSYS_NAMESPACE@_HAVE_ANSI_STREAMS @KWSYS_HAVE_ANSI_STREAMS@
/* 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@_HAVE_ANSI_STREAMS_STD @KWSYS_HAVE_ANSI_STREAMS_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 present and needed. */
#define @KWSYS_NAMESPACE@_HAVE_ANSI_SSTREAM @KWSYS_HAVE_ANSI_SSTREAM@
/* Defined if std namespace is the GCC hack. */
/* Whether old C++ <strstream.h> header is present and needed. */
#define @KWSYS_NAMESPACE@_HAVE_OLD_STRSTREAM_H @KWSYS_HAVE_OLD_STRSTREAM_H@
/* Whether old C++ <strstrea.h> header is present and needed. */
#define @KWSYS_NAMESPACE@_HAVE_OLD_STRSTREA_H @KWSYS_HAVE_OLD_STRSTREA_H@
/* Whether STL is in std namespace. */
#define @KWSYS_NAMESPACE@_HAVE_STL_STD @KWSYS_HAVE_STL_STD@
/* Whether the std namespace is the GCC 2.95 hack. */
#if defined(__GNUC__) && (__GNUC__ < 3)
# define @KWSYS_NAMESPACE@_FAKE_STD_NAMESPACE
# define @KWSYS_NAMESPACE@_FAKE_STD_NAMESPACE 1
#else
# define @KWSYS_NAMESPACE@_FAKE_STD_NAMESPACE 0
#endif
/* Define the std namespace macro. */
#if defined(@KWSYS_NAMESPACE@_NO_STD_NAMESPACE)
# define @KWSYS_NAMESPACE@_std
/* Define the stl namespace macro. */
#if @KWSYS_NAMESPACE@_HAVE_STL_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@_HAVE_ANSI_STREAMS_STD
# define @KWSYS_NAMESPACE@_ios_namespace std
#else
# define @KWSYS_NAMESPACE@_ios_namespace
#endif
#if @KWSYS_NAMESPACE@_HAVE_ANSI_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_HAVE_STL_STD @KWSYS_NAMESPACE@_HAVE_STL_STD
# define KWSYS_HAVE_ANSI_STREAMS @KWSYS_NAMESPACE@_HAVE_ANSI_STREAMS
# define KWSYS_HAVE_ANSI_STREAMS_STD @KWSYS_NAMESPACE@_HAVE_ANSI_STREAMS_STD
# define KWSYS_HAVE_ANSI_SSTREAM @KWSYS_NAMESPACE@_HAVE_ANSI_SSTREAM
#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
This diff is collapsed.
......@@ -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
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$")