Merge branch 'upstream-kwsys' into update-kwsys

This commit is contained in:
Brad King 2015-09-02 10:23:17 -04:00
commit c5cc3441b3
42 changed files with 1394 additions and 3203 deletions

View File

@ -35,15 +35,6 @@
# SET(KWSYS_HEADER_ROOT ${PROJECT_BINARY_DIR}) # SET(KWSYS_HEADER_ROOT ${PROJECT_BINARY_DIR})
# INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR}) # INCLUDE_DIRECTORIES(${PROJECT_BINARY_DIR})
# #
# 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_IOS_FORCE_OLD 1)
#
#
# Optional settings to setup install rules are as follows: # Optional settings to setup install rules are as follows:
# #
# KWSYS_INSTALL_BIN_DIR = The installation target directories into # KWSYS_INSTALL_BIN_DIR = The installation target directories into
@ -351,105 +342,6 @@ ENDIF()
# capabilities and parent project's request. Enforce 0/1 as only # capabilities and parent project's request. Enforce 0/1 as only
# possible values for configuration into Configure.hxx. # possible values for configuration into Configure.hxx.
KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAVE_STD
"Checking whether STL classes are in std namespace" DIRECT)
IF(KWSYS_IOS_FORCE_OLD)
SET(KWSYS_IOS_USE_ANSI 0)
ELSE()
KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_USE_ANSI
"Checking whether ANSI stream headers are available" DIRECT)
ENDIF()
IF(KWSYS_IOS_USE_ANSI)
KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAVE_STD
"Checking whether ANSI streams are in std namespace" DIRECT)
KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_USE_SSTREAM
"Checking whether ANSI string stream is available" DIRECT)
ELSE()
SET(KWSYS_IOS_HAVE_STD 0)
SET(KWSYS_IOS_USE_SSTREAM 0)
ENDIF()
IF(KWSYS_IOS_USE_SSTREAM)
SET(KWSYS_IOS_USE_STRSTREAM_H 0)
SET(KWSYS_IOS_USE_STRSTREA_H 0)
ELSE()
KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_USE_STRSTREAM_H
"Checking whether strstream.h is available" DIRECT)
IF(KWSYS_IOS_USE_STRSTREAM_H)
SET(KWSYS_IOS_USE_STRSTREA_H 0)
ELSE()
KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_USE_STRSTREA_H
"Checking whether strstrea.h is available" DIRECT)
ENDIF()
ENDIF()
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_CSTDDEF
"Checking whether header cstddef is available" DIRECT)
SET(KWSYS_PLATFORM_CXX_TEST_DEFINES
-DKWSYS_STL_HAVE_STD=${KWSYS_STL_HAVE_STD})
KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_STRING_HAVE_NEQ_CHAR
"Checking whether stl string has operator!= for char*" DIRECT)
KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_ITERATOR_TRAITS
"Checking whether stl has iterator_traits" DIRECT)
IF(KWSYS_STL_HAS_ITERATOR_TRAITS)
SET(KWSYS_STL_HAS_ITERATOR_CATEGORY 0)
SET(KWSYS_STL_HAS___ITERATOR_CATEGORY 0)
ELSE()
KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_ITERATOR_CATEGORY
"Checking whether stl has old iterator_category" DIRECT)
IF(KWSYS_STL_HAS_ITERATOR_CATEGORY)
SET(KWSYS_STL_HAS___ITERATOR_CATEGORY 0)
ELSE()
KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS___ITERATOR_CATEGORY
"Checking whether stl has internal __iterator_category" DIRECT)
ENDIF()
ENDIF()
KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_ALLOCATOR_TEMPLATE
"Checking whether stl has standard template allocator" DIRECT)
IF(KWSYS_STL_HAS_ALLOCATOR_TEMPLATE)
SET(KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE 0)
KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_ALLOCATOR_REBIND
"Checking for rebind member of stl allocator" DIRECT)
KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
"Checking for non-standard argument to stl allocator<>::max_size" DIRECT)
ELSE()
KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE
"Checking whether stl has old non-template allocator" DIRECT)
SET(KWSYS_STL_HAS_ALLOCATOR_REBIND 0)
SET(KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT 0)
ENDIF()
KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_ALLOCATOR_OBJECTS
"Checking whether stl containers support allocator objects." DIRECT)
IF(KWSYS_IOS_USE_ANSI AND NOT WATCOM)
# ANSI streams always have string operators.
SET(KWSYS_STL_STRING_HAVE_OSTREAM 1)
SET(KWSYS_STL_STRING_HAVE_ISTREAM 1)
ELSE()
# There may not be string operators for old streams.
KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_STRING_HAVE_OSTREAM
"Checking whether stl string has ostream operator<<" DIRECT)
KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_STRING_HAVE_ISTREAM
"Checking whether stl string has istream operator>>" DIRECT)
ENDIF()
SET(KWSYS_PLATFORM_CXX_TEST_DEFINES
-DKWSYS_IOS_USE_ANSI=${KWSYS_IOS_USE_ANSI}
-DKWSYS_IOS_HAVE_STD=${KWSYS_IOS_HAVE_STD})
KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAVE_BINARY
"Checking whether ios has binary openmode" DIRECT)
SET(KWSYS_PLATFORM_CXX_TEST_DEFINES)
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS
"Checking whether \"<>\" is needed for template friends" INVERT)
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_MEMBER_TEMPLATES
"Checking for member template support" DIRECT)
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_FULL_SPECIALIZATION
"Checking for standard template specialization syntax" DIRECT)
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP
"Checking whether argument dependent lookup is supported" DIRECT)
IF(UNIX) IF(UNIX)
KWSYS_PLATFORM_CXX_TEST(KWSYS_STAT_HAS_ST_MTIM KWSYS_PLATFORM_CXX_TEST(KWSYS_STAT_HAS_ST_MTIM
"Checking whether struct stat has st_mtim member" DIRECT) "Checking whether struct stat has st_mtim member" DIRECT)
@ -558,9 +450,6 @@ ENDIF()
IF(KWSYS_USE_IOStream) IF(KWSYS_USE_IOStream)
# Determine whether iostreams support long long. # Determine whether iostreams support long long.
SET(KWSYS_PLATFORM_CXX_TEST_DEFINES
-DKWSYS_IOS_USE_ANSI=${KWSYS_IOS_USE_ANSI}
-DKWSYS_IOS_HAVE_STD=${KWSYS_IOS_HAVE_STD})
IF(KWSYS_CXX_HAS_LONG_LONG) IF(KWSYS_CXX_HAS_LONG_LONG)
KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAS_ISTREAM_LONG_LONG KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAS_ISTREAM_LONG_LONG
"Checking if istream supports long long" DIRECT) "Checking if istream supports long long" DIRECT)
@ -579,7 +468,6 @@ IF(KWSYS_USE_IOStream)
SET(KWSYS_IOS_HAS_ISTREAM___INT64 0) SET(KWSYS_IOS_HAS_ISTREAM___INT64 0)
SET(KWSYS_IOS_HAS_OSTREAM___INT64 0) SET(KWSYS_IOS_HAS_OSTREAM___INT64 0)
ENDIF() ENDIF()
SET(KWSYS_PLATFORM_CXX_TEST_DEFINES)
ENDIF() ENDIF()
IF(KWSYS_NAMESPACE MATCHES "^kwsys$") IF(KWSYS_NAMESPACE MATCHES "^kwsys$")
@ -831,84 +719,6 @@ IF(KWSYS_INSTALL_DOC_DIR)
${KWSYS_INSTALL_LICENSE_OPTIONS}) ${KWSYS_INSTALL_LICENSE_OPTIONS})
ENDIF() ENDIF()
#-----------------------------------------------------------------------------
# Create STL header wrappers to block warnings in the STL headers and
# give standard names by which they may be included.
SET(KWSYS_STL_HEADER_EXTRA_string 1)
FOREACH(header
algorithm
deque
exception
functional
iterator
list
map
memory
new
numeric
queue
set
stack
stdexcept
string
utility
vector
)
# Configure the header wrapper.
SET(KWSYS_STL_HEADER "${header}")
IF(KWSYS_STL_HEADER_EXTRA_${header})
SET(KWSYS_STL_HEADER_EXTRA
"#define ${KWSYS_NAMESPACE}_stl_${header}_including_hxx\n# include <${KWSYS_NAMESPACE}/stl/${header}.hxx>\n#undef ${KWSYS_NAMESPACE}_stl_${header}_including_hxx\n")
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/kwsys_stl_${header}.hxx.in
${KWSYS_HEADER_DIR}/stl/${header}.hxx
@ONLY IMMEDIATE)
IF(KWSYS_INSTALL_INCLUDE_DIR)
INSTALL(FILES ${KWSYS_HEADER_DIR}/stl/${header}.hxx
DESTINATION ${KWSYS_INSTALL_INCLUDE_DIR}/${KWSYS_NAMESPACE}/stl
${KWSYS_INSTALL_INCLUDE_OPTIONS})
ENDIF()
ELSE()
SET(KWSYS_STL_HEADER_EXTRA "")
ENDIF()
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/kwsys_stl.hxx.in
${KWSYS_HEADER_DIR}/stl/${header}
@ONLY IMMEDIATE)
# Create an install target for the header wrapper.
IF(KWSYS_INSTALL_INCLUDE_DIR)
INSTALL(FILES ${KWSYS_HEADER_DIR}/stl/${header}
DESTINATION ${KWSYS_INSTALL_INCLUDE_DIR}/${KWSYS_NAMESPACE}/stl
${KWSYS_INSTALL_INCLUDE_OPTIONS})
ENDIF()
ENDFOREACH()
# Provide cstddef header.
CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/kwsys_cstddef.hxx.in
${KWSYS_HEADER_DIR}/cstddef
@ONLY IMMEDIATE)
IF(KWSYS_INSTALL_INCLUDE_DIR)
INSTALL(FILES ${KWSYS_HEADER_DIR}/cstddef
DESTINATION ${KWSYS_INSTALL_INCLUDE_DIR}/${KWSYS_NAMESPACE}
${KWSYS_INSTALL_INCLUDE_OPTIONS})
ENDIF()
#-----------------------------------------------------------------------------
# Create streams header wrappers to give standard names by which they
# may be included.
FOREACH(header iostream fstream sstream iosfwd)
# Configure the header wrapper.
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_INSTALL_INCLUDE_DIR)
INSTALL(FILES ${KWSYS_HEADER_DIR}/ios/${header}
DESTINATION ${KWSYS_INSTALL_INCLUDE_DIR}/${KWSYS_NAMESPACE}/ios
${KWSYS_INSTALL_INCLUDE_OPTIONS})
ENDIF()
ENDFOREACH()
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# Build a list of classes and headers we need to implement the # Build a list of classes and headers we need to implement the
# selected components. Initialize with required components. # selected components. Initialize with required components.

View File

@ -15,22 +15,19 @@
#include KWSYS_HEADER(Configure.hxx) #include KWSYS_HEADER(Configure.hxx)
#include KWSYS_HEADER(String.hxx) #include KWSYS_HEADER(String.hxx)
#include KWSYS_HEADER(stl/vector)
#include KWSYS_HEADER(stl/map)
#include KWSYS_HEADER(stl/set)
#include KWSYS_HEADER(ios/sstream)
#include KWSYS_HEADER(ios/iostream)
// Work-around CMake dependency scanning limitation. This must // Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers. // duplicate the above list of headers.
#if 0 #if 0
# include "CommandLineArguments.hxx.in" # include "CommandLineArguments.hxx.in"
# include "Configure.hxx.in" # include "Configure.hxx.in"
# include "kwsys_stl.hxx.in"
# include "kwsys_ios_sstream.h.in"
# include "kwsys_ios_iostream.h.in"
#endif #endif
#include <vector>
#include <map>
#include <set>
#include <sstream>
#include <iostream>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -45,7 +42,7 @@
#if 0 #if 0
# define CommandLineArguments_DEBUG(x) \ # define CommandLineArguments_DEBUG(x) \
kwsys_ios::cout << __LINE__ << " CLA: " << x << kwsys_ios::endl std::cout << __LINE__ << " CLA: " << x << std::endl
#else #else
# define CommandLineArguments_DEBUG(x) # define CommandLineArguments_DEBUG(x)
#endif #endif
@ -67,11 +64,11 @@ struct CommandLineArgumentsCallbackStructure
}; };
class CommandLineArgumentsVectorOfStrings : class CommandLineArgumentsVectorOfStrings :
public kwsys_stl::vector<kwsys::String> {}; public std::vector<kwsys::String> {};
class CommandLineArgumentsSetOfStrings : class CommandLineArgumentsSetOfStrings :
public kwsys_stl::set<kwsys::String> {}; public std::set<kwsys::String> {};
class CommandLineArgumentsMapOfStrucs : class CommandLineArgumentsMapOfStrucs :
public kwsys_stl::map<kwsys::String, public std::map<kwsys::String,
CommandLineArgumentsCallbackStructure> {}; CommandLineArgumentsCallbackStructure> {};
class CommandLineArgumentsInternal class CommandLineArgumentsInternal
@ -152,8 +149,8 @@ void CommandLineArguments::ProcessArgument(const char* arg)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool CommandLineArguments::GetMatchedArguments( bool CommandLineArguments::GetMatchedArguments(
kwsys_stl::vector<kwsys_stl::string>* matches, std::vector<std::string>* matches,
const kwsys_stl::string& arg) const std::string& arg)
{ {
matches->clear(); matches->clear();
CommandLineArguments::Internal::CallbacksMap::iterator it; CommandLineArguments::Internal::CallbacksMap::iterator it;
@ -184,15 +181,15 @@ bool CommandLineArguments::GetMatchedArguments(
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
int CommandLineArguments::Parse() int CommandLineArguments::Parse()
{ {
kwsys_stl::vector<kwsys_stl::string>::size_type cc; std::vector<std::string>::size_type cc;
kwsys_stl::vector<kwsys_stl::string> matches; std::vector<std::string> matches;
if ( this->StoreUnusedArgumentsFlag ) if ( this->StoreUnusedArgumentsFlag )
{ {
this->Internals->UnusedArguments.clear(); this->Internals->UnusedArguments.clear();
} }
for ( cc = 0; cc < this->Internals->Argv.size(); cc ++ ) for ( cc = 0; cc < this->Internals->Argv.size(); cc ++ )
{ {
const kwsys_stl::string& arg = this->Internals->Argv[cc]; const std::string& arg = this->Internals->Argv[cc];
CommandLineArguments_DEBUG("Process argument: " << arg); CommandLineArguments_DEBUG("Process argument: " << arg);
this->Internals->LastArgument = cc; this->Internals->LastArgument = cc;
if ( this->GetMatchedArguments(&matches, arg) ) if ( this->GetMatchedArguments(&matches, arg) )
@ -214,7 +211,7 @@ int CommandLineArguments::Parse()
// additional value // additional value
CommandLineArgumentsCallbackStructure *cs CommandLineArgumentsCallbackStructure *cs
= &this->Internals->Callbacks[matches[maxidx]]; = &this->Internals->Callbacks[matches[maxidx]];
const kwsys_stl::string& sarg = matches[maxidx]; const std::string& sarg = matches[maxidx];
if ( cs->Argument != sarg ) if ( cs->Argument != sarg )
{ {
abort(); abort();
@ -267,7 +264,7 @@ int CommandLineArguments::Parse()
CommandLineArguments_DEBUG("This is a multi argument: " << arg); CommandLineArguments_DEBUG("This is a multi argument: " << arg);
for (cc++; cc < this->Internals->Argv.size(); ++ cc ) for (cc++; cc < this->Internals->Argv.size(); ++ cc )
{ {
const kwsys_stl::string& marg = this->Internals->Argv[cc]; const std::string& marg = this->Internals->Argv[cc];
CommandLineArguments_DEBUG(" check multi argument value: " << marg); CommandLineArguments_DEBUG(" check multi argument value: " << marg);
if ( this->GetMatchedArguments(&matches, marg) ) if ( this->GetMatchedArguments(&matches, marg) )
{ {
@ -288,7 +285,7 @@ int CommandLineArguments::Parse()
} }
break; break;
default: default:
kwsys_ios::cerr << "Got unknown argument type: \"" << cs->ArgumentType << "\"" << kwsys_ios::endl; std::cerr << "Got unknown argument type: \"" << cs->ArgumentType << "\"" << std::endl;
this->Internals->LastArgument --; this->Internals->LastArgument --;
return 0; return 0;
} }
@ -313,7 +310,7 @@ int CommandLineArguments::Parse()
} }
else else
{ {
kwsys_ios::cerr << "Got unknown argument: \"" << arg << "\"" << kwsys_ios::endl; std::cerr << "Got unknown argument: \"" << arg << "\"" << std::endl;
this->Internals->LastArgument --; this->Internals->LastArgument --;
return 0; return 0;
} }
@ -430,13 +427,13 @@ CommandLineArgumentsAddArgumentMacro(BOOL, bool)
CommandLineArgumentsAddArgumentMacro(INT, int) CommandLineArgumentsAddArgumentMacro(INT, int)
CommandLineArgumentsAddArgumentMacro(DOUBLE, double) CommandLineArgumentsAddArgumentMacro(DOUBLE, double)
CommandLineArgumentsAddArgumentMacro(STRING, char*) CommandLineArgumentsAddArgumentMacro(STRING, char*)
CommandLineArgumentsAddArgumentMacro(STL_STRING, kwsys_stl::string) CommandLineArgumentsAddArgumentMacro(STL_STRING, std::string)
CommandLineArgumentsAddArgumentMacro(VECTOR_BOOL, kwsys_stl::vector<bool>) CommandLineArgumentsAddArgumentMacro(VECTOR_BOOL, std::vector<bool>)
CommandLineArgumentsAddArgumentMacro(VECTOR_INT, kwsys_stl::vector<int>) CommandLineArgumentsAddArgumentMacro(VECTOR_INT, std::vector<int>)
CommandLineArgumentsAddArgumentMacro(VECTOR_DOUBLE, kwsys_stl::vector<double>) CommandLineArgumentsAddArgumentMacro(VECTOR_DOUBLE, std::vector<double>)
CommandLineArgumentsAddArgumentMacro(VECTOR_STRING, kwsys_stl::vector<char*>) CommandLineArgumentsAddArgumentMacro(VECTOR_STRING, std::vector<char*>)
CommandLineArgumentsAddArgumentMacro(VECTOR_STL_STRING, kwsys_stl::vector<kwsys_stl::string>) CommandLineArgumentsAddArgumentMacro(VECTOR_STL_STRING, std::vector<std::string>)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
#define CommandLineArgumentsAddBooleanArgumentMacro(type, ctype) \ #define CommandLineArgumentsAddBooleanArgumentMacro(type, ctype) \
@ -451,7 +448,7 @@ CommandLineArgumentsAddBooleanArgumentMacro(BOOL, bool)
CommandLineArgumentsAddBooleanArgumentMacro(INT, int) CommandLineArgumentsAddBooleanArgumentMacro(INT, int)
CommandLineArgumentsAddBooleanArgumentMacro(DOUBLE, double) CommandLineArgumentsAddBooleanArgumentMacro(DOUBLE, double)
CommandLineArgumentsAddBooleanArgumentMacro(STRING, char*) CommandLineArgumentsAddBooleanArgumentMacro(STRING, char*)
CommandLineArgumentsAddBooleanArgumentMacro(STL_STRING, kwsys_stl::string) CommandLineArgumentsAddBooleanArgumentMacro(STL_STRING, std::string)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void CommandLineArguments::SetClientData(void* client_data) void CommandLineArguments::SetClientData(void* client_data)
@ -518,12 +515,12 @@ unsigned int CommandLineArguments::GetLastArgument()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void CommandLineArguments::GenerateHelp() void CommandLineArguments::GenerateHelp()
{ {
kwsys_ios::ostringstream str; std::ostringstream str;
// Collapse all arguments into the map of vectors of all arguments that do // Collapse all arguments into the map of vectors of all arguments that do
// the same thing. // the same thing.
CommandLineArguments::Internal::CallbacksMap::iterator it; CommandLineArguments::Internal::CallbacksMap::iterator it;
typedef kwsys_stl::map<CommandLineArguments::Internal::String, typedef std::map<CommandLineArguments::Internal::String,
CommandLineArguments::Internal::SetOfStrings > MapArgs; CommandLineArguments::Internal::SetOfStrings > MapArgs;
MapArgs mp; MapArgs mp;
MapArgs::iterator mpit, smpit; MapArgs::iterator mpit, smpit;
@ -604,7 +601,7 @@ void CommandLineArguments::GenerateHelp()
CommandLineArguments::Internal::SetOfStrings::iterator sit; CommandLineArguments::Internal::SetOfStrings::iterator sit;
for ( sit = mpit->second.begin(); sit != mpit->second.end(); sit++ ) for ( sit = mpit->second.begin(); sit != mpit->second.end(); sit++ )
{ {
str << kwsys_ios::endl; str << std::endl;
char argument[100]; char argument[100];
sprintf(argument, "%s", sit->c_str()); sprintf(argument, "%s", sit->c_str());
switch ( this->Internals->Callbacks[*sit].ArgumentType ) switch ( this->Internals->Callbacks[*sit].ArgumentType )
@ -658,8 +655,8 @@ void CommandLineArguments::GenerateHelp()
skip = cc; skip = cc;
} }
} }
str.write(ptr, static_cast<kwsys_ios::streamsize>(skip)); str.write(ptr, static_cast<std::streamsize>(skip));
str << kwsys_ios::endl; str << std::endl;
ptr += skip; ptr += skip;
len -= skip; len -= skip;
cnt ++; cnt ++;
@ -680,7 +677,7 @@ void CommandLineArguments::GenerateHelp()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void CommandLineArguments::PopulateVariable( void CommandLineArguments::PopulateVariable(
bool* variable, const kwsys_stl::string& value) bool* variable, const std::string& value)
{ {
if ( value == "1" || value == "ON" || value == "on" || value == "On" || if ( value == "1" || value == "ON" || value == "on" || value == "On" ||
value == "TRUE" || value == "true" || value == "True" || value == "TRUE" || value == "true" || value == "True" ||
@ -696,7 +693,7 @@ void CommandLineArguments::PopulateVariable(
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void CommandLineArguments::PopulateVariable( void CommandLineArguments::PopulateVariable(
int* variable, const kwsys_stl::string& value) int* variable, const std::string& value)
{ {
char* res = 0; char* res = 0;
*variable = static_cast<int>(strtol(value.c_str(), &res, 10)); *variable = static_cast<int>(strtol(value.c_str(), &res, 10));
@ -708,7 +705,7 @@ void CommandLineArguments::PopulateVariable(
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void CommandLineArguments::PopulateVariable( void CommandLineArguments::PopulateVariable(
double* variable, const kwsys_stl::string& value) double* variable, const std::string& value)
{ {
char* res = 0; char* res = 0;
*variable = strtod(value.c_str(), &res); *variable = strtod(value.c_str(), &res);
@ -720,7 +717,7 @@ void CommandLineArguments::PopulateVariable(
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void CommandLineArguments::PopulateVariable( void CommandLineArguments::PopulateVariable(
char** variable, const kwsys_stl::string& value) char** variable, const std::string& value)
{ {
if ( *variable ) if ( *variable )
{ {
@ -733,14 +730,14 @@ void CommandLineArguments::PopulateVariable(
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void CommandLineArguments::PopulateVariable( void CommandLineArguments::PopulateVariable(
kwsys_stl::string* variable, const kwsys_stl::string& value) std::string* variable, const std::string& value)
{ {
*variable = value; *variable = value;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void CommandLineArguments::PopulateVariable( void CommandLineArguments::PopulateVariable(
kwsys_stl::vector<bool>* variable, const kwsys_stl::string& value) std::vector<bool>* variable, const std::string& value)
{ {
bool val = false; bool val = false;
if ( value == "1" || value == "ON" || value == "on" || value == "On" || if ( value == "1" || value == "ON" || value == "on" || value == "On" ||
@ -754,7 +751,7 @@ void CommandLineArguments::PopulateVariable(
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void CommandLineArguments::PopulateVariable( void CommandLineArguments::PopulateVariable(
kwsys_stl::vector<int>* variable, const kwsys_stl::string& value) std::vector<int>* variable, const std::string& value)
{ {
char* res = 0; char* res = 0;
variable->push_back(static_cast<int>(strtol(value.c_str(), &res, 10))); variable->push_back(static_cast<int>(strtol(value.c_str(), &res, 10)));
@ -766,7 +763,7 @@ void CommandLineArguments::PopulateVariable(
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void CommandLineArguments::PopulateVariable( void CommandLineArguments::PopulateVariable(
kwsys_stl::vector<double>* variable, const kwsys_stl::string& value) std::vector<double>* variable, const std::string& value)
{ {
char* res = 0; char* res = 0;
variable->push_back(strtod(value.c_str(), &res)); variable->push_back(strtod(value.c_str(), &res));
@ -778,7 +775,7 @@ void CommandLineArguments::PopulateVariable(
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void CommandLineArguments::PopulateVariable( void CommandLineArguments::PopulateVariable(
kwsys_stl::vector<char*>* variable, const kwsys_stl::string& value) std::vector<char*>* variable, const std::string& value)
{ {
char* var = new char[ value.size() + 1 ]; char* var = new char[ value.size() + 1 ];
strcpy(var, value.c_str()); strcpy(var, value.c_str());
@ -787,8 +784,8 @@ void CommandLineArguments::PopulateVariable(
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void CommandLineArguments::PopulateVariable( void CommandLineArguments::PopulateVariable(
kwsys_stl::vector<kwsys_stl::string>* variable, std::vector<std::string>* variable,
const kwsys_stl::string& value) const std::string& value)
{ {
variable->push_back(value); variable->push_back(value);
} }
@ -809,7 +806,7 @@ bool CommandLineArguments::PopulateVariable(CommandLineArgumentsCallbackStructur
CommandLineArguments_DEBUG("Set argument: " << cs->Argument << " to " << value); CommandLineArguments_DEBUG("Set argument: " << cs->Argument << " to " << value);
if ( cs->Variable ) if ( cs->Variable )
{ {
kwsys_stl::string var = "1"; std::string var = "1";
if ( value ) if ( value )
{ {
var = value; var = value;
@ -826,28 +823,28 @@ bool CommandLineArguments::PopulateVariable(CommandLineArgumentsCallbackStructur
this->PopulateVariable(static_cast<char**>(cs->Variable), var); this->PopulateVariable(static_cast<char**>(cs->Variable), var);
break; break;
case CommandLineArguments::STL_STRING_TYPE: case CommandLineArguments::STL_STRING_TYPE:
this->PopulateVariable(static_cast<kwsys_stl::string*>(cs->Variable), var); this->PopulateVariable(static_cast<std::string*>(cs->Variable), var);
break; break;
case CommandLineArguments::BOOL_TYPE: case CommandLineArguments::BOOL_TYPE:
this->PopulateVariable(static_cast<bool*>(cs->Variable), var); this->PopulateVariable(static_cast<bool*>(cs->Variable), var);
break; break;
case CommandLineArguments::VECTOR_BOOL_TYPE: case CommandLineArguments::VECTOR_BOOL_TYPE:
this->PopulateVariable(static_cast<kwsys_stl::vector<bool>*>(cs->Variable), var); this->PopulateVariable(static_cast<std::vector<bool>*>(cs->Variable), var);
break; break;
case CommandLineArguments::VECTOR_INT_TYPE: case CommandLineArguments::VECTOR_INT_TYPE:
this->PopulateVariable(static_cast<kwsys_stl::vector<int>*>(cs->Variable), var); this->PopulateVariable(static_cast<std::vector<int>*>(cs->Variable), var);
break; break;
case CommandLineArguments::VECTOR_DOUBLE_TYPE: case CommandLineArguments::VECTOR_DOUBLE_TYPE:
this->PopulateVariable(static_cast<kwsys_stl::vector<double>*>(cs->Variable), var); this->PopulateVariable(static_cast<std::vector<double>*>(cs->Variable), var);
break; break;
case CommandLineArguments::VECTOR_STRING_TYPE: case CommandLineArguments::VECTOR_STRING_TYPE:
this->PopulateVariable(static_cast<kwsys_stl::vector<char*>*>(cs->Variable), var); this->PopulateVariable(static_cast<std::vector<char*>*>(cs->Variable), var);
break; break;
case CommandLineArguments::VECTOR_STL_STRING_TYPE: case CommandLineArguments::VECTOR_STL_STRING_TYPE:
this->PopulateVariable(static_cast<kwsys_stl::vector<kwsys_stl::string>*>(cs->Variable), var); this->PopulateVariable(static_cast<std::vector<std::string>*>(cs->Variable), var);
break; break;
default: default:
kwsys_ios::cerr << "Got unknown variable type: \"" << cs->VariableType << "\"" << kwsys_ios::endl; std::cerr << "Got unknown variable type: \"" << cs->VariableType << "\"" << std::endl;
this->Internals->LastArgument --; this->Internals->LastArgument --;
return 0; return 0;
} }

View File

@ -15,13 +15,8 @@
#include <@KWSYS_NAMESPACE@/Configure.h> #include <@KWSYS_NAMESPACE@/Configure.h>
#include <@KWSYS_NAMESPACE@/Configure.hxx> #include <@KWSYS_NAMESPACE@/Configure.hxx>
#include <@KWSYS_NAMESPACE@/stl/string> #include <string>
#include <@KWSYS_NAMESPACE@/stl/vector> #include <vector>
/* 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
namespace @KWSYS_NAMESPACE@ namespace @KWSYS_NAMESPACE@
{ {
@ -64,7 +59,7 @@ struct CommandLineArgumentsCallbackStructure;
* "This is help string for --something"); * "This is help string for --something");
* if ( !arg.Parse() ) * if ( !arg.Parse() )
* { * {
* kwsys_ios::cerr << "Problem parsing arguments" << kwsys_ios::endl; * std::cerr << "Problem parsing arguments" << std::endl;
* res = 1; * res = 1;
* } * }
* *
@ -155,7 +150,7 @@ public:
void AddArgument(const char* argument, ArgumentTypeEnum type, void AddArgument(const char* argument, ArgumentTypeEnum type,
char** variable, const char* help); char** variable, const char* help);
void AddArgument(const char* argument, ArgumentTypeEnum type, void AddArgument(const char* argument, ArgumentTypeEnum type,
kwsys_stl::string* variable, const char* help); std::string* variable, const char* help);
/** /**
* Add handler for argument which is going to set the variable to the * Add handler for argument which is going to set the variable to the
@ -163,15 +158,15 @@ public:
* appropriate type. This will handle the multi argument values. * appropriate type. This will handle the multi argument values.
*/ */
void AddArgument(const char* argument, ArgumentTypeEnum type, void AddArgument(const char* argument, ArgumentTypeEnum type,
kwsys_stl::vector<bool>* variable, const char* help); std::vector<bool>* variable, const char* help);
void AddArgument(const char* argument, ArgumentTypeEnum type, void AddArgument(const char* argument, ArgumentTypeEnum type,
kwsys_stl::vector<int>* variable, const char* help); std::vector<int>* variable, const char* help);
void AddArgument(const char* argument, ArgumentTypeEnum type, void AddArgument(const char* argument, ArgumentTypeEnum type,
kwsys_stl::vector<double>* variable, const char* help); std::vector<double>* variable, const char* help);
void AddArgument(const char* argument, ArgumentTypeEnum type, void AddArgument(const char* argument, ArgumentTypeEnum type,
kwsys_stl::vector<char*>* variable, const char* help); std::vector<char*>* variable, const char* help);
void AddArgument(const char* argument, ArgumentTypeEnum type, void AddArgument(const char* argument, ArgumentTypeEnum type,
kwsys_stl::vector<kwsys_stl::string>* variable, const char* help); std::vector<std::string>* variable, const char* help);
/** /**
* Add handler for boolean argument. The argument does not take any option * Add handler for boolean argument. The argument does not take any option
@ -187,7 +182,7 @@ public:
void AddBooleanArgument(const char* argument, void AddBooleanArgument(const char* argument,
char** variable, const char* help); char** variable, const char* help);
void AddBooleanArgument(const char* argument, void AddBooleanArgument(const char* argument,
kwsys_stl::string* variable, const char* help); std::string* variable, const char* help);
/** /**
* Set the callbacks for error handling. * Set the callbacks for error handling.
@ -243,28 +238,28 @@ protected:
void AddArgument(const char* argument, ArgumentTypeEnum type, void AddArgument(const char* argument, ArgumentTypeEnum type,
VariableTypeEnum vtype, void* variable, const char* help); VariableTypeEnum vtype, void* variable, const char* help);
bool GetMatchedArguments(kwsys_stl::vector<kwsys_stl::string>* matches, bool GetMatchedArguments(std::vector<std::string>* matches,
const kwsys_stl::string& arg); const std::string& arg);
//! Populate individual variables //! Populate individual variables
bool PopulateVariable(CommandLineArgumentsCallbackStructure* cs, bool PopulateVariable(CommandLineArgumentsCallbackStructure* cs,
const char* value); const char* value);
//! Populate individual variables of type ... //! Populate individual variables of type ...
void PopulateVariable(bool* variable, const kwsys_stl::string& value); void PopulateVariable(bool* variable, const std::string& value);
void PopulateVariable(int* variable, const kwsys_stl::string& value); void PopulateVariable(int* variable, const std::string& value);
void PopulateVariable(double* variable, const kwsys_stl::string& value); void PopulateVariable(double* variable, const std::string& value);
void PopulateVariable(char** variable, const kwsys_stl::string& value); void PopulateVariable(char** variable, const std::string& value);
void PopulateVariable(kwsys_stl::string* variable, const kwsys_stl::string& value); void PopulateVariable(std::string* variable, const std::string& value);
void PopulateVariable(kwsys_stl::vector<bool>* variable, const kwsys_stl::string& value); void PopulateVariable(std::vector<bool>* variable, const std::string& value);
void PopulateVariable(kwsys_stl::vector<int>* variable, const kwsys_stl::string& value); void PopulateVariable(std::vector<int>* variable, const std::string& value);
void PopulateVariable(kwsys_stl::vector<double>* variable, const kwsys_stl::string& value); void PopulateVariable(std::vector<double>* variable, const std::string& value);
void PopulateVariable(kwsys_stl::vector<char*>* variable, const kwsys_stl::string& value); void PopulateVariable(std::vector<char*>* variable, const std::string& value);
void PopulateVariable(kwsys_stl::vector<kwsys_stl::string>* variable, const kwsys_stl::string& value); void PopulateVariable(std::vector<std::string>* variable, const std::string& value);
typedef CommandLineArgumentsInternal Internal; typedef CommandLineArgumentsInternal Internal;
Internal* Internals; Internal* Internals;
kwsys_stl::string Help; std::string Help;
unsigned int LineLength; unsigned int LineLength;
@ -273,11 +268,6 @@ protected:
} // namespace @KWSYS_NAMESPACE@ } // namespace @KWSYS_NAMESPACE@
/* Undefine temporary macro. */
#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
# undef kwsys_stl
#endif
#endif #endif

View File

@ -15,125 +15,9 @@
/* Include C configuration. */ /* Include C configuration. */
#include <@KWSYS_NAMESPACE@/Configure.h> #include <@KWSYS_NAMESPACE@/Configure.h>
/* Whether ANSI C++ stream headers are to be used. */
#define @KWSYS_NAMESPACE@_IOS_USE_ANSI @KWSYS_IOS_USE_ANSI@
/* Whether ANSI C++ streams are in std namespace. */
#define @KWSYS_NAMESPACE@_IOS_HAVE_STD @KWSYS_IOS_HAVE_STD@
/* Whether ANSI C++ <sstream> header is to be used. */
#define @KWSYS_NAMESPACE@_IOS_USE_SSTREAM @KWSYS_IOS_USE_SSTREAM@
/* Whether old C++ <strstream.h> header is to be used. */
#define @KWSYS_NAMESPACE@_IOS_USE_STRSTREAM_H @KWSYS_IOS_USE_STRSTREAM_H@
/* Whether old C++ <strstrea.h> header is to be used. */
#define @KWSYS_NAMESPACE@_IOS_USE_STRSTREA_H @KWSYS_IOS_USE_STRSTREA_H@
/* Whether C++ streams support the ios::binary openmode. */
#define @KWSYS_NAMESPACE@_IOS_HAVE_BINARY @KWSYS_IOS_HAVE_BINARY@
/* Whether STL is in std namespace. */
#define @KWSYS_NAMESPACE@_STL_HAVE_STD @KWSYS_STL_HAVE_STD@
/* Whether wstring is available. */ /* Whether wstring is available. */
#define @KWSYS_NAMESPACE@_STL_HAS_WSTRING @KWSYS_STL_HAS_WSTRING@ #define @KWSYS_NAMESPACE@_STL_HAS_WSTRING @KWSYS_STL_HAS_WSTRING@
/* Whether the STL string has operator<< for ostream. */
#define @KWSYS_NAMESPACE@_STL_STRING_HAVE_OSTREAM @KWSYS_STL_STRING_HAVE_OSTREAM@
/* Whether the STL string has operator>> for istream. */
#define @KWSYS_NAMESPACE@_STL_STRING_HAVE_ISTREAM @KWSYS_STL_STRING_HAVE_ISTREAM@
/* Whether the STL string has operator!= for char*. */
#define @KWSYS_NAMESPACE@_STL_STRING_HAVE_NEQ_CHAR @KWSYS_STL_STRING_HAVE_NEQ_CHAR@
/* Define the stl namespace macro. */
#if @KWSYS_NAMESPACE@_STL_HAVE_STD
# define @KWSYS_NAMESPACE@_stl std
#else
# 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_USE_SSTREAM
# define @KWSYS_NAMESPACE@_ios @KWSYS_NAMESPACE@_ios_namespace
#else
# define @KWSYS_NAMESPACE@_ios @KWSYS_NAMESPACE@_ios
#endif
/* Define the ios::binary openmode macro. */
#if @KWSYS_NAMESPACE@_IOS_HAVE_BINARY
# define @KWSYS_NAMESPACE@_ios_binary @KWSYS_NAMESPACE@_ios::ios::binary
#else
# define @KWSYS_NAMESPACE@_ios_binary 0
#endif
/* Whether the cstddef header is available. */
#define @KWSYS_NAMESPACE@_CXX_HAS_CSTDDEF @KWSYS_CXX_HAS_CSTDDEF@
/* Whether the compiler supports null template arguments. */
#define @KWSYS_NAMESPACE@_CXX_HAS_NULL_TEMPLATE_ARGS @KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS@
/* Define the null template arguments macro. */
#if @KWSYS_NAMESPACE@_CXX_HAS_NULL_TEMPLATE_ARGS
# define @KWSYS_NAMESPACE@_CXX_NULL_TEMPLATE_ARGS <>
#else
# define @KWSYS_NAMESPACE@_CXX_NULL_TEMPLATE_ARGS
#endif
/* Whether the compiler supports member templates. */
#define @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES @KWSYS_CXX_HAS_MEMBER_TEMPLATES@
/* Whether the compiler supports argument dependent lookup. */
#define @KWSYS_NAMESPACE@_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP @KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP@
/* Whether the compiler supports standard full specialization syntax. */
#define @KWSYS_NAMESPACE@_CXX_HAS_FULL_SPECIALIZATION @KWSYS_CXX_HAS_FULL_SPECIALIZATION@
/* Define the specialization definition macro. */
#if @KWSYS_NAMESPACE@_CXX_HAS_FULL_SPECIALIZATION
# define @KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION template <>
#else
# define @KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
#endif
/* Define typename keyword macro for use in declarations. */
#if defined(_MSC_VER) && _MSC_VER < 1300
# define @KWSYS_NAMESPACE@_CXX_DECL_TYPENAME
#else
# define @KWSYS_NAMESPACE@_CXX_DECL_TYPENAME typename
#endif
/* Whether the stl has iterator_traits. */
#define @KWSYS_NAMESPACE@_STL_HAS_ITERATOR_TRAITS @KWSYS_STL_HAS_ITERATOR_TRAITS@
/* Whether the stl has iterator_category. */
#define @KWSYS_NAMESPACE@_STL_HAS_ITERATOR_CATEGORY @KWSYS_STL_HAS_ITERATOR_CATEGORY@
/* Whether the stl has __iterator_category. */
#define @KWSYS_NAMESPACE@_STL_HAS___ITERATOR_CATEGORY @KWSYS_STL_HAS___ITERATOR_CATEGORY@
/* Whether the stl allocator is the standard template. */
#define @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_TEMPLATE @KWSYS_STL_HAS_ALLOCATOR_TEMPLATE@
/* Whether the stl allocator is not a template. */
#define @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_NONTEMPLATE @KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE@
/* Whether the stl allocator has rebind. */
#define @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_REBIND @KWSYS_STL_HAS_ALLOCATOR_REBIND@
/* Whether the stl allocator has a size argument for max_size. */
#define @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT @KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT@
/* Whether the stl containers support allocator objects. */
#define @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_OBJECTS @KWSYS_STL_HAS_ALLOCATOR_OBJECTS@
/* Whether struct stat has the st_mtim member for high resolution times. */ /* Whether struct stat has the st_mtim member for high resolution times. */
#define @KWSYS_NAMESPACE@_STAT_HAS_ST_MTIM @KWSYS_STAT_HAS_ST_MTIM@ #define @KWSYS_NAMESPACE@_STAT_HAS_ST_MTIM @KWSYS_STAT_HAS_ST_MTIM@
@ -141,38 +25,10 @@
access to the macros without a configured namespace. */ access to the macros without a configured namespace. */
#if defined(KWSYS_NAMESPACE) #if defined(KWSYS_NAMESPACE)
# if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS # if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
# define kwsys_stl @KWSYS_NAMESPACE@_stl
# define kwsys_ios @KWSYS_NAMESPACE@_ios
# define kwsys @KWSYS_NAMESPACE@ # define kwsys @KWSYS_NAMESPACE@
# define kwsys_ios_binary @KWSYS_NAMESPACE@_ios_binary
# endif # endif
# define KWSYS_NAME_IS_KWSYS @KWSYS_NAMESPACE@_NAME_IS_KWSYS # define KWSYS_NAME_IS_KWSYS @KWSYS_NAMESPACE@_NAME_IS_KWSYS
# define KWSYS_STL_HAVE_STD @KWSYS_NAMESPACE@_STL_HAVE_STD
# define KWSYS_IOS_HAVE_STD @KWSYS_NAMESPACE@_IOS_HAVE_STD
# define KWSYS_IOS_USE_ANSI @KWSYS_NAMESPACE@_IOS_USE_ANSI
# define KWSYS_IOS_USE_SSTREAM @KWSYS_NAMESPACE@_IOS_USE_SSTREAM
# define KWSYS_IOS_USE_STRSTREAM_H @KWSYS_NAMESPACE@_IOS_USE_STRSTREAM_H
# define KWSYS_IOS_USE_STRSTREA_H @KWSYS_NAMESPACE@_IOS_USE_STRSTREA_H
# define KWSYS_IOS_HAVE_BINARY @KWSYS_NAMESPACE@_IOS_HAVE_BINARY
# define KWSYS_STAT_HAS_ST_MTIM @KWSYS_NAMESPACE@_STAT_HAS_ST_MTIM # define KWSYS_STAT_HAS_ST_MTIM @KWSYS_NAMESPACE@_STAT_HAS_ST_MTIM
# define KWSYS_CXX_HAS_CSTDDEF @KWSYS_NAMESPACE@_CXX_HAS_CSTDDEF
# define KWSYS_STL_STRING_HAVE_OSTREAM @KWSYS_NAMESPACE@_STL_STRING_HAVE_OSTREAM
# define KWSYS_STL_STRING_HAVE_ISTREAM @KWSYS_NAMESPACE@_STL_STRING_HAVE_ISTREAM
# define KWSYS_STL_STRING_HAVE_NEQ_CHAR @KWSYS_NAMESPACE@_STL_STRING_HAVE_NEQ_CHAR
# define KWSYS_CXX_NULL_TEMPLATE_ARGS @KWSYS_NAMESPACE@_CXX_NULL_TEMPLATE_ARGS
# define KWSYS_CXX_HAS_MEMBER_TEMPLATES @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES
# define KWSYS_CXX_HAS_FULL_SPECIALIZATION @KWSYS_NAMESPACE@_CXX_HAS_FULL_SPECIALIZATION
# define KWSYS_CXX_DEFINE_SPECIALIZATION @KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
# define KWSYS_CXX_DECL_TYPENAME @KWSYS_NAMESPACE@_CXX_DECL_TYPENAME
# define KWSYS_STL_HAS_ALLOCATOR_REBIND @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_REBIND
# define KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
# define KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP @KWSYS_NAMESPACE@_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP
# define KWSYS_STL_HAS_ITERATOR_TRAITS @KWSYS_NAMESPACE@_STL_HAS_ITERATOR_TRAITS
# define KWSYS_STL_HAS_ITERATOR_CATEGORY @KWSYS_NAMESPACE@_STL_HAS_ITERATOR_CATEGORY
# define KWSYS_STL_HAS___ITERATOR_CATEGORY @KWSYS_NAMESPACE@_STL_HAS___ITERATOR_CATEGORY
# define KWSYS_STL_HAS_ALLOCATOR_TEMPLATE @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_TEMPLATE
# define KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_NONTEMPLATE
# define KWSYS_STL_HAS_ALLOCATOR_OBJECTS @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_OBJECTS
# define KWSYS_STL_HAS_WSTRING @KWSYS_NAMESPACE@_STL_HAS_WSTRING # define KWSYS_STL_HAS_WSTRING @KWSYS_NAMESPACE@_STL_HAS_WSTRING
#endif #endif

View File

@ -16,20 +16,17 @@
#include KWSYS_HEADER(Encoding.hxx) #include KWSYS_HEADER(Encoding.hxx)
#include KWSYS_HEADER(stl/string)
#include KWSYS_HEADER(stl/vector)
// Work-around CMake dependency scanning limitation. This must // Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers. // duplicate the above list of headers.
#if 0 #if 0
# include "Directory.hxx.in" # include "Directory.hxx.in"
# include "Configure.hxx.in" # include "Configure.hxx.in"
# include "Encoding.hxx.in" # include "Encoding.hxx.in"
# include "kwsys_stl.hxx.in"
# include "kwsys_stl_string.hxx.in"
# include "kwsys_stl_vector.hxx.in"
#endif #endif
#include <string>
#include <vector>
namespace KWSYS_NAMESPACE namespace KWSYS_NAMESPACE
{ {
@ -38,10 +35,10 @@ class DirectoryInternals
{ {
public: public:
// Array of Files // Array of Files
kwsys_stl::vector<kwsys_stl::string> Files; std::vector<std::string> Files;
// Path to Open'ed directory // Path to Open'ed directory
kwsys_stl::string Path; std::string Path;
}; };
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -103,7 +100,7 @@ void Directory::Clear()
namespace KWSYS_NAMESPACE namespace KWSYS_NAMESPACE
{ {
bool Directory::Load(const kwsys_stl::string& name) bool Directory::Load(const std::string& name)
{ {
this->Clear(); this->Clear();
#if _MSC_VER < 1300 #if _MSC_VER < 1300
@ -153,7 +150,7 @@ bool Directory::Load(const kwsys_stl::string& name)
return _findclose(srchHandle) != -1; return _findclose(srchHandle) != -1;
} }
unsigned long Directory::GetNumberOfFilesInDirectory(const kwsys_stl::string& name) unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name)
{ {
#if _MSC_VER < 1300 #if _MSC_VER < 1300
long srchHandle; long srchHandle;
@ -220,7 +217,7 @@ unsigned long Directory::GetNumberOfFilesInDirectory(const kwsys_stl::string& na
namespace KWSYS_NAMESPACE namespace KWSYS_NAMESPACE
{ {
bool Directory::Load(const kwsys_stl::string& name) bool Directory::Load(const std::string& name)
{ {
this->Clear(); this->Clear();
@ -240,7 +237,7 @@ bool Directory::Load(const kwsys_stl::string& name)
return 1; return 1;
} }
unsigned long Directory::GetNumberOfFilesInDirectory(const kwsys_stl::string& name) unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name)
{ {
DIR* dir = opendir(name.c_str()); DIR* dir = opendir(name.c_str());

View File

@ -13,12 +13,7 @@
#define @KWSYS_NAMESPACE@_Directory_hxx #define @KWSYS_NAMESPACE@_Directory_hxx
#include <@KWSYS_NAMESPACE@/Configure.h> #include <@KWSYS_NAMESPACE@/Configure.h>
#include <@KWSYS_NAMESPACE@/stl/string> #include <string>
/* Define these macros temporarily to keep the code readable. */
#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
# define kwsys_stl @KWSYS_NAMESPACE@_stl
#endif
namespace @KWSYS_NAMESPACE@ namespace @KWSYS_NAMESPACE@
{ {
@ -44,7 +39,7 @@ public:
* in that directory. 0 is returned if the directory can not be * in that directory. 0 is returned if the directory can not be
* opened, 1 if it is opened. * opened, 1 if it is opened.
*/ */
bool Load(const kwsys_stl::string&); bool Load(const std::string&);
/** /**
* Return the number of files in the current directory. * Return the number of files in the current directory.
@ -55,7 +50,7 @@ public:
* Return the number of files in the specified directory. * Return the number of files in the specified directory.
* A higher performance static method. * A higher performance static method.
*/ */
static unsigned long GetNumberOfFilesInDirectory(const kwsys_stl::string&); static unsigned long GetNumberOfFilesInDirectory(const std::string&);
/** /**
* Return the file at the given index, the indexing is 0 based * Return the file at the given index, the indexing is 0 based
@ -83,9 +78,4 @@ private:
} // namespace @KWSYS_NAMESPACE@ } // namespace @KWSYS_NAMESPACE@
/* Undefine temporary macros. */
#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
# undef kwsys_stl
#endif
#endif #endif

View File

@ -40,7 +40,7 @@ namespace KWSYS_NAMESPACE
{ {
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const kwsys_stl::string& libname ) DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const std::string& libname )
{ {
return shl_load(libname.c_str(), BIND_DEFERRED | DYNAMIC_PATH, 0L); return shl_load(libname.c_str(), BIND_DEFERRED | DYNAMIC_PATH, 0L);
} }
@ -57,7 +57,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
DynamicLoader::SymbolPointer DynamicLoader::SymbolPointer
DynamicLoader::GetSymbolAddress(DynamicLoader::LibraryHandle lib, const kwsys_stl::string& sym) DynamicLoader::GetSymbolAddress(DynamicLoader::LibraryHandle lib, const std::string& sym)
{ {
void* addr; void* addr;
int status; int status;
@ -115,7 +115,7 @@ namespace KWSYS_NAMESPACE
{ {
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const kwsys_stl::string& libname ) DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const std::string& libname )
{ {
NSObjectFileImageReturnCode rc; NSObjectFileImageReturnCode rc;
NSObjectFileImage image = 0; NSObjectFileImage image = 0;
@ -146,7 +146,7 @@ int DynamicLoader::CloseLibrary( DynamicLoader::LibraryHandle lib)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
DynamicLoader::LibraryHandle lib, const kwsys_stl::string& sym) DynamicLoader::LibraryHandle lib, const std::string& sym)
{ {
void *result=0; void *result=0;
// Need to prepend symbols with '_' on Apple-gcc compilers // Need to prepend symbols with '_' on Apple-gcc compilers
@ -187,7 +187,7 @@ namespace KWSYS_NAMESPACE
{ {
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const kwsys_stl::string& libname) DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const std::string& libname)
{ {
DynamicLoader::LibraryHandle lh; DynamicLoader::LibraryHandle lh;
int length = MultiByteToWideChar(CP_UTF8, 0, libname.c_str(), -1, NULL, 0); int length = MultiByteToWideChar(CP_UTF8, 0, libname.c_str(), -1, NULL, 0);
@ -207,7 +207,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
DynamicLoader::LibraryHandle lib, const kwsys_stl::string& sym) DynamicLoader::LibraryHandle lib, const std::string& sym)
{ {
// TODO: The calling convention affects the name of the symbol. We // TODO: The calling convention affects the name of the symbol. We
// should have a tool to help get the symbol with the desired // should have a tool to help get the symbol with the desired
@ -302,7 +302,7 @@ namespace KWSYS_NAMESPACE
static image_id last_dynamic_err = B_OK; static image_id last_dynamic_err = B_OK;
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const kwsys_stl::string& libname ) DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const std::string& libname )
{ {
// image_id's are integers, errors are negative. Add one just in case we // image_id's are integers, errors are negative. Add one just in case we
// get a valid image_id of zero (is that even possible?). // get a valid image_id of zero (is that even possible?).
@ -340,7 +340,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
DynamicLoader::LibraryHandle lib, const kwsys_stl::string& sym) DynamicLoader::LibraryHandle lib, const std::string& sym)
{ {
// Hack to cast pointer-to-data to pointer-to-function. // Hack to cast pointer-to-data to pointer-to-function.
union union
@ -393,7 +393,7 @@ namespace KWSYS_NAMESPACE
{ {
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const kwsys_stl::string& libname ) DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const std::string& libname )
{ {
return 0; return 0;
} }
@ -411,7 +411,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
DynamicLoader::LibraryHandle lib, const kwsys_stl::string& sym) DynamicLoader::LibraryHandle lib, const std::string& sym)
{ {
return 0; return 0;
} }
@ -437,7 +437,7 @@ namespace KWSYS_NAMESPACE
{ {
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const kwsys_stl::string& libname ) DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const std::string& libname )
{ {
char *name = (char *)calloc(1, libname.size() + 1); char *name = (char *)calloc(1, libname.size() + 1);
dld_init(program_invocation_name); dld_init(program_invocation_name);
@ -456,7 +456,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
DynamicLoader::LibraryHandle lib, const kwsys_stl::string& sym) DynamicLoader::LibraryHandle lib, const std::string& sym)
{ {
// Hack to cast pointer-to-data to pointer-to-function. // Hack to cast pointer-to-data to pointer-to-function.
union union
@ -489,7 +489,7 @@ namespace KWSYS_NAMESPACE
{ {
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const kwsys_stl::string& libname ) DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const std::string& libname )
{ {
return dlopen(libname.c_str(), RTLD_LAZY); return dlopen(libname.c_str(), RTLD_LAZY);
} }
@ -508,7 +508,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
DynamicLoader::LibraryHandle lib, const kwsys_stl::string& sym) DynamicLoader::LibraryHandle lib, const std::string& sym)
{ {
// Hack to cast pointer-to-data to pointer-to-function. // Hack to cast pointer-to-data to pointer-to-function.
union union

View File

@ -12,8 +12,8 @@
#ifndef @KWSYS_NAMESPACE@_DynamicLoader_hxx #ifndef @KWSYS_NAMESPACE@_DynamicLoader_hxx
#define @KWSYS_NAMESPACE@_DynamicLoader_hxx #define @KWSYS_NAMESPACE@_DynamicLoader_hxx
#include <@KWSYS_NAMESPACE@/Configure.h> #include <@KWSYS_NAMESPACE@/Configure.hxx>
#include <@KWSYS_NAMESPACE@/stl/string> #include <string>
#if defined(__hpux) #if defined(__hpux)
#include <dl.h> #include <dl.h>
@ -28,11 +28,6 @@
#include <be/kernel/image.h> #include <be/kernel/image.h>
#endif #endif
/* Define these macros temporarily to keep the code readable. */
#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
# define kwsys_stl @KWSYS_NAMESPACE@_stl
#endif
namespace @KWSYS_NAMESPACE@ namespace @KWSYS_NAMESPACE@
{ {
/** \class DynamicLoader /** \class DynamicLoader
@ -83,14 +78,14 @@ public:
/** Load a dynamic library into the current process. /** Load a dynamic library into the current process.
* The returned LibraryHandle can be used to access the symbols in the * The returned LibraryHandle can be used to access the symbols in the
* library. */ * library. */
static LibraryHandle OpenLibrary(const kwsys_stl::string&); static LibraryHandle OpenLibrary(const std::string&);
/** Attempt to detach a dynamic library from the /** Attempt to detach a dynamic library from the
* process. A value of true is returned if it is sucessful. */ * process. A value of true is returned if it is sucessful. */
static int CloseLibrary(LibraryHandle); static int CloseLibrary(LibraryHandle);
/** Find the address of the symbol in the given library. */ /** Find the address of the symbol in the given library. */
static SymbolPointer GetSymbolAddress(LibraryHandle, const kwsys_stl::string&); static SymbolPointer GetSymbolAddress(LibraryHandle, const std::string&);
/** Return the default module prefix for the current platform. */ /** Return the default module prefix for the current platform. */
static const char* LibPrefix() { return "@KWSYS_DynamicLoader_PREFIX@"; } static const char* LibPrefix() { return "@KWSYS_DynamicLoader_PREFIX@"; }
@ -104,9 +99,4 @@ public:
} // namespace @KWSYS_NAMESPACE@ } // namespace @KWSYS_NAMESPACE@
/* Undefine temporary macros. */
#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
# undef kwsys_stl
#endif
#endif #endif

View File

@ -13,13 +13,8 @@
#define @KWSYS_NAMESPACE@_Encoding_hxx #define @KWSYS_NAMESPACE@_Encoding_hxx
#include <@KWSYS_NAMESPACE@/Configure.hxx> #include <@KWSYS_NAMESPACE@/Configure.hxx>
#include <@KWSYS_NAMESPACE@/stl/string> #include <string>
#include <@KWSYS_NAMESPACE@/stl/vector> #include <vector>
/* Define these macros temporarily to keep the code readable. */
#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
# define kwsys_stl @KWSYS_NAMESPACE@_stl
#endif
namespace @KWSYS_NAMESPACE@ namespace @KWSYS_NAMESPACE@
{ {
@ -65,23 +60,18 @@ public:
// Convert a narrow string to a wide string. // Convert a narrow string to a wide string.
// On Windows, UTF-8 is assumed, and on other platforms, // On Windows, UTF-8 is assumed, and on other platforms,
// the current locale is assumed. // the current locale is assumed.
static kwsys_stl::wstring ToWide(const kwsys_stl::string& str); static std::wstring ToWide(const std::string& str);
static kwsys_stl::wstring ToWide(const char* str); static std::wstring ToWide(const char* str);
// Convert a wide string to a narrow string. // Convert a wide string to a narrow string.
// On Windows, UTF-8 is assumed, and on other platforms, // On Windows, UTF-8 is assumed, and on other platforms,
// the current locale is assumed. // the current locale is assumed.
static kwsys_stl::string ToNarrow(const kwsys_stl::wstring& str); static std::string ToNarrow(const std::wstring& str);
static kwsys_stl::string ToNarrow(const wchar_t* str); static std::string ToNarrow(const wchar_t* str);
#endif // @KWSYS_NAMESPACE@_STL_HAS_WSTRING #endif // @KWSYS_NAMESPACE@_STL_HAS_WSTRING
}; // class Encoding }; // class Encoding
} // namespace @KWSYS_NAMESPACE@ } // namespace @KWSYS_NAMESPACE@
/* Undefine temporary macros. */
#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
# undef kwsys_stl
#endif
#endif #endif

View File

@ -19,7 +19,6 @@
#include "kwsysPrivate.h" #include "kwsysPrivate.h"
#include KWSYS_HEADER(Encoding.hxx) #include KWSYS_HEADER(Encoding.hxx)
#include KWSYS_HEADER(Encoding.h) #include KWSYS_HEADER(Encoding.h)
#include KWSYS_HEADER(stl/vector)
// Work-around CMake dependency scanning limitation. This must // Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers. // duplicate the above list of headers.
@ -28,6 +27,7 @@
# include "Encoding.h.in" # include "Encoding.h.in"
#endif #endif
#include <vector>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -140,23 +140,23 @@ char const* const* Encoding::CommandLineArguments::argv() const
#if KWSYS_STL_HAS_WSTRING #if KWSYS_STL_HAS_WSTRING
kwsys_stl::wstring Encoding::ToWide(const kwsys_stl::string& str) std::wstring Encoding::ToWide(const std::string& str)
{ {
return ToWide(str.c_str()); return ToWide(str.c_str());
} }
kwsys_stl::string Encoding::ToNarrow(const kwsys_stl::wstring& str) std::string Encoding::ToNarrow(const std::wstring& str)
{ {
return ToNarrow(str.c_str()); return ToNarrow(str.c_str());
} }
kwsys_stl::wstring Encoding::ToWide(const char* cstr) std::wstring Encoding::ToWide(const char* cstr)
{ {
kwsys_stl::wstring wstr; std::wstring wstr;
size_t length = kwsysEncoding_mbstowcs(0, cstr, 0) + 1; size_t length = kwsysEncoding_mbstowcs(0, cstr, 0) + 1;
if(length > 0) if(length > 0)
{ {
kwsys_stl::vector<wchar_t> wchars(length); std::vector<wchar_t> wchars(length);
if(kwsysEncoding_mbstowcs(&wchars[0], cstr, length) > 0) if(kwsysEncoding_mbstowcs(&wchars[0], cstr, length) > 0)
{ {
wstr = &wchars[0]; wstr = &wchars[0];
@ -165,9 +165,9 @@ kwsys_stl::wstring Encoding::ToWide(const char* cstr)
return wstr; return wstr;
} }
kwsys_stl::string Encoding::ToNarrow(const wchar_t* wcstr) std::string Encoding::ToNarrow(const wchar_t* wcstr)
{ {
kwsys_stl::string str; std::string str;
size_t length = kwsysEncoding_wcstombs(0, wcstr, 0) + 1; size_t length = kwsysEncoding_wcstombs(0, wcstr, 0) + 1;
if(length > 0) if(length > 0)
{ {

View File

@ -12,8 +12,8 @@
#ifndef @KWSYS_NAMESPACE@_FStream_hxx #ifndef @KWSYS_NAMESPACE@_FStream_hxx
#define @KWSYS_NAMESPACE@_FStream_hxx #define @KWSYS_NAMESPACE@_FStream_hxx
#include <@KWSYS_NAMESPACE@/ios/fstream>
#include <@KWSYS_NAMESPACE@/Encoding.hxx> #include <@KWSYS_NAMESPACE@/Encoding.hxx>
#include <fstream>
namespace @KWSYS_NAMESPACE@ namespace @KWSYS_NAMESPACE@
{ {
@ -167,8 +167,8 @@ class basic_ofstream : public std::basic_ostream<CharType,Traits>
# undef @KWSYS_NAMESPACE@_FStream_NOEXCEPT # undef @KWSYS_NAMESPACE@_FStream_NOEXCEPT
#else #else
using @KWSYS_NAMESPACE@_ios_namespace::ofstream; using std::ofstream;
using @KWSYS_NAMESPACE@_ios_namespace::ifstream; using std::ifstream;
#endif #endif
namespace FStream namespace FStream

View File

@ -17,9 +17,6 @@
#include KWSYS_HEADER(RegularExpression.hxx) #include KWSYS_HEADER(RegularExpression.hxx)
#include KWSYS_HEADER(SystemTools.hxx) #include KWSYS_HEADER(SystemTools.hxx)
#include KWSYS_HEADER(Directory.hxx) #include KWSYS_HEADER(Directory.hxx)
#include KWSYS_HEADER(stl/string)
#include KWSYS_HEADER(stl/vector)
#include KWSYS_HEADER(stl/algorithm)
// Work-around CMake dependency scanning limitation. This must // Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers. // duplicate the above list of headers.
@ -29,12 +26,12 @@
# include "Configure.hxx.in" # include "Configure.hxx.in"
# include "RegularExpression.hxx.in" # include "RegularExpression.hxx.in"
# include "SystemTools.hxx.in" # include "SystemTools.hxx.in"
# include "kwsys_stl.hxx.in"
# include "kwsys_stl_string.hxx.in"
# include "kwsys_stl_vector.hxx.in"
# include "kwsys_stl_algorithm.hxx.in"
#endif #endif
#include <string>
#include <vector>
#include <algorithm>
#include <ctype.h> #include <ctype.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -54,8 +51,8 @@ namespace KWSYS_NAMESPACE
class GlobInternals class GlobInternals
{ {
public: public:
kwsys_stl::vector<kwsys_stl::string> Files; std::vector<std::string> Files;
kwsys_stl::vector<kwsys::RegularExpression> Expressions; std::vector<kwsys::RegularExpression> Expressions;
}; };
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -82,21 +79,21 @@ Glob::~Glob()
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
kwsys_stl::vector<kwsys_stl::string>& Glob::GetFiles() std::vector<std::string>& Glob::GetFiles()
{ {
return this->Internals->Files; return this->Internals->Files;
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
kwsys_stl::string Glob::PatternToRegex(const kwsys_stl::string& pattern, std::string Glob::PatternToRegex(const std::string& pattern,
bool require_whole_string, bool require_whole_string,
bool preserve_case) bool preserve_case)
{ {
// Incrementally build the regular expression from the pattern. // Incrementally build the regular expression from the pattern.
kwsys_stl::string regex = require_whole_string? "^" : ""; std::string regex = require_whole_string? "^" : "";
kwsys_stl::string::const_iterator pattern_first = pattern.begin(); std::string::const_iterator pattern_first = pattern.begin();
kwsys_stl::string::const_iterator pattern_last = pattern.end(); std::string::const_iterator pattern_last = pattern.end();
for(kwsys_stl::string::const_iterator i = pattern_first; for(std::string::const_iterator i = pattern_first;
i != pattern_last; ++i) i != pattern_last; ++i)
{ {
int c = *i; int c = *i;
@ -120,8 +117,8 @@ kwsys_stl::string Glob::PatternToRegex(const kwsys_stl::string& pattern,
{ {
// Parse out the bracket expression. It begins just after the // Parse out the bracket expression. It begins just after the
// opening character. // opening character.
kwsys_stl::string::const_iterator bracket_first = i+1; std::string::const_iterator bracket_first = i+1;
kwsys_stl::string::const_iterator bracket_last = bracket_first; std::string::const_iterator bracket_last = bracket_first;
// The first character may be complementation '!' or '^'. // The first character may be complementation '!' or '^'.
if(bracket_last != pattern_last && if(bracket_last != pattern_last &&
@ -153,7 +150,7 @@ kwsys_stl::string Glob::PatternToRegex(const kwsys_stl::string& pattern,
else else
{ {
// Convert the bracket string to its regex equivalent. // Convert the bracket string to its regex equivalent.
kwsys_stl::string::const_iterator k = bracket_first; std::string::const_iterator k = bracket_first;
// Open the regex block. // Open the regex block.
regex += "["; regex += "[";
@ -221,8 +218,8 @@ kwsys_stl::string Glob::PatternToRegex(const kwsys_stl::string& pattern,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool Glob::RecurseDirectory(kwsys_stl::string::size_type start, bool Glob::RecurseDirectory(std::string::size_type start,
const kwsys_stl::string& dir, GlobMessages* messages) const std::string& dir, GlobMessages* messages)
{ {
kwsys::Directory d; kwsys::Directory d;
if ( !d.Load(dir) ) if ( !d.Load(dir) )
@ -230,8 +227,8 @@ bool Glob::RecurseDirectory(kwsys_stl::string::size_type start,
return true; return true;
} }
unsigned long cc; unsigned long cc;
kwsys_stl::string realname; std::string realname;
kwsys_stl::string fname; std::string fname;
for ( cc = 0; cc < d.GetNumberOfFiles(); cc ++ ) for ( cc = 0; cc < d.GetNumberOfFiles(); cc ++ )
{ {
fname = d.GetFile(cc); fname = d.GetFile(cc);
@ -262,8 +259,8 @@ bool Glob::RecurseDirectory(kwsys_stl::string::size_type start,
if (isSymLink) if (isSymLink)
{ {
++this->FollowedSymlinkCount; ++this->FollowedSymlinkCount;
kwsys_stl::string realPathErrorMessage; std::string realPathErrorMessage;
kwsys_stl::string canonicalPath(SystemTools::GetRealPath(dir, std::string canonicalPath(SystemTools::GetRealPath(dir,
&realPathErrorMessage)); &realPathErrorMessage));
if(!realPathErrorMessage.empty()) if(!realPathErrorMessage.empty())
@ -277,7 +274,7 @@ bool Glob::RecurseDirectory(kwsys_stl::string::size_type start,
return false; return false;
} }
if(kwsys_stl::find(this->VisitedSymlinks.begin(), if(std::find(this->VisitedSymlinks.begin(),
this->VisitedSymlinks.end(), this->VisitedSymlinks.end(),
canonicalPath) == this->VisitedSymlinks.end()) canonicalPath) == this->VisitedSymlinks.end())
{ {
@ -299,9 +296,9 @@ bool Glob::RecurseDirectory(kwsys_stl::string::size_type start,
// else we have already visited this symlink - prevent cyclic recursion // else we have already visited this symlink - prevent cyclic recursion
else if(messages) else if(messages)
{ {
kwsys_stl::string message; std::string message;
for(kwsys_stl::vector<kwsys_stl::string>::const_iterator for(std::vector<std::string>::const_iterator
pathIt = kwsys_stl::find(this->VisitedSymlinks.begin(), pathIt = std::find(this->VisitedSymlinks.begin(),
this->VisitedSymlinks.end(), this->VisitedSymlinks.end(),
canonicalPath); canonicalPath);
pathIt != this->VisitedSymlinks.end(); ++pathIt) pathIt != this->VisitedSymlinks.end(); ++pathIt)
@ -338,10 +335,10 @@ bool Glob::RecurseDirectory(kwsys_stl::string::size_type start,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void Glob::ProcessDirectory(kwsys_stl::string::size_type start, void Glob::ProcessDirectory(std::string::size_type start,
const kwsys_stl::string& dir, GlobMessages* messages) const std::string& dir, GlobMessages* messages)
{ {
//kwsys_ios::cout << "ProcessDirectory: " << dir << kwsys_ios::endl; //std::cout << "ProcessDirectory: " << dir << std::endl;
bool last = ( start == this->Internals->Expressions.size()-1 ); bool last = ( start == this->Internals->Expressions.size()-1 );
if ( last && this->Recurse ) if ( last && this->Recurse )
{ {
@ -360,8 +357,8 @@ void Glob::ProcessDirectory(kwsys_stl::string::size_type start,
return; return;
} }
unsigned long cc; unsigned long cc;
kwsys_stl::string realname; std::string realname;
kwsys_stl::string fname; std::string fname;
for ( cc = 0; cc < d.GetNumberOfFiles(); cc ++ ) for ( cc = 0; cc < d.GetNumberOfFiles(); cc ++ )
{ {
fname = d.GetFile(cc); fname = d.GetFile(cc);
@ -384,10 +381,10 @@ void Glob::ProcessDirectory(kwsys_stl::string::size_type start,
fname = kwsys::SystemTools::LowerCase(fname); fname = kwsys::SystemTools::LowerCase(fname);
#endif #endif
//kwsys_ios::cout << "Look at file: " << fname << kwsys_ios::endl; //std::cout << "Look at file: " << fname << std::endl;
//kwsys_ios::cout << "Match: " //std::cout << "Match: "
// << this->Internals->TextExpressions[start].c_str() << kwsys_ios::endl; // << this->Internals->TextExpressions[start].c_str() << std::endl;
//kwsys_ios::cout << "Real name: " << realname << kwsys_ios::endl; //std::cout << "Real name: " << realname << std::endl;
if( (!last && !kwsys::SystemTools::FileIsDirectory(realname)) if( (!last && !kwsys::SystemTools::FileIsDirectory(realname))
|| (!this->ListDirs && last && || (!this->ListDirs && last &&
@ -411,11 +408,11 @@ void Glob::ProcessDirectory(kwsys_stl::string::size_type start,
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool Glob::FindFiles(const kwsys_stl::string& inexpr, GlobMessages* messages) bool Glob::FindFiles(const std::string& inexpr, GlobMessages* messages)
{ {
kwsys_stl::string cexpr; std::string cexpr;
kwsys_stl::string::size_type cc; std::string::size_type cc;
kwsys_stl::string expr = inexpr; std::string expr = inexpr;
this->Internals->Expressions.clear(); this->Internals->Expressions.clear();
this->Internals->Files.clear(); this->Internals->Files.clear();
@ -425,10 +422,10 @@ bool Glob::FindFiles(const kwsys_stl::string& inexpr, GlobMessages* messages)
expr = kwsys::SystemTools::GetCurrentWorkingDirectory(); expr = kwsys::SystemTools::GetCurrentWorkingDirectory();
expr += "/" + inexpr; expr += "/" + inexpr;
} }
kwsys_stl::string fexpr = expr; std::string fexpr = expr;
kwsys_stl::string::size_type skip = 0; std::string::size_type skip = 0;
kwsys_stl::string::size_type last_slash = 0; std::string::size_type last_slash = 0;
for ( cc = 0; cc < expr.size(); cc ++ ) for ( cc = 0; cc < expr.size(); cc ++ )
{ {
if ( cc > 0 && expr[cc] == '/' && expr[cc-1] != '\\' ) if ( cc > 0 && expr[cc] == '/' && expr[cc-1] != '\\' )
@ -444,8 +441,8 @@ bool Glob::FindFiles(const kwsys_stl::string& inexpr, GlobMessages* messages)
} }
if ( last_slash > 0 ) if ( last_slash > 0 )
{ {
//kwsys_ios::cout << "I can skip: " << fexpr.substr(0, last_slash) //std::cout << "I can skip: " << fexpr.substr(0, last_slash)
// << kwsys_ios::endl; // << std::endl;
skip = last_slash; skip = last_slash;
} }
if ( skip == 0 ) if ( skip == 0 )
@ -517,7 +514,7 @@ bool Glob::FindFiles(const kwsys_stl::string& inexpr, GlobMessages* messages)
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void Glob::AddExpression(const kwsys_stl::string& expr) void Glob::AddExpression(const std::string& expr)
{ {
this->Internals->Expressions.push_back( this->Internals->Expressions.push_back(
kwsys::RegularExpression( kwsys::RegularExpression(
@ -546,7 +543,7 @@ const char* Glob::GetRelative()
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void Glob::AddFile(kwsys_stl::vector<kwsys_stl::string>& files, const kwsys_stl::string& file) void Glob::AddFile(std::vector<std::string>& files, const std::string& file)
{ {
if ( !this->Relative.empty() ) if ( !this->Relative.empty() )
{ {

View File

@ -15,13 +15,8 @@
#include <@KWSYS_NAMESPACE@/Configure.h> #include <@KWSYS_NAMESPACE@/Configure.h>
#include <@KWSYS_NAMESPACE@/Configure.hxx> #include <@KWSYS_NAMESPACE@/Configure.hxx>
#include <@KWSYS_NAMESPACE@/stl/string> #include <string>
#include <@KWSYS_NAMESPACE@/stl/vector> #include <vector>
/* 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
namespace @KWSYS_NAMESPACE@ namespace @KWSYS_NAMESPACE@
{ {
@ -49,9 +44,9 @@ public:
struct Message struct Message
{ {
MessageType type; MessageType type;
kwsys_stl::string content; std::string content;
Message(MessageType t, const kwsys_stl::string& c) : Message(MessageType t, const std::string& c) :
type(t), type(t),
content(c) content(c)
{} {}
@ -67,18 +62,18 @@ public:
} }
}; };
typedef kwsys_stl::vector<Message> GlobMessages; typedef std::vector<Message> GlobMessages;
typedef kwsys_stl::vector<Message>::iterator GlobMessagesIterator; typedef std::vector<Message>::iterator GlobMessagesIterator;
public: public:
Glob(); Glob();
~Glob(); ~Glob();
//! Find all files that match the pattern. //! Find all files that match the pattern.
bool FindFiles(const kwsys_stl::string& inexpr, bool FindFiles(const std::string& inexpr,
GlobMessages* messages = 0); GlobMessages* messages = 0);
//! Return the list of files that matched. //! Return the list of files that matched.
kwsys_stl::vector<kwsys_stl::string>& GetFiles(); std::vector<std::string>& GetFiles();
//! Set recurse to true to match subdirectories. //! Set recurse to true to match subdirectories.
void RecurseOn() { this->SetRecurse(true); } void RecurseOn() { this->SetRecurse(true); }
@ -107,7 +102,7 @@ public:
string. This is on by default because patterns always match string. This is on by default because patterns always match
whole strings, but may be disabled to support concatenating whole strings, but may be disabled to support concatenating
expressions more easily (regex1|regex2|etc). */ expressions more easily (regex1|regex2|etc). */
static kwsys_stl::string PatternToRegex(const kwsys_stl::string& pattern, static std::string PatternToRegex(const std::string& pattern,
bool require_whole_string = true, bool require_whole_string = true,
bool preserve_case = false); bool preserve_case = false);
@ -122,28 +117,28 @@ public:
protected: protected:
//! Process directory //! Process directory
void ProcessDirectory(kwsys_stl::string::size_type start, void ProcessDirectory(std::string::size_type start,
const kwsys_stl::string& dir, const std::string& dir,
GlobMessages* messages); GlobMessages* messages);
//! Process last directory, but only when recurse flags is on. That is //! Process last directory, but only when recurse flags is on. That is
// effectively like saying: /path/to/file/**/file // effectively like saying: /path/to/file/**/file
bool RecurseDirectory(kwsys_stl::string::size_type start, bool RecurseDirectory(std::string::size_type start,
const kwsys_stl::string& dir, const std::string& dir,
GlobMessages* messages); GlobMessages* messages);
//! Add regular expression //! Add regular expression
void AddExpression(const kwsys_stl::string& expr); void AddExpression(const std::string& expr);
//! Add a file to the list //! Add a file to the list
void AddFile(kwsys_stl::vector<kwsys_stl::string>& files, const kwsys_stl::string& file); void AddFile(std::vector<std::string>& files, const std::string& file);
GlobInternals* Internals; GlobInternals* Internals;
bool Recurse; bool Recurse;
kwsys_stl::string Relative; std::string Relative;
bool RecurseThroughSymlinks; bool RecurseThroughSymlinks;
unsigned int FollowedSymlinkCount; unsigned int FollowedSymlinkCount;
kwsys_stl::vector<kwsys_stl::string> VisitedSymlinks; std::vector<std::string> VisitedSymlinks;
bool ListDirs; bool ListDirs;
bool RecurseListDirs; bool RecurseListDirs;
@ -154,9 +149,4 @@ private:
} // namespace @KWSYS_NAMESPACE@ } // namespace @KWSYS_NAMESPACE@
/* Undefine temporary macro. */
#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
# undef kwsys_stl
#endif
#endif #endif

View File

@ -12,25 +12,14 @@
#include "kwsysPrivate.h" #include "kwsysPrivate.h"
#include KWSYS_HEADER(Configure.hxx) #include KWSYS_HEADER(Configure.hxx)
// Configure the implementation for the current streams library.
#if !KWSYS_IOS_USE_ANSI
# define ios_base ios
# if defined(__HP_aCC)
# define protected public
# include <iostream.h> // Hack access to some private stream methods.
# undef protected
# endif
#endif
// Include the streams library. // Include the streams library.
#include KWSYS_HEADER(ios/iostream) #include <iostream>
#include KWSYS_HEADER(IOStream.hxx) #include KWSYS_HEADER(IOStream.hxx)
// Work-around CMake dependency scanning limitation. This must // Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers. // duplicate the above list of headers.
#if 0 #if 0
# include "Configure.hxx.in" # include "Configure.hxx.in"
# include "kwsys_ios_iostream.hxx.in"
# include "IOStream.hxx.in" # include "IOStream.hxx.in"
#endif #endif
@ -50,7 +39,7 @@ namespace KWSYS_NAMESPACE
{ {
// Scan an input stream for an integer value. // Scan an input stream for an integer value.
static int IOStreamScanStream(kwsys_ios::istream& is, char* buffer) static int IOStreamScanStream(std::istream& is, char* buffer)
{ {
// Prepare to write to buffer. // Prepare to write to buffer.
char* out = buffer; char* out = buffer;
@ -64,10 +53,10 @@ static int IOStreamScanStream(kwsys_ios::istream& is, char* buffer)
// detect it from the input. A leading 0x means hex, and a leading // detect it from the input. A leading 0x means hex, and a leading
// 0 alone means octal. // 0 alone means octal.
int base = 0; int base = 0;
int flags = is.flags() & kwsys_ios::ios_base::basefield; int flags = is.flags() & std::ios_base::basefield;
if(flags == kwsys_ios::ios_base::oct) { base = 8; } if(flags == std::ios_base::oct) { base = 8; }
else if(flags == kwsys_ios::ios_base::dec) { base = 10; } else if(flags == std::ios_base::dec) { base = 10; }
else if(flags == kwsys_ios::ios_base::hex) { base = 16; } else if(flags == std::ios_base::hex) { base = 16; }
bool foundDigit = false; bool foundDigit = false;
bool foundNonZero = false; bool foundNonZero = false;
if(is.peek() == '0') if(is.peek() == '0')
@ -134,24 +123,17 @@ static int IOStreamScanStream(kwsys_ios::istream& is, char* buffer)
// Read an integer value from an input stream. // Read an integer value from an input stream.
template <class T> template <class T>
kwsys_ios::istream& std::istream&
IOStreamScanTemplate(kwsys_ios::istream& is, T& value, char type) IOStreamScanTemplate(std::istream& is, T& value, char type)
{ {
int state = kwsys_ios::ios_base::goodbit; int state = std::ios_base::goodbit;
// Skip leading whitespace. // Skip leading whitespace.
# if KWSYS_IOS_USE_ANSI std::istream::sentry okay(is);
kwsys_ios::istream::sentry okay(is);
# else
is.eatwhite();
kwsys_ios::istream& okay = is;
# endif
if(okay) if(okay)
{ {
# if KWSYS_IOS_USE_ANSI
try { try {
# endif
// Copy the string to a buffer and construct the format string. // Copy the string to a buffer and construct the format string.
char buffer[KWSYS_IOS_INT64_MAX_DIG]; char buffer[KWSYS_IOS_INT64_MAX_DIG];
# if defined(_MSC_VER) # if defined(_MSC_VER)
@ -174,52 +156,40 @@ IOStreamScanTemplate(kwsys_ios::istream& is, T& value, char type)
int success = (sscanf(buffer, format, &result) == 1)?1:0; int success = (sscanf(buffer, format, &result) == 1)?1:0;
// Set flags for resulting state. // Set flags for resulting state.
if(is.peek() == EOF) { state |= kwsys_ios::ios_base::eofbit; } if(is.peek() == EOF) { state |= std::ios_base::eofbit; }
if(!success) { state |= kwsys_ios::ios_base::failbit; } if(!success) { state |= std::ios_base::failbit; }
else { value = result; } else { value = result; }
# if KWSYS_IOS_USE_ANSI } catch(...) { state |= std::ios_base::badbit; }
} catch(...) { state |= kwsys_ios::ios_base::badbit; }
# endif
} }
# if KWSYS_IOS_USE_ANSI is.setstate(std::ios_base::iostate(state));
is.setstate(kwsys_ios::ios_base::iostate(state));
# else
is.clear(state);
# endif
return is; return is;
} }
// Print an integer value to an output stream. // Print an integer value to an output stream.
template <class T> template <class T>
kwsys_ios::ostream& std::ostream&
IOStreamPrintTemplate(kwsys_ios::ostream& os, T value, char type) IOStreamPrintTemplate(std::ostream& os, T value, char type)
{ {
# if KWSYS_IOS_USE_ANSI std::ostream::sentry okay(os);
kwsys_ios::ostream::sentry okay(os);
# else
kwsys_ios::ostream& okay = os;
# endif
if(okay) if(okay)
{ {
# if KWSYS_IOS_USE_ANSI
try { try {
# endif
// Construct the format string. // Construct the format string.
char format[8]; char format[8];
char* f = format; char* f = format;
*f++ = '%'; *f++ = '%';
if(os.flags() & kwsys_ios::ios_base::showpos) { *f++ = '+'; } if(os.flags() & std::ios_base::showpos) { *f++ = '+'; }
if(os.flags() & kwsys_ios::ios_base::showbase) { *f++ = '#'; } if(os.flags() & std::ios_base::showbase) { *f++ = '#'; }
# if defined(_MSC_VER) # if defined(_MSC_VER)
*f++ = 'I'; *f++ = '6'; *f++ = '4'; *f++ = 'I'; *f++ = '6'; *f++ = '4';
# else # else
*f++ = 'l'; *f++ = 'l'; *f++ = 'l'; *f++ = 'l';
# endif # endif
long bflags = os.flags() & kwsys_ios::ios_base::basefield; long bflags = os.flags() & std::ios_base::basefield;
if(bflags == kwsys_ios::ios_base::oct) { *f++ = 'o'; } if(bflags == std::ios_base::oct) { *f++ = 'o'; }
else if(bflags != kwsys_ios::ios_base::hex) { *f++ = type; } else if(bflags != std::ios_base::hex) { *f++ = type; }
else if(os.flags() & kwsys_ios::ios_base::uppercase) { *f++ = 'X'; } else if(os.flags() & std::ios_base::uppercase) { *f++ = 'X'; }
else { *f++ = 'x'; } else { *f++ = 'x'; }
*f = '\0'; *f = '\0';
@ -228,22 +198,20 @@ IOStreamPrintTemplate(kwsys_ios::ostream& os, T value, char type)
char buffer[2*KWSYS_IOS_INT64_MAX_DIG]; char buffer[2*KWSYS_IOS_INT64_MAX_DIG];
sprintf(buffer, format, value); sprintf(buffer, format, value);
os << buffer; os << buffer;
# if KWSYS_IOS_USE_ANSI } catch(...) { os.clear(os.rdstate() | std::ios_base::badbit); }
} catch(...) { os.clear(os.rdstate() | kwsys_ios::ios_base::badbit); }
# endif
} }
return os; return os;
} }
# if !KWSYS_IOS_HAS_ISTREAM_LONG_LONG # if !KWSYS_IOS_HAS_ISTREAM_LONG_LONG
// Implement input stream operator for IOStreamSLL. // Implement input stream operator for IOStreamSLL.
kwsys_ios::istream& IOStreamScan(kwsys_ios::istream& is, IOStreamSLL& value) std::istream& IOStreamScan(std::istream& is, IOStreamSLL& value)
{ {
return IOStreamScanTemplate(is, value, 'd'); return IOStreamScanTemplate(is, value, 'd');
} }
// Implement input stream operator for IOStreamULL. // Implement input stream operator for IOStreamULL.
kwsys_ios::istream& IOStreamScan(kwsys_ios::istream& is, IOStreamULL& value) std::istream& IOStreamScan(std::istream& is, IOStreamULL& value)
{ {
return IOStreamScanTemplate(is, value, 'u'); return IOStreamScanTemplate(is, value, 'u');
} }
@ -251,13 +219,13 @@ kwsys_ios::istream& IOStreamScan(kwsys_ios::istream& is, IOStreamULL& value)
# if !KWSYS_IOS_HAS_OSTREAM_LONG_LONG # if !KWSYS_IOS_HAS_OSTREAM_LONG_LONG
// Implement output stream operator for IOStreamSLL. // Implement output stream operator for IOStreamSLL.
kwsys_ios::ostream& IOStreamPrint(kwsys_ios::ostream& os, IOStreamSLL value) std::ostream& IOStreamPrint(std::ostream& os, IOStreamSLL value)
{ {
return IOStreamPrintTemplate(os, value, 'd'); return IOStreamPrintTemplate(os, value, 'd');
} }
// Implement output stream operator for IOStreamULL. // Implement output stream operator for IOStreamULL.
kwsys_ios::ostream& IOStreamPrint(kwsys_ios::ostream& os, IOStreamULL value) std::ostream& IOStreamPrint(std::ostream& os, IOStreamULL value)
{ {
return IOStreamPrintTemplate(os, value, 'u'); return IOStreamPrintTemplate(os, value, 'u');
} }

View File

@ -12,12 +12,11 @@
#ifndef @KWSYS_NAMESPACE@_IOStream_hxx #ifndef @KWSYS_NAMESPACE@_IOStream_hxx
#define @KWSYS_NAMESPACE@_IOStream_hxx #define @KWSYS_NAMESPACE@_IOStream_hxx
#include <@KWSYS_NAMESPACE@/ios/iosfwd> #include <iosfwd>
/* Define these macros temporarily to keep the code readable. */ /* Define these macros temporarily to keep the code readable. */
#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS #if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
# define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT # define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT
# define kwsys_ios @KWSYS_NAMESPACE@_ios
#endif #endif
/* Whether istream supports long long. */ /* Whether istream supports long long. */
@ -56,10 +55,8 @@
/* Input stream operator implementation functions. */ /* Input stream operator implementation functions. */
namespace @KWSYS_NAMESPACE@ namespace @KWSYS_NAMESPACE@
{ {
kwsysEXPORT kwsys_ios::istream& IOStreamScan(kwsys_ios::istream&, kwsysEXPORT std::istream& IOStreamScan(std::istream&, IOStreamSLL&);
IOStreamSLL&); kwsysEXPORT std::istream& IOStreamScan(std::istream&, IOStreamULL&);
kwsysEXPORT kwsys_ios::istream& IOStreamScan(kwsys_ios::istream&,
IOStreamULL&);
} }
/* Provide input stream operator for long long. */ /* Provide input stream operator for long long. */
@ -67,8 +64,8 @@ kwsysEXPORT kwsys_ios::istream& IOStreamScan(kwsys_ios::istream&,
!defined(KWSYS_IOS_ISTREAM_LONG_LONG_DEFINED) !defined(KWSYS_IOS_ISTREAM_LONG_LONG_DEFINED)
# define KWSYS_IOS_ISTREAM_LONG_LONG_DEFINED # define KWSYS_IOS_ISTREAM_LONG_LONG_DEFINED
# define @KWSYS_NAMESPACE@_IOS_ISTREAM_LONG_LONG_DEFINED # define @KWSYS_NAMESPACE@_IOS_ISTREAM_LONG_LONG_DEFINED
inline kwsys_ios::istream& inline std::istream&
operator>>(kwsys_ios::istream& is, @KWSYS_NAMESPACE@::IOStreamSLL& value) operator>>(std::istream& is, @KWSYS_NAMESPACE@::IOStreamSLL& value)
{ {
return @KWSYS_NAMESPACE@::IOStreamScan(is, value); return @KWSYS_NAMESPACE@::IOStreamScan(is, value);
} }
@ -79,8 +76,8 @@ operator>>(kwsys_ios::istream& is, @KWSYS_NAMESPACE@::IOStreamSLL& value)
!defined(KWSYS_IOS_ISTREAM_UNSIGNED_LONG_LONG_DEFINED) !defined(KWSYS_IOS_ISTREAM_UNSIGNED_LONG_LONG_DEFINED)
# define KWSYS_IOS_ISTREAM_UNSIGNED_LONG_LONG_DEFINED # define KWSYS_IOS_ISTREAM_UNSIGNED_LONG_LONG_DEFINED
# define @KWSYS_NAMESPACE@_IOS_ISTREAM_UNSIGNED_LONG_LONG_DEFINED # define @KWSYS_NAMESPACE@_IOS_ISTREAM_UNSIGNED_LONG_LONG_DEFINED
inline kwsys_ios::istream& inline std::istream&
operator>>(kwsys_ios::istream& is, @KWSYS_NAMESPACE@::IOStreamULL& value) operator>>(std::istream& is, @KWSYS_NAMESPACE@::IOStreamULL& value)
{ {
return @KWSYS_NAMESPACE@::IOStreamScan(is, value); return @KWSYS_NAMESPACE@::IOStreamScan(is, value);
} }
@ -92,10 +89,8 @@ operator>>(kwsys_ios::istream& is, @KWSYS_NAMESPACE@::IOStreamULL& value)
/* Output stream operator implementation functions. */ /* Output stream operator implementation functions. */
namespace @KWSYS_NAMESPACE@ namespace @KWSYS_NAMESPACE@
{ {
kwsysEXPORT kwsys_ios::ostream& IOStreamPrint(kwsys_ios::ostream&, kwsysEXPORT std::ostream& IOStreamPrint(std::ostream&, IOStreamSLL);
IOStreamSLL); kwsysEXPORT std::ostream& IOStreamPrint(std::ostream&, IOStreamULL);
kwsysEXPORT kwsys_ios::ostream& IOStreamPrint(kwsys_ios::ostream&,
IOStreamULL);
} }
/* Provide output stream operator for long long. */ /* Provide output stream operator for long long. */
@ -103,8 +98,8 @@ kwsysEXPORT kwsys_ios::ostream& IOStreamPrint(kwsys_ios::ostream&,
!defined(KWSYS_IOS_OSTREAM_LONG_LONG_DEFINED) !defined(KWSYS_IOS_OSTREAM_LONG_LONG_DEFINED)
# define KWSYS_IOS_OSTREAM_LONG_LONG_DEFINED # define KWSYS_IOS_OSTREAM_LONG_LONG_DEFINED
# define @KWSYS_NAMESPACE@_IOS_OSTREAM_LONG_LONG_DEFINED # define @KWSYS_NAMESPACE@_IOS_OSTREAM_LONG_LONG_DEFINED
inline kwsys_ios::ostream& inline std::ostream&
operator<<(kwsys_ios::ostream& os, @KWSYS_NAMESPACE@::IOStreamSLL value) operator<<(std::ostream& os, @KWSYS_NAMESPACE@::IOStreamSLL value)
{ {
return @KWSYS_NAMESPACE@::IOStreamPrint(os, value); return @KWSYS_NAMESPACE@::IOStreamPrint(os, value);
} }
@ -115,8 +110,8 @@ operator<<(kwsys_ios::ostream& os, @KWSYS_NAMESPACE@::IOStreamSLL value)
!defined(KWSYS_IOS_OSTREAM_UNSIGNED_LONG_LONG_DEFINED) !defined(KWSYS_IOS_OSTREAM_UNSIGNED_LONG_LONG_DEFINED)
# define KWSYS_IOS_OSTREAM_UNSIGNED_LONG_LONG_DEFINED # define KWSYS_IOS_OSTREAM_UNSIGNED_LONG_LONG_DEFINED
# define @KWSYS_NAMESPACE@_IOS_OSTREAM_UNSIGNED_LONG_LONG_DEFINED # define @KWSYS_NAMESPACE@_IOS_OSTREAM_UNSIGNED_LONG_LONG_DEFINED
inline kwsys_ios::ostream& inline std::ostream&
operator<<(kwsys_ios::ostream& os, @KWSYS_NAMESPACE@::IOStreamULL value) operator<<(std::ostream& os, @KWSYS_NAMESPACE@::IOStreamULL value)
{ {
return @KWSYS_NAMESPACE@::IOStreamPrint(os, value); return @KWSYS_NAMESPACE@::IOStreamPrint(os, value);
} }
@ -127,7 +122,6 @@ operator<<(kwsys_ios::ostream& os, @KWSYS_NAMESPACE@::IOStreamULL value)
/* Undefine temporary macros. */ /* Undefine temporary macros. */
#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS #if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
# undef kwsysEXPORT # undef kwsysEXPORT
# undef kwsys_ios
#endif #endif
/* If building a C++ file in kwsys itself, give the source file /* If building a C++ file in kwsys itself, give the source file

View File

@ -33,12 +33,7 @@
#include <@KWSYS_NAMESPACE@/Configure.h> #include <@KWSYS_NAMESPACE@/Configure.h>
#include <@KWSYS_NAMESPACE@/Configure.hxx> #include <@KWSYS_NAMESPACE@/Configure.hxx>
#include <@KWSYS_NAMESPACE@/stl/string> #include <string>
/* 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
/* Disable useless Borland warnings. KWSys tries not to force things /* Disable useless Borland warnings. KWSys tries not to force things
on its includers, but there is no choice here. */ on its includers, but there is no choice here. */
@ -207,7 +202,7 @@ public:
/** /**
* Instantiate RegularExpression with compiled string. * Instantiate RegularExpression with compiled string.
*/ */
inline RegularExpression (kwsys_stl::string const&); inline RegularExpression (std::string const&);
/** /**
* Destructor. * Destructor.
@ -224,7 +219,7 @@ public:
* Compile a regular expression into internal code * Compile a regular expression into internal code
* for later pattern matching. * for later pattern matching.
*/ */
inline bool compile (kwsys_stl::string const&); inline bool compile (std::string const&);
/** /**
* Matches the regular expression to the given string. * Matches the regular expression to the given string.
@ -236,17 +231,17 @@ public:
* Matches the regular expression to the given std string. * Matches the regular expression to the given std string.
* Returns true if found, and sets start and end indexes accordingly. * Returns true if found, and sets start and end indexes accordingly.
*/ */
inline bool find (kwsys_stl::string const&); inline bool find (std::string const&);
/** /**
* Index to start of first find. * Index to start of first find.
*/ */
inline kwsys_stl::string::size_type start() const; inline std::string::size_type start() const;
/** /**
* Index to end of first find. * Index to end of first find.
*/ */
inline kwsys_stl::string::size_type end() const; inline std::string::size_type end() const;
/** /**
* Copy the given regular expression. * Copy the given regular expression.
@ -285,9 +280,9 @@ public:
* Destructor. * Destructor.
*/ */
// awf added // awf added
kwsys_stl::string::size_type start(int n) const; std::string::size_type start(int n) const;
kwsys_stl::string::size_type end(int n) const; std::string::size_type end(int n) const;
kwsys_stl::string match(int n) const; std::string match(int n) const;
enum { NSUBEXP = 10 }; enum { NSUBEXP = 10 };
private: private:
@ -296,7 +291,7 @@ private:
char regstart; // Internal use only char regstart; // Internal use only
char reganch; // Internal use only char reganch; // Internal use only
const char* regmust; // Internal use only const char* regmust; // Internal use only
kwsys_stl::string::size_type regmlen; // Internal use only std::string::size_type regmlen; // Internal use only
char* program; char* program;
int progsize; int progsize;
const char* searchstring; const char* searchstring;
@ -327,7 +322,7 @@ inline RegularExpression::RegularExpression (const char* s)
* Creates a regular expression from string s, and * Creates a regular expression from string s, and
* compiles s. * compiles s.
*/ */
inline RegularExpression::RegularExpression (const kwsys_stl::string& s) inline RegularExpression::RegularExpression (const std::string& s)
{ {
this->program = 0; this->program = 0;
this->compile(s); this->compile(s);
@ -347,7 +342,7 @@ inline RegularExpression::~RegularExpression ()
* Compile a regular expression into internal code * Compile a regular expression into internal code
* for later pattern matching. * for later pattern matching.
*/ */
inline bool RegularExpression::compile (kwsys_stl::string const& s) inline bool RegularExpression::compile (std::string const& s)
{ {
return this->compile(s.c_str()); return this->compile(s.c_str());
} }
@ -356,7 +351,7 @@ inline bool RegularExpression::compile (kwsys_stl::string const& s)
* Matches the regular expression to the given std string. * Matches the regular expression to the given std string.
* Returns true if found, and sets start and end indexes accordingly. * Returns true if found, and sets start and end indexes accordingly.
*/ */
inline bool RegularExpression::find (kwsys_stl::string const& s) inline bool RegularExpression::find (std::string const& s)
{ {
return this->find(s.c_str()); return this->find(s.c_str());
} }
@ -364,9 +359,9 @@ inline bool RegularExpression::find (kwsys_stl::string const& s)
/** /**
* Set the start position for the regular expression. * Set the start position for the regular expression.
*/ */
inline kwsys_stl::string::size_type RegularExpression::start () const inline std::string::size_type RegularExpression::start () const
{ {
return static_cast<kwsys_stl::string::size_type>( return static_cast<std::string::size_type>(
this->startp[0] - searchstring); this->startp[0] - searchstring);
} }
@ -374,9 +369,9 @@ inline kwsys_stl::string::size_type RegularExpression::start () const
/** /**
* Returns the start/end index of the last item found. * Returns the start/end index of the last item found.
*/ */
inline kwsys_stl::string::size_type RegularExpression::end () const inline std::string::size_type RegularExpression::end () const
{ {
return static_cast<kwsys_stl::string::size_type>( return static_cast<std::string::size_type>(
this->endp[0] - searchstring); this->endp[0] - searchstring);
} }
@ -410,9 +405,9 @@ inline void RegularExpression::set_invalid ()
/** /**
* Return start index of nth submatch. start(0) is the start of the full match. * Return start index of nth submatch. start(0) is the start of the full match.
*/ */
inline kwsys_stl::string::size_type RegularExpression::start(int n) const inline std::string::size_type RegularExpression::start(int n) const
{ {
return static_cast<kwsys_stl::string::size_type>( return static_cast<std::string::size_type>(
this->startp[n] - searchstring); this->startp[n] - searchstring);
} }
@ -420,34 +415,29 @@ inline kwsys_stl::string::size_type RegularExpression::start(int n) const
/** /**
* Return end index of nth submatch. end(0) is the end of the full match. * Return end index of nth submatch. end(0) is the end of the full match.
*/ */
inline kwsys_stl::string::size_type RegularExpression::end(int n) const inline std::string::size_type RegularExpression::end(int n) const
{ {
return static_cast<kwsys_stl::string::size_type>( return static_cast<std::string::size_type>(
this->endp[n] - searchstring); this->endp[n] - searchstring);
} }
/** /**
* Return nth submatch as a string. * Return nth submatch as a string.
*/ */
inline kwsys_stl::string RegularExpression::match(int n) const inline std::string RegularExpression::match(int n) const
{ {
if (this->startp[n]==0) if (this->startp[n]==0)
{ {
return kwsys_stl::string(""); return std::string("");
} }
else else
{ {
return kwsys_stl::string(this->startp[n], return std::string(this->startp[n],
static_cast<kwsys_stl::string::size_type>( static_cast<std::string::size_type>(
this->endp[n] - this->startp[n])); this->endp[n] - this->startp[n]));
} }
} }
} // namespace @KWSYS_NAMESPACE@ } // namespace @KWSYS_NAMESPACE@
/* Undefine temporary macro. */
#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
# undef kwsys_stl
#endif
#endif #endif

View File

@ -12,7 +12,7 @@
#ifndef @KWSYS_NAMESPACE@_String_hxx #ifndef @KWSYS_NAMESPACE@_String_hxx
#define @KWSYS_NAMESPACE@_String_hxx #define @KWSYS_NAMESPACE@_String_hxx
#include <@KWSYS_NAMESPACE@/stl/string> #include <string>
namespace @KWSYS_NAMESPACE@ namespace @KWSYS_NAMESPACE@
{ {
@ -25,10 +25,10 @@ namespace @KWSYS_NAMESPACE@
* simply a subclass of this type with the same interface so that the * simply a subclass of this type with the same interface so that the
* name is shorter in debugging symbols and error messages. * name is shorter in debugging symbols and error messages.
*/ */
class String: public @KWSYS_NAMESPACE@_stl::string class String: public std::string
{ {
/** The original string type. */ /** The original string type. */
typedef @KWSYS_NAMESPACE@_stl::string stl_string; typedef std::string stl_string;
public: public:
@ -55,8 +55,8 @@ public:
#if defined(__WATCOMC__) #if defined(__WATCOMC__)
inline bool operator<(String const& l, String const& r) inline bool operator<(String const& l, String const& r)
{ {
return (static_cast<@KWSYS_NAMESPACE@_stl::string const&>(l) < return (static_cast<std::string const&>(l) <
static_cast<@KWSYS_NAMESPACE@_stl::string const&>(r)); static_cast<std::string const&>(r));
} }
#endif #endif

View File

@ -35,14 +35,8 @@
// http://msdn.microsoft.com/en-us/library/ms683219(VS.85).aspx // http://msdn.microsoft.com/en-us/library/ms683219(VS.85).aspx
#include "kwsysPrivate.h" #include "kwsysPrivate.h"
#include KWSYS_HEADER(stl/string)
#include KWSYS_HEADER(stl/vector)
#include KWSYS_HEADER(ios/iosfwd)
#include KWSYS_HEADER(SystemInformation.hxx) #include KWSYS_HEADER(SystemInformation.hxx)
#include KWSYS_HEADER(Process.h) #include KWSYS_HEADER(Process.h)
#include KWSYS_HEADER(ios/iostream)
#include KWSYS_HEADER(ios/sstream)
#include KWSYS_HEADER(ios/fstream)
// Work-around CMake dependency scanning limitation. This must // Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers. // duplicate the above list of headers.
@ -50,14 +44,14 @@
# include "SystemInformation.hxx.in" # include "SystemInformation.hxx.in"
# include "Process.h.in" # include "Process.h.in"
# include "Configure.hxx.in" # include "Configure.hxx.in"
# include "kwsys_stl.hxx.in"
# include "kwsys_stl_vector.in"
# include "kwsys_stl_iosfwd.in"
# include "kwsys_ios_sstream.h.in"
# include "kwsys_ios_iostream.h.in"
# include "kwsys_ios_fstream.h.in"
#endif #endif
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#if defined(_WIN32) #if defined(_WIN32)
# include <windows.h> # include <windows.h>
# if defined(_MSC_VER) && _MSC_VER >= 1800 # if defined(_MSC_VER) && _MSC_VER >= 1800
@ -325,11 +319,11 @@ public:
const char * GetVendorString(); const char * GetVendorString();
const char * GetVendorID(); const char * GetVendorID();
kwsys_stl::string GetTypeID(); std::string GetTypeID();
kwsys_stl::string GetFamilyID(); std::string GetFamilyID();
kwsys_stl::string GetModelID(); std::string GetModelID();
kwsys_stl::string GetModelName(); std::string GetModelName();
kwsys_stl::string GetSteppingCode(); std::string GetSteppingCode();
const char * GetExtendedProcessorName(); const char * GetExtendedProcessorName();
const char * GetProcessorSerialNumber(); const char * GetProcessorSerialNumber();
int GetProcessorCacheSize(); int GetProcessorCacheSize();
@ -341,7 +335,7 @@ public:
const char * GetOSName(); const char * GetOSName();
const char * GetHostname(); const char * GetHostname();
int GetFullyQualifiedDomainName(kwsys_stl::string &fqdn); int GetFullyQualifiedDomainName(std::string &fqdn);
const char * GetOSRelease(); const char * GetOSRelease();
const char * GetOSVersion(); const char * GetOSVersion();
const char * GetOSPlatform(); const char * GetOSPlatform();
@ -379,7 +373,7 @@ public:
// get current stack // get current stack
static static
kwsys_stl::string GetProgramStack(int firstFrame, int wholePath); std::string GetProgramStack(int firstFrame, int wholePath);
/** Run the different checks */ /** Run the different checks */
void RunCPUCheck(); void RunCPUCheck();
@ -395,10 +389,10 @@ public:
int Revision; int Revision;
int ExtendedFamily; int ExtendedFamily;
int ExtendedModel; int ExtendedModel;
kwsys_stl::string ProcessorName; std::string ProcessorName;
kwsys_stl::string Vendor; std::string Vendor;
kwsys_stl::string SerialNumber; std::string SerialNumber;
kwsys_stl::string ModelName; std::string ModelName;
} ID; } ID;
typedef struct tagCPUPowerManagement typedef struct tagCPUPowerManagement
@ -480,7 +474,7 @@ protected:
// For Linux and Cygwin, /proc/cpuinfo formats are slightly different // For Linux and Cygwin, /proc/cpuinfo formats are slightly different
bool RetreiveInformationFromCpuInfoFile(); bool RetreiveInformationFromCpuInfoFile();
kwsys_stl::string ExtractValueFromCpuInfoFile(kwsys_stl::string buffer, std::string ExtractValueFromCpuInfoFile(std::string buffer,
const char* word, size_t init=0); const char* word, size_t init=0);
bool QueryLinuxMemory(); bool QueryLinuxMemory();
@ -489,20 +483,20 @@ protected:
static void Delay (unsigned int); static void Delay (unsigned int);
static void DelayOverhead (unsigned int); static void DelayOverhead (unsigned int);
void FindManufacturer(const kwsys_stl::string &family = ""); void FindManufacturer(const std::string &family = "");
// For Mac // For Mac
bool ParseSysCtl(); bool ParseSysCtl();
int CallSwVers(const char *arg, kwsys_stl::string &ver); int CallSwVers(const char *arg, std::string &ver);
void TrimNewline(kwsys_stl::string&); void TrimNewline(std::string&);
kwsys_stl::string ExtractValueFromSysCtl(const char* word); std::string ExtractValueFromSysCtl(const char* word);
kwsys_stl::string SysCtlBuffer; std::string SysCtlBuffer;
// For Solaris // For Solaris
bool QuerySolarisMemory(); bool QuerySolarisMemory();
bool QuerySolarisProcessor(); bool QuerySolarisProcessor();
kwsys_stl::string ParseValueFromKStat(const char* arguments); std::string ParseValueFromKStat(const char* arguments);
kwsys_stl::string RunProcess(kwsys_stl::vector<const char*> args); std::string RunProcess(std::vector<const char*> args);
//For Haiku OS //For Haiku OS
bool QueryHaikuInfo(); bool QueryHaikuInfo();
@ -540,11 +534,11 @@ protected:
// Operating System information // Operating System information
bool QueryOSInformation(); bool QueryOSInformation();
kwsys_stl::string OSName; std::string OSName;
kwsys_stl::string Hostname; std::string Hostname;
kwsys_stl::string OSRelease; std::string OSRelease;
kwsys_stl::string OSVersion; std::string OSVersion;
kwsys_stl::string OSPlatform; std::string OSPlatform;
}; };
@ -568,27 +562,27 @@ const char * SystemInformation::GetVendorID()
return this->Implementation->GetVendorID(); return this->Implementation->GetVendorID();
} }
kwsys_stl::string SystemInformation::GetTypeID() std::string SystemInformation::GetTypeID()
{ {
return this->Implementation->GetTypeID(); return this->Implementation->GetTypeID();
} }
kwsys_stl::string SystemInformation::GetFamilyID() std::string SystemInformation::GetFamilyID()
{ {
return this->Implementation->GetFamilyID(); return this->Implementation->GetFamilyID();
} }
kwsys_stl::string SystemInformation::GetModelID() std::string SystemInformation::GetModelID()
{ {
return this->Implementation->GetModelID(); return this->Implementation->GetModelID();
} }
kwsys_stl::string SystemInformation::GetModelName() std::string SystemInformation::GetModelName()
{ {
return this->Implementation->GetModelName(); return this->Implementation->GetModelName();
} }
kwsys_stl::string SystemInformation::GetSteppingCode() std::string SystemInformation::GetSteppingCode()
{ {
return this->Implementation->GetSteppingCode(); return this->Implementation->GetSteppingCode();
} }
@ -633,9 +627,9 @@ bool SystemInformation::DoesCPUSupportFeature(long int i)
return this->Implementation->DoesCPUSupportFeature(i); return this->Implementation->DoesCPUSupportFeature(i);
} }
kwsys_stl::string SystemInformation::GetCPUDescription() std::string SystemInformation::GetCPUDescription()
{ {
kwsys_ios::ostringstream oss; std::ostringstream oss;
oss oss
<< this->GetNumberOfPhysicalCPU() << this->GetNumberOfPhysicalCPU()
<< " core "; << " core ";
@ -654,9 +648,9 @@ kwsys_stl::string SystemInformation::GetCPUDescription()
} }
// remove extra spaces // remove extra spaces
kwsys_stl::string tmp=oss.str(); std::string tmp=oss.str();
size_t pos; size_t pos;
while( (pos=tmp.find(" "))!=kwsys_stl::string::npos) while( (pos=tmp.find(" "))!=std::string::npos)
{ {
tmp.replace(pos,2," "); tmp.replace(pos,2," ");
} }
@ -674,9 +668,9 @@ const char * SystemInformation::GetHostname()
return this->Implementation->GetHostname(); return this->Implementation->GetHostname();
} }
kwsys_stl::string SystemInformation::GetFullyQualifiedDomainName() std::string SystemInformation::GetFullyQualifiedDomainName()
{ {
kwsys_stl::string fqdn; std::string fqdn;
this->Implementation->GetFullyQualifiedDomainName(fqdn); this->Implementation->GetFullyQualifiedDomainName(fqdn);
return fqdn; return fqdn;
} }
@ -723,9 +717,9 @@ int SystemInformation::GetOSIsApple()
#endif #endif
} }
kwsys_stl::string SystemInformation::GetOSDescription() std::string SystemInformation::GetOSDescription()
{ {
kwsys_ios::ostringstream oss; std::ostringstream oss;
oss oss
<< this->GetOSName() << this->GetOSName()
<< " " << " "
@ -777,11 +771,11 @@ size_t SystemInformation::GetAvailablePhysicalMemory()
return this->Implementation->GetAvailablePhysicalMemory(); return this->Implementation->GetAvailablePhysicalMemory();
} }
kwsys_stl::string SystemInformation::GetMemoryDescription( std::string SystemInformation::GetMemoryDescription(
const char *hostLimitEnvVarName, const char *hostLimitEnvVarName,
const char *procLimitEnvVarName) const char *procLimitEnvVarName)
{ {
kwsys_ios::ostringstream oss; std::ostringstream oss;
oss oss
<< "Host Total: " << "Host Total: "
<< iostreamLongLong(this->GetHostMemoryTotal()) << iostreamLongLong(this->GetHostMemoryTotal())
@ -842,7 +836,7 @@ void SystemInformation::SetStackTraceOnError(int enable)
SystemInformationImplementation::SetStackTraceOnError(enable); SystemInformationImplementation::SetStackTraceOnError(enable);
} }
kwsys_stl::string SystemInformation::GetProgramStack(int firstFrame, int wholePath) std::string SystemInformation::GetProgramStack(int firstFrame, int wholePath)
{ {
return SystemInformationImplementation::GetProgramStack(firstFrame, wholePath); return SystemInformationImplementation::GetProgramStack(firstFrame, wholePath);
} }
@ -926,7 +920,7 @@ namespace {
#if defined(__linux) || defined(__APPLE__) #if defined(__linux) || defined(__APPLE__)
int LoadLines( int LoadLines(
FILE *file, FILE *file,
kwsys_stl::vector<kwsys_stl::string> &lines) std::vector<std::string> &lines)
{ {
// Load each line in the given file into a the vector. // Load each line in the given file into a the vector.
int nRead=0; int nRead=0;
@ -963,7 +957,7 @@ int LoadLines(
// ***************************************************************************** // *****************************************************************************
int LoadLines( int LoadLines(
const char *fileName, const char *fileName,
kwsys_stl::vector<kwsys_stl::string> &lines) std::vector<std::string> &lines)
{ {
FILE *file=fopen(fileName,"r"); FILE *file=fopen(fileName,"r");
if (file==0) if (file==0)
@ -979,18 +973,18 @@ int LoadLines(
// **************************************************************************** // ****************************************************************************
template<typename T> template<typename T>
int NameValue( int NameValue(
kwsys_stl::vector<kwsys_stl::string> &lines, std::vector<std::string> &lines,
kwsys_stl::string name, T &value) std::string name, T &value)
{ {
size_t nLines=lines.size(); size_t nLines=lines.size();
for (size_t i=0; i<nLines; ++i) for (size_t i=0; i<nLines; ++i)
{ {
size_t at=lines[i].find(name); size_t at=lines[i].find(name);
if (at==kwsys_stl::string::npos) if (at==std::string::npos)
{ {
continue; continue;
} }
kwsys_ios::istringstream is(lines[i].substr(at+name.size())); std::istringstream is(lines[i].substr(at+name.size()));
is >> value; is >> value;
return 0; return 0;
} }
@ -1006,7 +1000,7 @@ int GetFieldsFromFile(
const char **fieldNames, const char **fieldNames,
T *values) T *values)
{ {
kwsys_stl::vector<kwsys_stl::string> fields; std::vector<std::string> fields;
if (!LoadLines(fileName,fields)) if (!LoadLines(fileName,fields))
{ {
return -1; return -1;
@ -1056,7 +1050,7 @@ int GetFieldsFromCommand(
{ {
return -1; return -1;
} }
kwsys_stl::vector<kwsys_stl::string> fields; std::vector<std::string> fields;
int nl=LoadLines(file,fields); int nl=LoadLines(file,fields);
pclose(file); pclose(file);
if (nl==0) if (nl==0)
@ -1085,10 +1079,10 @@ void StacktraceSignalHandler(
void * /*sigContext*/) void * /*sigContext*/)
{ {
#if defined(__linux) || defined(__APPLE__) #if defined(__linux) || defined(__APPLE__)
kwsys_ios::ostringstream oss; std::ostringstream oss;
oss oss
<< kwsys_ios::endl << std::endl
<< "=========================================================" << kwsys_ios::endl << "=========================================================" << std::endl
<< "Process id " << getpid() << " "; << "Process id " << getpid() << " ";
switch (sigNo) switch (sigNo)
{ {
@ -1281,11 +1275,11 @@ void StacktraceSignalHandler(
break; break;
} }
oss oss
<< kwsys_ios::endl << std::endl
<< "Program Stack:" << kwsys_ios::endl << "Program Stack:" << std::endl
<< SystemInformationImplementation::GetProgramStack(2,0) << SystemInformationImplementation::GetProgramStack(2,0)
<< "=========================================================" << kwsys_ios::endl; << "=========================================================" << std::endl;
kwsys_ios::cerr << oss.str() << kwsys_ios::endl; std::cerr << oss.str() << std::endl;
// restore the previously registered handlers // restore the previously registered handlers
// and abort // and abort
@ -1330,7 +1324,7 @@ public:
void SetBinary(const char *binary) void SetBinary(const char *binary)
{ this->Binary=safes(binary); } { this->Binary=safes(binary); }
kwsys_stl::string GetBinary() const; std::string GetBinary() const;
// Description: // Description:
// Set the name of the function that the symbol is found in. // Set the name of the function that the symbol is found in.
@ -1338,7 +1332,7 @@ public:
void SetFunction(const char *function) void SetFunction(const char *function)
{ this->Function=this->Demangle(function); } { this->Function=this->Demangle(function); }
kwsys_stl::string GetFunction() const std::string GetFunction() const
{ return this->Function; } { return this->Function; }
// Description: // Description:
@ -1347,7 +1341,7 @@ public:
void SetSourceFile(const char *sourcefile) void SetSourceFile(const char *sourcefile)
{ this->SourceFile=safes(sourcefile); } { this->SourceFile=safes(sourcefile); }
kwsys_stl::string GetSourceFile() const std::string GetSourceFile() const
{ return this->GetFileName(this->SourceFile); } { return this->GetFileName(this->SourceFile); }
// Description: // Description:
@ -1365,31 +1359,31 @@ private:
void *GetRealAddress() const void *GetRealAddress() const
{ return (void*)((char*)this->Address-(char*)this->BinaryBaseAddress); } { return (void*)((char*)this->Address-(char*)this->BinaryBaseAddress); }
kwsys_stl::string GetFileName(const kwsys_stl::string &path) const; std::string GetFileName(const std::string &path) const;
kwsys_stl::string Demangle(const char *symbol) const; std::string Demangle(const char *symbol) const;
private: private:
kwsys_stl::string Binary; std::string Binary;
void *BinaryBaseAddress; void *BinaryBaseAddress;
void *Address; void *Address;
kwsys_stl::string SourceFile; std::string SourceFile;
kwsys_stl::string Function; std::string Function;
long LineNumber; long LineNumber;
int ReportPath; int ReportPath;
}; };
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
kwsys_ios::ostream &operator<<( std::ostream &operator<<(
kwsys_ios::ostream &os, std::ostream &os,
const SymbolProperties &sp) const SymbolProperties &sp)
{ {
#if defined(KWSYS_SYSTEMINFORMATION_HAS_SYMBOL_LOOKUP) #if defined(KWSYS_SYSTEMINFORMATION_HAS_SYMBOL_LOOKUP)
os os
<< kwsys_ios::hex << sp.GetAddress() << " : " << std::hex << sp.GetAddress() << " : "
<< sp.GetFunction() << sp.GetFunction()
<< " [(" << sp.GetBinary() << ") " << " [(" << sp.GetBinary() << ") "
<< sp.GetSourceFile() << ":" << sp.GetSourceFile() << ":"
<< kwsys_ios::dec << sp.GetLineNumber() << "]"; << std::dec << sp.GetLineNumber() << "]";
#elif defined(KWSYS_SYSTEMINFORMATION_HAS_BACKTRACE) #elif defined(KWSYS_SYSTEMINFORMATION_HAS_BACKTRACE)
void *addr = sp.GetAddress(); void *addr = sp.GetAddress();
char **syminfo = backtrace_symbols(&addr,1); char **syminfo = backtrace_symbols(&addr,1);
@ -1422,28 +1416,28 @@ SymbolProperties::SymbolProperties()
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
kwsys_stl::string SymbolProperties::GetFileName(const kwsys_stl::string &path) const std::string SymbolProperties::GetFileName(const std::string &path) const
{ {
kwsys_stl::string file(path); std::string file(path);
if (!this->ReportPath) if (!this->ReportPath)
{ {
size_t at = file.rfind("/"); size_t at = file.rfind("/");
if (at!=kwsys_stl::string::npos) if (at!=std::string::npos)
{ {
file = file.substr(at+1,kwsys_stl::string::npos); file = file.substr(at+1,std::string::npos);
} }
} }
return file; return file;
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
kwsys_stl::string SymbolProperties::GetBinary() const std::string SymbolProperties::GetBinary() const
{ {
// only linux has proc fs // only linux has proc fs
#if defined(__linux__) #if defined(__linux__)
if (this->Binary=="/proc/self/exe") if (this->Binary=="/proc/self/exe")
{ {
kwsys_stl::string binary; std::string binary;
char buf[1024]={'\0'}; char buf[1024]={'\0'};
ssize_t ll=0; ssize_t ll=0;
if ((ll=readlink("/proc/self/exe",buf,1024))>0) if ((ll=readlink("/proc/self/exe",buf,1024))>0)
@ -1462,9 +1456,9 @@ kwsys_stl::string SymbolProperties::GetBinary() const
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
kwsys_stl::string SymbolProperties::Demangle(const char *symbol) const std::string SymbolProperties::Demangle(const char *symbol) const
{ {
kwsys_stl::string result = safes(symbol); std::string result = safes(symbol);
#if defined(KWSYS_SYSTEMINFORMATION_HAS_CPP_DEMANGLE) #if defined(KWSYS_SYSTEMINFORMATION_HAS_CPP_DEMANGLE)
int status = 0; int status = 0;
size_t bufferLen = 1024; size_t bufferLen = 1024;
@ -1729,7 +1723,7 @@ const char* SystemInformationImplementation::GetHostname()
/** Get the FQDN */ /** Get the FQDN */
int SystemInformationImplementation::GetFullyQualifiedDomainName( int SystemInformationImplementation::GetFullyQualifiedDomainName(
kwsys_stl::string &fqdn) std::string &fqdn)
{ {
// in the event of absolute failure return localhost. // in the event of absolute failure return localhost.
fqdn="localhost"; fqdn="localhost";
@ -1820,8 +1814,8 @@ int SystemInformationImplementation::GetFullyQualifiedDomainName(
continue; continue;
} }
kwsys_stl::string candidate=host; std::string candidate=host;
if ((candidate.find(base)!=kwsys_stl::string::npos) && baseSize<candidate.size()) if ((candidate.find(base)!=std::string::npos) && baseSize<candidate.size())
{ {
// success, stop now. // success, stop now.
ierr=0; ierr=0;
@ -1897,39 +1891,39 @@ const char * SystemInformationImplementation::GetVendorID()
} }
/** Return the type ID of the CPU */ /** Return the type ID of the CPU */
kwsys_stl::string SystemInformationImplementation::GetTypeID() std::string SystemInformationImplementation::GetTypeID()
{ {
kwsys_ios::ostringstream str; std::ostringstream str;
str << this->ChipID.Type; str << this->ChipID.Type;
return str.str(); return str.str();
} }
/** Return the family of the CPU present */ /** Return the family of the CPU present */
kwsys_stl::string SystemInformationImplementation::GetFamilyID() std::string SystemInformationImplementation::GetFamilyID()
{ {
kwsys_ios::ostringstream str; std::ostringstream str;
str << this->ChipID.Family; str << this->ChipID.Family;
return str.str(); return str.str();
} }
// Return the model of CPU present */ // Return the model of CPU present */
kwsys_stl::string SystemInformationImplementation::GetModelID() std::string SystemInformationImplementation::GetModelID()
{ {
kwsys_ios::ostringstream str; std::ostringstream str;
str << this->ChipID.Model; str << this->ChipID.Model;
return str.str(); return str.str();
} }
// Return the model name of CPU present */ // Return the model name of CPU present */
kwsys_stl::string SystemInformationImplementation::GetModelName() std::string SystemInformationImplementation::GetModelName()
{ {
return this->ChipID.ModelName; return this->ChipID.ModelName;
} }
/** Return the stepping code of the CPU present. */ /** Return the stepping code of the CPU present. */
kwsys_stl::string SystemInformationImplementation::GetSteppingCode() std::string SystemInformationImplementation::GetSteppingCode()
{ {
kwsys_ios::ostringstream str; std::ostringstream str;
str << this->ChipID.Revision; str << this->ChipID.Revision;
return str.str(); return str.str();
} }
@ -2180,7 +2174,7 @@ bool SystemInformationImplementation::RetrieveCPUFeatures()
/** Find the manufacturer given the vendor id */ /** Find the manufacturer given the vendor id */
void SystemInformationImplementation::FindManufacturer(const kwsys_stl::string& family) void SystemInformationImplementation::FindManufacturer(const std::string& family)
{ {
if (this->ChipID.Vendor == "GenuineIntel") this->ChipManufacturer = Intel; // Intel Corp. if (this->ChipID.Vendor == "GenuineIntel") this->ChipManufacturer = Intel; // Intel Corp.
else if (this->ChipID.Vendor == "UMC UMC UMC ") this->ChipManufacturer = UMC; // United Microelectronics Corp. else if (this->ChipID.Vendor == "UMC UMC UMC ") this->ChipManufacturer = UMC; // United Microelectronics Corp.
@ -2799,11 +2793,11 @@ bool SystemInformationImplementation::RetrieveCPUPowerManagement()
#if USE_CPUID #if USE_CPUID
// Used only in USE_CPUID implementation below. // Used only in USE_CPUID implementation below.
static void SystemInformationStripLeadingSpace(kwsys_stl::string& str) static void SystemInformationStripLeadingSpace(std::string& str)
{ {
// Because some manufacturers have leading white space - we have to post-process the name. // Because some manufacturers have leading white space - we have to post-process the name.
kwsys_stl::string::size_type pos = str.find_first_not_of(" "); std::string::size_type pos = str.find_first_not_of(" ");
if(pos != kwsys_stl::string::npos) if(pos != std::string::npos)
{ {
str = str.substr(pos); str = str.substr(pos);
} }
@ -3148,7 +3142,7 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity()
/** Extract a value from the CPUInfo file */ /** Extract a value from the CPUInfo file */
kwsys_stl::string SystemInformationImplementation::ExtractValueFromCpuInfoFile(kwsys_stl::string buffer,const char* word,size_t init) std::string SystemInformationImplementation::ExtractValueFromCpuInfoFile(std::string buffer,const char* word,size_t init)
{ {
size_t pos = buffer.find(word,init); size_t pos = buffer.find(word,init);
if(pos != buffer.npos) if(pos != buffer.npos)
@ -3180,12 +3174,12 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
{ {
this->NumberOfLogicalCPU = 0; this->NumberOfLogicalCPU = 0;
this->NumberOfPhysicalCPU = 0; this->NumberOfPhysicalCPU = 0;
kwsys_stl::string buffer; std::string buffer;
FILE *fd = fopen("/proc/cpuinfo", "r" ); FILE *fd = fopen("/proc/cpuinfo", "r" );
if ( !fd ) if ( !fd )
{ {
kwsys_ios::cout << "Problem opening /proc/cpuinfo" << kwsys_ios::endl; std::cout << "Problem opening /proc/cpuinfo" << std::endl;
return false; return false;
} }
@ -3209,7 +3203,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
#ifdef __linux #ifdef __linux
// Find the largest physical id. // Find the largest physical id.
int maxId = -1; int maxId = -1;
kwsys_stl::string idc = std::string idc =
this->ExtractValueFromCpuInfoFile(buffer,"physical id"); this->ExtractValueFromCpuInfoFile(buffer,"physical id");
while(this->CurrentPositionInFile != buffer.npos) while(this->CurrentPositionInFile != buffer.npos)
{ {
@ -3224,7 +3218,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
// Physical ids returned by Linux don't distinguish cores. // Physical ids returned by Linux don't distinguish cores.
// We want to record the total number of cores in this->NumberOfPhysicalCPU // We want to record the total number of cores in this->NumberOfPhysicalCPU
// (checking only the first proc) // (checking only the first proc)
kwsys_stl::string cores = std::string cores =
this->ExtractValueFromCpuInfoFile(buffer,"cpu cores"); this->ExtractValueFromCpuInfoFile(buffer,"cpu cores");
int numberOfCoresPerCPU=atoi(cores.c_str()); int numberOfCoresPerCPU=atoi(cores.c_str());
if (maxId > 0) if (maxId > 0)
@ -3242,7 +3236,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
#else // __CYGWIN__ #else // __CYGWIN__
// does not have "physical id" entries, neither "cpu cores" // does not have "physical id" entries, neither "cpu cores"
// this has to be fixed for hyper-threading. // this has to be fixed for hyper-threading.
kwsys_stl::string cpucount = std::string cpucount =
this->ExtractValueFromCpuInfoFile(buffer,"cpu count"); this->ExtractValueFromCpuInfoFile(buffer,"cpu count");
this->NumberOfPhysicalCPU= this->NumberOfPhysicalCPU=
this->NumberOfLogicalCPU = atoi(cpucount.c_str()); this->NumberOfLogicalCPU = atoi(cpucount.c_str());
@ -3258,7 +3252,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
this->NumberOfLogicalCPU/this->NumberOfPhysicalCPU; this->NumberOfLogicalCPU/this->NumberOfPhysicalCPU;
// CPU speed (checking only the first processor) // CPU speed (checking only the first processor)
kwsys_stl::string CPUSpeed = this->ExtractValueFromCpuInfoFile(buffer,"cpu MHz"); std::string CPUSpeed = this->ExtractValueFromCpuInfoFile(buffer,"cpu MHz");
if(!CPUSpeed.empty()) if(!CPUSpeed.empty())
{ {
this->CPUSpeedInMHz = static_cast<float>(atof(CPUSpeed.c_str())); this->CPUSpeedInMHz = static_cast<float>(atof(CPUSpeed.c_str()));
@ -3274,7 +3268,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
#endif #endif
// Chip family // Chip family
kwsys_stl::string familyStr = std::string familyStr =
this->ExtractValueFromCpuInfoFile(buffer,"cpu family"); this->ExtractValueFromCpuInfoFile(buffer,"cpu family");
if(familyStr.empty()) if(familyStr.empty())
{ {
@ -3304,7 +3298,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
{ {
// Some platforms (e.g. PA-RISC) tell us their CPU name here. // Some platforms (e.g. PA-RISC) tell us their CPU name here.
// Note: x86 does not. // Note: x86 does not.
kwsys_stl::string cpuname = this->ExtractValueFromCpuInfoFile(buffer,"cpu"); std::string cpuname = this->ExtractValueFromCpuInfoFile(buffer,"cpu");
if(!cpuname.empty()) if(!cpuname.empty())
{ {
this->ChipID.ProcessorName = cpuname; this->ChipID.ProcessorName = cpuname;
@ -3312,7 +3306,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
} }
// Chip revision // Chip revision
kwsys_stl::string cpurev = this->ExtractValueFromCpuInfoFile(buffer,"stepping"); std::string cpurev = this->ExtractValueFromCpuInfoFile(buffer,"stepping");
if(cpurev.empty()) if(cpurev.empty())
{ {
cpurev = this->ExtractValueFromCpuInfoFile(buffer,"CPU revision"); cpurev = this->ExtractValueFromCpuInfoFile(buffer,"CPU revision");
@ -3325,7 +3319,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
// L1 Cache size // L1 Cache size
// Different architectures may show different names for the caches. // Different architectures may show different names for the caches.
// Sum up everything we find. // Sum up everything we find.
kwsys_stl::vector<const char*> cachename; std::vector<const char*> cachename;
cachename.clear(); cachename.clear();
cachename.push_back("cache size"); // e.g. x86 cachename.push_back("cache size"); // e.g. x86
@ -3335,7 +3329,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
this->Features.L1CacheSize = 0; this->Features.L1CacheSize = 0;
for (size_t index = 0; index < cachename.size(); index ++) for (size_t index = 0; index < cachename.size(); index ++)
{ {
kwsys_stl::string cacheSize = this->ExtractValueFromCpuInfoFile(buffer,cachename[index]); std::string cacheSize = this->ExtractValueFromCpuInfoFile(buffer,cachename[index]);
if (!cacheSize.empty()) if (!cacheSize.empty())
{ {
pos = cacheSize.find(" KB"); pos = cacheSize.find(" KB");
@ -3348,48 +3342,48 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
} }
// processor feature flags (probably x86 specific) // processor feature flags (probably x86 specific)
kwsys_stl::string cpuflags = this->ExtractValueFromCpuInfoFile(buffer,"flags"); std::string cpuflags = this->ExtractValueFromCpuInfoFile(buffer,"flags");
if(!cpurev.empty()) if(!cpurev.empty())
{ {
// now we can match every flags as space + flag + space // now we can match every flags as space + flag + space
cpuflags = " " + cpuflags + " "; cpuflags = " " + cpuflags + " ";
if ((cpuflags.find(" fpu ")!=kwsys_stl::string::npos)) if ((cpuflags.find(" fpu ")!=std::string::npos))
{ {
this->Features.HasFPU = true; this->Features.HasFPU = true;
} }
if ((cpuflags.find(" tsc ")!=kwsys_stl::string::npos)) if ((cpuflags.find(" tsc ")!=std::string::npos))
{ {
this->Features.HasTSC = true; this->Features.HasTSC = true;
} }
if ((cpuflags.find(" mmx ")!=kwsys_stl::string::npos)) if ((cpuflags.find(" mmx ")!=std::string::npos))
{ {
this->Features.HasMMX = true; this->Features.HasMMX = true;
} }
if ((cpuflags.find(" sse ")!=kwsys_stl::string::npos)) if ((cpuflags.find(" sse ")!=std::string::npos))
{ {
this->Features.HasSSE = true; this->Features.HasSSE = true;
} }
if ((cpuflags.find(" sse2 ")!=kwsys_stl::string::npos)) if ((cpuflags.find(" sse2 ")!=std::string::npos))
{ {
this->Features.HasSSE2 = true; this->Features.HasSSE2 = true;
} }
if ((cpuflags.find(" apic ")!=kwsys_stl::string::npos)) if ((cpuflags.find(" apic ")!=std::string::npos))
{ {
this->Features.HasAPIC = true; this->Features.HasAPIC = true;
} }
if ((cpuflags.find(" cmov ")!=kwsys_stl::string::npos)) if ((cpuflags.find(" cmov ")!=std::string::npos))
{ {
this->Features.HasCMOV = true; this->Features.HasCMOV = true;
} }
if ((cpuflags.find(" mtrr ")!=kwsys_stl::string::npos)) if ((cpuflags.find(" mtrr ")!=std::string::npos))
{ {
this->Features.HasMTRR = true; this->Features.HasMTRR = true;
} }
if ((cpuflags.find(" acpi ")!=kwsys_stl::string::npos)) if ((cpuflags.find(" acpi ")!=std::string::npos))
{ {
this->Features.HasACPI = true; this->Features.HasACPI = true;
} }
if ((cpuflags.find(" 3dnow ")!=kwsys_stl::string::npos)) if ((cpuflags.find(" 3dnow ")!=std::string::npos))
{ {
this->Features.ExtendedFeatures.Has3DNow = true; this->Features.ExtendedFeatures.Has3DNow = true;
} }
@ -3645,7 +3639,7 @@ SystemInformationImplementation::GetProcMemoryUsed()
#elif defined(__APPLE__) #elif defined(__APPLE__)
SystemInformation::LongLong memUsed=0; SystemInformation::LongLong memUsed=0;
pid_t pid=getpid(); pid_t pid=getpid();
kwsys_ios::ostringstream oss; std::ostringstream oss;
oss << "ps -o rss= -p " << pid; oss << "ps -o rss= -p " << pid;
FILE *file=popen(oss.str().c_str(),"r"); FILE *file=popen(oss.str().c_str(),"r");
if (file==0) if (file==0)
@ -3670,7 +3664,7 @@ SystemInformationImplementation::GetProcMemoryUsed()
{ {
return -2; return -2;
} }
kwsys_ios::istringstream iss(oss.str()); std::istringstream iss(oss.str());
iss >> memUsed; iss >> memUsed;
return memUsed; return memUsed;
#else #else
@ -3729,11 +3723,11 @@ SystemInformationImplementation::GetProcessId()
return current program stack in a string return current program stack in a string
demangle cxx symbols if possible. demangle cxx symbols if possible.
*/ */
kwsys_stl::string SystemInformationImplementation::GetProgramStack( std::string SystemInformationImplementation::GetProgramStack(
int firstFrame, int firstFrame,
int wholePath) int wholePath)
{ {
kwsys_stl::string programStack = "" std::string programStack = ""
#if !defined(KWSYS_SYSTEMINFORMATION_HAS_BACKTRACE) #if !defined(KWSYS_SYSTEMINFORMATION_HAS_BACKTRACE)
"WARNING: The stack could not be examined " "WARNING: The stack could not be examined "
"because backtrace is not supported.\n" "because backtrace is not supported.\n"
@ -3752,7 +3746,7 @@ kwsys_stl::string SystemInformationImplementation::GetProgramStack(
#endif #endif
; ;
kwsys_ios::ostringstream oss; std::ostringstream oss;
#if defined(KWSYS_SYSTEMINFORMATION_HAS_BACKTRACE) #if defined(KWSYS_SYSTEMINFORMATION_HAS_BACKTRACE)
void *stackSymbols[256]; void *stackSymbols[256];
int nFrames=backtrace(stackSymbols,256); int nFrames=backtrace(stackSymbols,256);
@ -3761,7 +3755,7 @@ kwsys_stl::string SystemInformationImplementation::GetProgramStack(
SymbolProperties symProps; SymbolProperties symProps;
symProps.SetReportPath(wholePath); symProps.SetReportPath(wholePath);
symProps.Initialize(stackSymbols[i]); symProps.Initialize(stackSymbols[i]);
oss << symProps << kwsys_ios::endl; oss << symProps << std::endl;
} }
#else #else
(void)firstFrame; (void)firstFrame;
@ -3892,7 +3886,7 @@ bool SystemInformationImplementation::QueryLinuxMemory()
int errorFlag = uname(&unameInfo); int errorFlag = uname(&unameInfo);
if( errorFlag!=0 ) if( errorFlag!=0 )
{ {
kwsys_ios::cout << "Problem calling uname(): " << strerror(errno) << kwsys_ios::endl; std::cout << "Problem calling uname(): " << strerror(errno) << std::endl;
return false; return false;
} }
@ -3916,7 +3910,7 @@ bool SystemInformationImplementation::QueryLinuxMemory()
FILE *fd = fopen("/proc/meminfo", "r" ); FILE *fd = fopen("/proc/meminfo", "r" );
if ( !fd ) if ( !fd )
{ {
kwsys_ios::cout << "Problem opening /proc/meminfo" << kwsys_ios::endl; std::cout << "Problem opening /proc/meminfo" << std::endl;
return false; return false;
} }
@ -3954,7 +3948,7 @@ bool SystemInformationImplementation::QueryLinuxMemory()
} }
else else
{ {
kwsys_ios::cout << "Problem parsing /proc/meminfo" << kwsys_ios::endl; std::cout << "Problem parsing /proc/meminfo" << std::endl;
fclose(fd); fclose(fd);
return false; return false;
} }
@ -3987,7 +3981,7 @@ bool SystemInformationImplementation::QueryLinuxMemory()
} }
else else
{ {
kwsys_ios::cout << "Problem parsing /proc/meminfo" << kwsys_ios::endl; std::cout << "Problem parsing /proc/meminfo" << std::endl;
fclose(fd); fclose(fd);
return false; return false;
} }
@ -4464,8 +4458,8 @@ bool SystemInformationImplementation::ParseSysCtl()
::memset(retBuf, 0, 128); ::memset(retBuf, 0, 128);
len = 32; len = 32;
err = sysctlbyname("hw.machine", &retBuf, &len, NULL, 0); err = sysctlbyname("hw.machine", &retBuf, &len, NULL, 0);
kwsys_stl::string machineBuf(retBuf); std::string machineBuf(retBuf);
if (machineBuf.find_first_of("Power") != kwsys_stl::string::npos) if (machineBuf.find_first_of("Power") != std::string::npos)
{ {
this->ChipID.Vendor = "IBM"; this->ChipID.Vendor = "IBM";
len = sizeof(this->ChipID.Family); len = sizeof(this->ChipID.Family);
@ -4527,41 +4521,41 @@ bool SystemInformationImplementation::ParseSysCtl()
{ {
// now we can match every flags as space + flag + space // now we can match every flags as space + flag + space
buf[len + 1] = ' '; buf[len + 1] = ' ';
kwsys_stl::string cpuflags(buf, len + 2); std::string cpuflags(buf, len + 2);
if ((cpuflags.find(" FPU ")!=kwsys_stl::string::npos)) if ((cpuflags.find(" FPU ")!=std::string::npos))
{ {
this->Features.HasFPU = true; this->Features.HasFPU = true;
} }
if ((cpuflags.find(" TSC ")!=kwsys_stl::string::npos)) if ((cpuflags.find(" TSC ")!=std::string::npos))
{ {
this->Features.HasTSC = true; this->Features.HasTSC = true;
} }
if ((cpuflags.find(" MMX ")!=kwsys_stl::string::npos)) if ((cpuflags.find(" MMX ")!=std::string::npos))
{ {
this->Features.HasMMX = true; this->Features.HasMMX = true;
} }
if ((cpuflags.find(" SSE ")!=kwsys_stl::string::npos)) if ((cpuflags.find(" SSE ")!=std::string::npos))
{ {
this->Features.HasSSE = true; this->Features.HasSSE = true;
} }
if ((cpuflags.find(" SSE2 ")!=kwsys_stl::string::npos)) if ((cpuflags.find(" SSE2 ")!=std::string::npos))
{ {
this->Features.HasSSE2 = true; this->Features.HasSSE2 = true;
} }
if ((cpuflags.find(" APIC ")!=kwsys_stl::string::npos)) if ((cpuflags.find(" APIC ")!=std::string::npos))
{ {
this->Features.HasAPIC = true; this->Features.HasAPIC = true;
} }
if ((cpuflags.find(" CMOV ")!=kwsys_stl::string::npos)) if ((cpuflags.find(" CMOV ")!=std::string::npos))
{ {
this->Features.HasCMOV = true; this->Features.HasCMOV = true;
} }
if ((cpuflags.find(" MTRR ")!=kwsys_stl::string::npos)) if ((cpuflags.find(" MTRR ")!=std::string::npos))
{ {
this->Features.HasMTRR = true; this->Features.HasMTRR = true;
} }
if ((cpuflags.find(" ACPI ")!=kwsys_stl::string::npos)) if ((cpuflags.find(" ACPI ")!=std::string::npos))
{ {
this->Features.HasACPI = true; this->Features.HasACPI = true;
} }
@ -4595,7 +4589,7 @@ bool SystemInformationImplementation::ParseSysCtl()
/** Extract a value from sysctl command */ /** Extract a value from sysctl command */
kwsys_stl::string SystemInformationImplementation::ExtractValueFromSysCtl(const char* word) std::string SystemInformationImplementation::ExtractValueFromSysCtl(const char* word)
{ {
size_t pos = this->SysCtlBuffer.find(word); size_t pos = this->SysCtlBuffer.find(word);
if(pos != this->SysCtlBuffer.npos) if(pos != this->SysCtlBuffer.npos)
@ -4612,9 +4606,9 @@ kwsys_stl::string SystemInformationImplementation::ExtractValueFromSysCtl(const
/** Run a given process */ /** Run a given process */
kwsys_stl::string SystemInformationImplementation::RunProcess(kwsys_stl::vector<const char*> args) std::string SystemInformationImplementation::RunProcess(std::vector<const char*> args)
{ {
kwsys_stl::string buffer = ""; std::string buffer = "";
// Run the application // Run the application
kwsysProcess* gp = kwsysProcess_New(); kwsysProcess* gp = kwsysProcess_New();
@ -4644,12 +4638,12 @@ kwsys_stl::string SystemInformationImplementation::RunProcess(kwsys_stl::vector<
} break; } break;
case kwsysProcess_State_Error: case kwsysProcess_State_Error:
{ {
kwsys_ios::cerr << "Error: Could not run " << args[0] << ":\n"; std::cerr << "Error: Could not run " << args[0] << ":\n";
kwsys_ios::cerr << kwsysProcess_GetErrorString(gp) << "\n"; std::cerr << kwsysProcess_GetErrorString(gp) << "\n";
} break; } break;
case kwsysProcess_State_Exception: case kwsysProcess_State_Exception:
{ {
kwsys_ios::cerr << "Error: " << args[0] std::cerr << "Error: " << args[0]
<< " terminated with an exception: " << " terminated with an exception: "
<< kwsysProcess_GetExceptionString(gp) << "\n"; << kwsysProcess_GetExceptionString(gp) << "\n";
} break; } break;
@ -4659,27 +4653,27 @@ kwsys_stl::string SystemInformationImplementation::RunProcess(kwsys_stl::vector<
case kwsysProcess_State_Killed: case kwsysProcess_State_Killed:
{ {
// Should not get here. // Should not get here.
kwsys_ios::cerr << "Unexpected ending state after running " << args[0] std::cerr << "Unexpected ending state after running " << args[0]
<< kwsys_ios::endl; << std::endl;
} break; } break;
} }
kwsysProcess_Delete(gp); kwsysProcess_Delete(gp);
if(result) if(result)
{ {
kwsys_ios::cerr << "Error " << args[0] << " returned :" << result << "\n"; std::cerr << "Error " << args[0] << " returned :" << result << "\n";
} }
return buffer; return buffer;
} }
kwsys_stl::string SystemInformationImplementation::ParseValueFromKStat(const char* arguments) std::string SystemInformationImplementation::ParseValueFromKStat(const char* arguments)
{ {
kwsys_stl::vector<const char*> args; std::vector<const char*> args;
args.clear(); args.clear();
args.push_back("kstat"); args.push_back("kstat");
args.push_back("-p"); args.push_back("-p");
kwsys_stl::string command = arguments; std::string command = arguments;
size_t start = command.npos; size_t start = command.npos;
size_t pos = command.find(' ',0); size_t pos = command.find(' ',0);
while(pos!=command.npos) while(pos!=command.npos)
@ -4701,7 +4695,7 @@ kwsys_stl::string SystemInformationImplementation::ParseValueFromKStat(const cha
if(!inQuotes) if(!inQuotes)
{ {
kwsys_stl::string arg = command.substr(start+1,pos-start-1); std::string arg = command.substr(start+1,pos-start-1);
// Remove the quotes if any // Remove the quotes if any
size_t quotes = arg.find('"'); size_t quotes = arg.find('"');
@ -4715,14 +4709,14 @@ kwsys_stl::string SystemInformationImplementation::ParseValueFromKStat(const cha
} }
pos = command.find(' ',pos+1); pos = command.find(' ',pos+1);
} }
kwsys_stl::string lastArg = command.substr(start+1,command.size()-start-1); std::string lastArg = command.substr(start+1,command.size()-start-1);
args.push_back(lastArg.c_str()); args.push_back(lastArg.c_str());
args.push_back(0); args.push_back(0);
kwsys_stl::string buffer = this->RunProcess(args); std::string buffer = this->RunProcess(args);
kwsys_stl::string value = ""; std::string value = "";
for(size_t i=buffer.size()-1;i>0;i--) for(size_t i=buffer.size()-1;i>0;i--)
{ {
if(buffer[i] == ' ' || buffer[i] == '\t') if(buffer[i] == ' ' || buffer[i] == '\t')
@ -4731,7 +4725,7 @@ kwsys_stl::string SystemInformationImplementation::ParseValueFromKStat(const cha
} }
if(buffer[i] != '\n' && buffer[i] != '\r') if(buffer[i] != '\n' && buffer[i] != '\r')
{ {
kwsys_stl::string val = value; std::string val = value;
value = buffer[i]; value = buffer[i];
value += val; value += val;
} }
@ -4885,8 +4879,8 @@ bool SystemInformationImplementation::QueryHaikuInfo()
bool SystemInformationImplementation::QueryQNXMemory() bool SystemInformationImplementation::QueryQNXMemory()
{ {
#if defined(__QNX__) #if defined(__QNX__)
kwsys_stl::string buffer; std::string buffer;
kwsys_stl::vector<const char*> args; std::vector<const char*> args;
args.clear(); args.clear();
args.push_back("showmem"); args.push_back("showmem");
@ -4943,8 +4937,8 @@ bool SystemInformationImplementation::QueryQNXProcessor()
#if defined(__QNX__) #if defined(__QNX__)
// the output on my QNX 6.4.1 looks like this: // the output on my QNX 6.4.1 looks like this:
// Processor1: 686 Pentium II Stepping 3 2175MHz FPU // Processor1: 686 Pentium II Stepping 3 2175MHz FPU
kwsys_stl::string buffer; std::string buffer;
kwsys_stl::vector<const char*> args; std::vector<const char*> args;
args.clear(); args.clear();
args.push_back("pidin"); args.push_back("pidin");
@ -5440,10 +5434,10 @@ bool SystemInformationImplementation::QueryOSInformation()
int SystemInformationImplementation::CallSwVers( int SystemInformationImplementation::CallSwVers(
const char *arg, const char *arg,
kwsys_stl::string &ver) std::string &ver)
{ {
#ifdef __APPLE__ #ifdef __APPLE__
kwsys_stl::vector<const char*> args; std::vector<const char*> args;
args.push_back("sw_vers"); args.push_back("sw_vers");
args.push_back(arg); args.push_back(arg);
args.push_back(0); args.push_back(0);
@ -5457,18 +5451,18 @@ int SystemInformationImplementation::CallSwVers(
return 0; return 0;
} }
void SystemInformationImplementation::TrimNewline(kwsys_stl::string& output) void SystemInformationImplementation::TrimNewline(std::string& output)
{ {
// remove \r // remove \r
kwsys_stl::string::size_type pos=0; std::string::size_type pos=0;
while((pos = output.find("\r", pos)) != kwsys_stl::string::npos) while((pos = output.find("\r", pos)) != std::string::npos)
{ {
output.erase(pos); output.erase(pos);
} }
// remove \n // remove \n
pos = 0; pos = 0;
while((pos = output.find("\n", pos)) != kwsys_stl::string::npos) while((pos = output.find("\n", pos)) != std::string::npos)
{ {
output.erase(pos); output.erase(pos);
} }

View File

@ -12,14 +12,9 @@
#ifndef @KWSYS_NAMESPACE@_SystemInformation_h #ifndef @KWSYS_NAMESPACE@_SystemInformation_h
#define @KWSYS_NAMESPACE@_SystemInformation_h #define @KWSYS_NAMESPACE@_SystemInformation_h
#include <@KWSYS_NAMESPACE@/Configure.hxx>
/* 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
#include <@KWSYS_NAMESPACE@/stl/string>
#include <stddef.h> /* size_t */ #include <stddef.h> /* size_t */
#include <string>
namespace @KWSYS_NAMESPACE@ namespace @KWSYS_NAMESPACE@
{ {
@ -45,11 +40,11 @@ public:
const char * GetVendorString(); const char * GetVendorString();
const char * GetVendorID(); const char * GetVendorID();
kwsys_stl::string GetTypeID(); std::string GetTypeID();
kwsys_stl::string GetFamilyID(); std::string GetFamilyID();
kwsys_stl::string GetModelID(); std::string GetModelID();
kwsys_stl::string GetModelName(); std::string GetModelName();
kwsys_stl::string GetSteppingCode(); std::string GetSteppingCode();
const char * GetExtendedProcessorName(); const char * GetExtendedProcessorName();
const char * GetProcessorSerialNumber(); const char * GetProcessorSerialNumber();
int GetProcessorCacheSize(); int GetProcessorCacheSize();
@ -61,10 +56,10 @@ public:
// returns an informative general description of the cpu // returns an informative general description of the cpu
// on this system. // on this system.
kwsys_stl::string GetCPUDescription(); std::string GetCPUDescription();
const char * GetHostname(); const char * GetHostname();
kwsys_stl::string GetFullyQualifiedDomainName(); std::string GetFullyQualifiedDomainName();
const char * GetOSName(); const char * GetOSName();
const char * GetOSRelease(); const char * GetOSRelease();
@ -77,7 +72,7 @@ public:
// returns an informative general description of the os // returns an informative general description of the os
// on this system. // on this system.
kwsys_stl::string GetOSDescription(); std::string GetOSDescription();
bool Is64Bits(); bool Is64Bits();
@ -98,7 +93,7 @@ public:
// returns an informative general description if the installed and // returns an informative general description if the installed and
// available ram on this system. See the GetHostMmeoryTotal, and // available ram on this system. See the GetHostMmeoryTotal, and
// Get{Host,Proc}MemoryAvailable methods for more information. // Get{Host,Proc}MemoryAvailable methods for more information.
kwsys_stl::string GetMemoryDescription( std::string GetMemoryDescription(
const char *hostLimitEnvVarName=NULL, const char *hostLimitEnvVarName=NULL,
const char *procLimitEnvVarName=NULL); const char *procLimitEnvVarName=NULL);
@ -144,7 +139,7 @@ public:
// order to produce an informative stack trace the application // order to produce an informative stack trace the application
// should be dynamically linked and compiled with debug symbols. // should be dynamically linked and compiled with debug symbols.
static static
kwsys_stl::string GetProgramStack(int firstFrame, int wholePath); std::string GetProgramStack(int firstFrame, int wholePath);
/** Run the different checks */ /** Run the different checks */
void RunCPUCheck(); void RunCPUCheck();
@ -154,10 +149,4 @@ public:
} // namespace @KWSYS_NAMESPACE@ } // namespace @KWSYS_NAMESPACE@
/* Undefine temporary macros. */
#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
# undef kwsys_stl
# undef kwsys_ios
#endif
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -12,12 +12,13 @@
#ifndef @KWSYS_NAMESPACE@_SystemTools_hxx #ifndef @KWSYS_NAMESPACE@_SystemTools_hxx
#define @KWSYS_NAMESPACE@_SystemTools_hxx #define @KWSYS_NAMESPACE@_SystemTools_hxx
#include <@KWSYS_NAMESPACE@/ios/iosfwd> #include <@KWSYS_NAMESPACE@/Configure.hxx>
#include <@KWSYS_NAMESPACE@/stl/string>
#include <@KWSYS_NAMESPACE@/stl/vector> #include <iosfwd>
#include <@KWSYS_NAMESPACE@/stl/map> #include <string>
#include <vector>
#include <map>
#include <@KWSYS_NAMESPACE@/Configure.h>
#include <@KWSYS_NAMESPACE@/String.hxx> #include <@KWSYS_NAMESPACE@/String.hxx>
#include <sys/types.h> #include <sys/types.h>
@ -29,7 +30,7 @@
#include <stdarg.h> #include <stdarg.h>
// Required for FILE* // Required for FILE*
#include <stdio.h> #include <stdio.h>
#if @KWSYS_NAMESPACE@_STL_HAVE_STD && !defined(va_list) #if !defined(va_list)
// Some compilers move va_list into the std namespace and there is no way to // Some compilers move va_list into the std namespace and there is no way to
// tell that this has been done. Playing with things being included before or // tell that this has been done. Playing with things being included before or
// after stdarg.h does not solve things because we do not have control over // after stdarg.h does not solve things because we do not have control over
@ -47,12 +48,6 @@ namespace @KWSYS_NAMESPACE@
} }
#endif // va_list #endif // va_list
/* 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@ namespace @KWSYS_NAMESPACE@
{ {
@ -112,9 +107,9 @@ public:
* then an underscore is prepended. Note that this can produce * then an underscore is prepended. Note that this can produce
* identifiers that the standard reserves (_[A-Z].* and __.*). * identifiers that the standard reserves (_[A-Z].* and __.*).
*/ */
static kwsys_stl::string MakeCidentifier(const kwsys_stl::string& s); static std::string MakeCidentifier(const std::string& s);
static kwsys_stl::string MakeCindentifier(const kwsys_stl::string& s) static std::string MakeCindentifier(const std::string& s)
{ {
return MakeCidentifier(s); return MakeCidentifier(s);
} }
@ -122,40 +117,40 @@ public:
/** /**
* Replace replace all occurences of the string in the source string. * Replace replace all occurences of the string in the source string.
*/ */
static void ReplaceString(kwsys_stl::string& source, static void ReplaceString(std::string& source,
const char* replace, const char* replace,
const char* with); const char* with);
static void ReplaceString(kwsys_stl::string& source, static void ReplaceString(std::string& source,
const kwsys_stl::string& replace, const std::string& replace,
const kwsys_stl::string& with); const std::string& with);
/** /**
* Return a capitalized string (i.e the first letter is uppercased, * Return a capitalized string (i.e the first letter is uppercased,
* all other are lowercased). * all other are lowercased).
*/ */
static kwsys_stl::string Capitalized(const kwsys_stl::string&); static std::string Capitalized(const std::string&);
/** /**
* Return a 'capitalized words' string (i.e the first letter of each word * Return a 'capitalized words' string (i.e the first letter of each word
* is uppercased all other are left untouched though). * is uppercased all other are left untouched though).
*/ */
static kwsys_stl::string CapitalizedWords(const kwsys_stl::string&); static std::string CapitalizedWords(const std::string&);
/** /**
* Return a 'uncapitalized words' string (i.e the first letter of each word * Return a 'uncapitalized words' string (i.e the first letter of each word
* is lowercased all other are left untouched though). * is lowercased all other are left untouched though).
*/ */
static kwsys_stl::string UnCapitalizedWords(const kwsys_stl::string&); static std::string UnCapitalizedWords(const std::string&);
/** /**
* Return a lower case string * Return a lower case string
*/ */
static kwsys_stl::string LowerCase(const kwsys_stl::string&); static std::string LowerCase(const std::string&);
/** /**
* Return a lower case string * Return a lower case string
*/ */
static kwsys_stl::string UpperCase(const kwsys_stl::string&); static std::string UpperCase(const std::string&);
/** /**
* Count char in string * Count char in string
@ -184,9 +179,9 @@ public:
* Returns true if str1 starts (respectively ends) with str2 * Returns true if str1 starts (respectively ends) with str2
*/ */
static bool StringStartsWith(const char* str1, const char* str2); static bool StringStartsWith(const char* str1, const char* str2);
static bool StringStartsWith(const kwsys_stl::string& str1, const char* str2); static bool StringStartsWith(const std::string& str1, const char* str2);
static bool StringEndsWith(const char* str1, const char* str2); static bool StringEndsWith(const char* str1, const char* str2);
static bool StringEndsWith(const kwsys_stl::string& str1, const char* str2); static bool StringEndsWith(const std::string& str1, const char* str2);
/** /**
* Returns a pointer to the last occurence of str2 in str1 * Returns a pointer to the last occurence of str2 in str1
@ -204,14 +199,14 @@ public:
* Return the string cropped to a given length by removing chars in the * Return the string cropped to a given length by removing chars in the
* center of the string and replacing them with an ellipsis (...) * center of the string and replacing them with an ellipsis (...)
*/ */
static kwsys_stl::string CropString(const kwsys_stl::string&,size_t max_len); static std::string CropString(const std::string&,size_t max_len);
/** split a path by separator into an array of strings, default is /. /** split a path by separator into an array of strings, default is /.
If isPath is true then the string is treated like a path and if If isPath is true then the string is treated like a path and if
s starts with a / then the first element of the returned array will s starts with a / then the first element of the returned array will
be /, so /foo/bar will be [/, foo, bar] be /, so /foo/bar will be [/, foo, bar]
*/ */
static kwsys_stl::vector<String> SplitString(const kwsys_stl::string& s, char separator = '/', static std::vector<String> SplitString(const std::string& s, char separator = '/',
bool isPath = false); bool isPath = false);
/** /**
* Perform a case-independent string comparison * Perform a case-independent string comparison
@ -229,16 +224,16 @@ public:
* Split a string on its newlines into multiple lines * Split a string on its newlines into multiple lines
* Return false only if the last line stored had no newline * Return false only if the last line stored had no newline
*/ */
static bool Split(const kwsys_stl::string& s, kwsys_stl::vector<kwsys_stl::string>& l); static bool Split(const std::string& s, std::vector<std::string>& l);
static bool Split(const kwsys_stl::string& s, kwsys_stl::vector<kwsys_stl::string>& l, char separator); static bool Split(const std::string& s, std::vector<std::string>& l, char separator);
/** /**
* Return string with space added between capitalized words * Return string with space added between capitalized words
* (i.e. EatMyShorts becomes Eat My Shorts ) * (i.e. EatMyShorts becomes Eat My Shorts )
* (note that IEatShorts becomes IEat Shorts) * (note that IEatShorts becomes IEat Shorts)
*/ */
static kwsys_stl::string AddSpaceBetweenCapitalizedWords( static std::string AddSpaceBetweenCapitalizedWords(
const kwsys_stl::string&); const std::string&);
/** /**
* Append two or more strings and produce new one. * Append two or more strings and produce new one.
@ -265,7 +260,7 @@ public:
/** /**
* Escape specific characters in 'str'. * Escape specific characters in 'str'.
*/ */
static kwsys_stl::string EscapeChars( static std::string EscapeChars(
const char *str, const char *chars_to_escape, char escape_char = '\\'); const char *str, const char *chars_to_escape, char escape_char = '\\');
/** ----------------------------------------------------------------- /** -----------------------------------------------------------------
@ -276,7 +271,7 @@ public:
/** /**
* Replace Windows file system slashes with Unix-style slashes. * Replace Windows file system slashes with Unix-style slashes.
*/ */
static void ConvertToUnixSlashes(kwsys_stl::string& path); static void ConvertToUnixSlashes(std::string& path);
#ifdef _WIN32 #ifdef _WIN32
/** /**
@ -286,20 +281,20 @@ public:
* will be prefixed with \\?\UNC\. All output will also be converted to * will be prefixed with \\?\UNC\. All output will also be converted to
* absolute paths with Windows-style backslashes. * absolute paths with Windows-style backslashes.
**/ **/
static kwsys_stl::wstring ConvertToWindowsExtendedPath(const kwsys_stl::string&); static std::wstring ConvertToWindowsExtendedPath(const std::string&);
#endif #endif
/** /**
* For windows this calls ConvertToWindowsOutputPath and for unix * For windows this calls ConvertToWindowsOutputPath and for unix
* it calls ConvertToUnixOutputPath * it calls ConvertToUnixOutputPath
*/ */
static kwsys_stl::string ConvertToOutputPath(const kwsys_stl::string&); static std::string ConvertToOutputPath(const std::string&);
/** /**
* Convert the path to a string that can be used in a unix makefile. * Convert the path to a string that can be used in a unix makefile.
* double slashes are removed, and spaces are escaped. * double slashes are removed, and spaces are escaped.
*/ */
static kwsys_stl::string ConvertToUnixOutputPath(const kwsys_stl::string&); static std::string ConvertToUnixOutputPath(const std::string&);
/** /**
* Convert the path to string that can be used in a windows project or * Convert the path to string that can be used in a windows project or
@ -307,7 +302,7 @@ public:
* the string, the slashes are converted to windows style backslashes, and * the string, the slashes are converted to windows style backslashes, and
* if there are spaces in the string it is double quoted. * if there are spaces in the string it is double quoted.
*/ */
static kwsys_stl::string ConvertToWindowsOutputPath(const kwsys_stl::string&); static std::string ConvertToWindowsOutputPath(const std::string&);
/** /**
* Return true if a file exists in the current directory. * Return true if a file exists in the current directory.
@ -318,9 +313,9 @@ public:
* for read access is only done on POSIX systems.) * for read access is only done on POSIX systems.)
*/ */
static bool FileExists(const char* filename, bool isFile); static bool FileExists(const char* filename, bool isFile);
static bool FileExists(const kwsys_stl::string& filename, bool isFile); static bool FileExists(const std::string& filename, bool isFile);
static bool FileExists(const char* filename); static bool FileExists(const char* filename);
static bool FileExists(const kwsys_stl::string& filename); static bool FileExists(const std::string& filename);
/** /**
* Test if a file exists and can be accessed with the requested * Test if a file exists and can be accessed with the requested
@ -334,7 +329,7 @@ public:
*/ */
static bool TestFileAccess(const char* filename, static bool TestFileAccess(const char* filename,
TestFilePermissions permissions); TestFilePermissions permissions);
static bool TestFileAccess(const kwsys_stl::string& filename, static bool TestFileAccess(const std::string& filename,
TestFilePermissions permissions); TestFilePermissions permissions);
/** /**
@ -349,12 +344,12 @@ public:
/** /**
* Return file length * Return file length
*/ */
static unsigned long FileLength(const kwsys_stl::string& filename); static unsigned long FileLength(const std::string& filename);
/** /**
Change the modification time or create a file Change the modification time or create a file
*/ */
static bool Touch(const kwsys_stl::string& filename, bool create); static bool Touch(const std::string& filename, bool create);
/** /**
* Compare file modification times. * Compare file modification times.
@ -362,8 +357,8 @@ public:
* When true is returned, result has -1, 0, +1 for * When true is returned, result has -1, 0, +1 for
* f1 older, same, or newer than f2. * f1 older, same, or newer than f2.
*/ */
static bool FileTimeCompare(const kwsys_stl::string& f1, static bool FileTimeCompare(const std::string& f1,
const kwsys_stl::string& f2, const std::string& f2,
int* result); int* result);
/** /**
@ -378,17 +373,17 @@ public:
* does not exist path is returned unchanged. This does nothing * does not exist path is returned unchanged. This does nothing
* on unix but return path. * on unix but return path.
*/ */
static kwsys_stl::string GetActualCaseForPath(const kwsys_stl::string& path); static std::string GetActualCaseForPath(const std::string& path);
/** /**
* Given the path to a program executable, get the directory part of * Given the path to a program executable, get the directory part of
* the path with the file stripped off. If there is no directory * the path with the file stripped off. If there is no directory
* part, the empty string is returned. * part, the empty string is returned.
*/ */
static kwsys_stl::string GetProgramPath(const kwsys_stl::string&); static std::string GetProgramPath(const std::string&);
static bool SplitProgramPath(const kwsys_stl::string& in_name, static bool SplitProgramPath(const std::string& in_name,
kwsys_stl::string& dir, std::string& dir,
kwsys_stl::string& file, std::string& file,
bool errorReport = true); bool errorReport = true);
/** /**
@ -404,8 +399,8 @@ public:
* installPrefix is a possibly null pointer to the install directory. * installPrefix is a possibly null pointer to the install directory.
*/ */
static bool FindProgramPath(const char* argv0, static bool FindProgramPath(const char* argv0,
kwsys_stl::string& pathOut, std::string& pathOut,
kwsys_stl::string& errorMsg, std::string& errorMsg,
const char* exeName = 0, const char* exeName = 0,
const char* buildDir = 0, const char* buildDir = 0,
const char* installPrefix = 0); const char* installPrefix = 0);
@ -416,11 +411,11 @@ public:
* (which defaults to the current working directory). The full path * (which defaults to the current working directory). The full path
* is returned. * is returned.
*/ */
static kwsys_stl::string CollapseFullPath(const kwsys_stl::string& in_relative); static std::string CollapseFullPath(const std::string& in_relative);
static kwsys_stl::string CollapseFullPath(const kwsys_stl::string& in_relative, static std::string CollapseFullPath(const std::string& in_relative,
const char* in_base); const char* in_base);
static kwsys_stl::string CollapseFullPath(const kwsys_stl::string& in_relative, static std::string CollapseFullPath(const std::string& in_relative,
const kwsys_stl::string& in_base); const std::string& in_base);
/** /**
* Get the real path for a given path, removing all symlinks. In * Get the real path for a given path, removing all symlinks. In
@ -429,8 +424,8 @@ public:
* NULL. Otherwise empty string is returned and errorMessage * NULL. Otherwise empty string is returned and errorMessage
* contains error description. * contains error description.
*/ */
static kwsys_stl::string GetRealPath(const kwsys_stl::string& path, static std::string GetRealPath(const std::string& path,
kwsys_stl::string* errorMessage = 0); std::string* errorMessage = 0);
/** /**
* Split a path name into its root component and the rest of the * Split a path name into its root component and the rest of the
@ -448,7 +443,7 @@ public:
* given. * given.
*/ */
static const char* SplitPathRootComponent(const std::string& p, static const char* SplitPathRootComponent(const std::string& p,
kwsys_stl::string* root=0); std::string* root=0);
/** /**
* Split a path name into its basic components. The first component * Split a path name into its basic components. The first component
@ -461,76 +456,76 @@ public:
* platform supports them. * platform supports them.
*/ */
static void SplitPath(const std::string& p, static void SplitPath(const std::string& p,
kwsys_stl::vector<kwsys_stl::string>& components, std::vector<std::string>& components,
bool expand_home_dir = true); bool expand_home_dir = true);
/** /**
* Join components of a path name into a single string. See * Join components of a path name into a single string. See
* SplitPath for the format of the components. * SplitPath for the format of the components.
*/ */
static kwsys_stl::string JoinPath( static std::string JoinPath(
const kwsys_stl::vector<kwsys_stl::string>& components); const std::vector<std::string>& components);
static kwsys_stl::string JoinPath( static std::string JoinPath(
kwsys_stl::vector<kwsys_stl::string>::const_iterator first, std::vector<std::string>::const_iterator first,
kwsys_stl::vector<kwsys_stl::string>::const_iterator last); std::vector<std::string>::const_iterator last);
/** /**
* Compare a path or components of a path. * Compare a path or components of a path.
*/ */
static bool ComparePath(const kwsys_stl::string& c1, const kwsys_stl::string& c2); static bool ComparePath(const std::string& c1, const std::string& c2);
/** /**
* Return path of a full filename (no trailing slashes) * Return path of a full filename (no trailing slashes)
*/ */
static kwsys_stl::string GetFilenamePath(const kwsys_stl::string&); static std::string GetFilenamePath(const std::string&);
/** /**
* Return file name of a full filename (i.e. file name without path) * Return file name of a full filename (i.e. file name without path)
*/ */
static kwsys_stl::string GetFilenameName(const kwsys_stl::string&); static std::string GetFilenameName(const std::string&);
/** /**
* Split a program from its arguments and handle spaces in the paths * Split a program from its arguments and handle spaces in the paths
*/ */
static void SplitProgramFromArgs( static void SplitProgramFromArgs(
const kwsys_stl::string& path, const std::string& path,
kwsys_stl::string& program, kwsys_stl::string& args); std::string& program, std::string& args);
/** /**
* Return longest file extension of a full filename (dot included) * Return longest file extension of a full filename (dot included)
*/ */
static kwsys_stl::string GetFilenameExtension(const kwsys_stl::string&); static std::string GetFilenameExtension(const std::string&);
/** /**
* Return shortest file extension of a full filename (dot included) * Return shortest file extension of a full filename (dot included)
*/ */
static kwsys_stl::string GetFilenameLastExtension( static std::string GetFilenameLastExtension(
const kwsys_stl::string& filename); const std::string& filename);
/** /**
* Return file name without extension of a full filename * Return file name without extension of a full filename
*/ */
static kwsys_stl::string GetFilenameWithoutExtension( static std::string GetFilenameWithoutExtension(
const kwsys_stl::string&); const std::string&);
/** /**
* Return file name without its last (shortest) extension * Return file name without its last (shortest) extension
*/ */
static kwsys_stl::string GetFilenameWithoutLastExtension( static std::string GetFilenameWithoutLastExtension(
const kwsys_stl::string&); const std::string&);
/** /**
* Return whether the path represents a full path (not relative) * Return whether the path represents a full path (not relative)
*/ */
static bool FileIsFullPath(const kwsys_stl::string&); static bool FileIsFullPath(const std::string&);
static bool FileIsFullPath(const char*); static bool FileIsFullPath(const char*);
/** /**
* For windows return the short path for the given path, * For windows return the short path for the given path,
* Unix just a pass through * Unix just a pass through
*/ */
static bool GetShortPath(const kwsys_stl::string& path, kwsys_stl::string& result); static bool GetShortPath(const std::string& path, std::string& result);
/** /**
* Read line from file. Make sure to get everything. Due to a buggy stream * Read line from file. Make sure to get everything. Due to a buggy stream
@ -539,20 +534,20 @@ public:
* end-of-file was reached. If the has_newline argument is specified, it will * end-of-file was reached. If the has_newline argument is specified, it will
* be true when the line read had a newline character. * be true when the line read had a newline character.
*/ */
static bool GetLineFromStream(kwsys_ios::istream& istr, static bool GetLineFromStream(std::istream& istr,
kwsys_stl::string& line, std::string& line,
bool* has_newline=0, bool* has_newline=0,
long sizeLimit=-1); long sizeLimit=-1);
/** /**
* Get the parent directory of the directory or file * Get the parent directory of the directory or file
*/ */
static kwsys_stl::string GetParentDirectory(const kwsys_stl::string& fileOrDir); static std::string GetParentDirectory(const std::string& fileOrDir);
/** /**
* Check if the given file or directory is in subdirectory of dir * Check if the given file or directory is in subdirectory of dir
*/ */
static bool IsSubDirectory(const kwsys_stl::string& fileOrDir, const kwsys_stl::string& dir); static bool IsSubDirectory(const std::string& fileOrDir, const std::string& dir);
/** ----------------------------------------------------------------- /** -----------------------------------------------------------------
* File Manipulation Routines * File Manipulation Routines
@ -562,7 +557,7 @@ public:
/** /**
* Open a file considering unicode. * Open a file considering unicode.
*/ */
static FILE* Fopen(const kwsys_stl::string& file, const char* mode); static FILE* Fopen(const std::string& file, const char* mode);
/** /**
* Make a new directory if it is not there. This function * Make a new directory if it is not there. This function
@ -570,36 +565,36 @@ public:
* prior to calling this function. * prior to calling this function.
*/ */
static bool MakeDirectory(const char* path); static bool MakeDirectory(const char* path);
static bool MakeDirectory(const kwsys_stl::string& path); static bool MakeDirectory(const std::string& path);
/** /**
* Copy the source file to the destination file only * Copy the source file to the destination file only
* if the two files differ. * if the two files differ.
*/ */
static bool CopyFileIfDifferent(const kwsys_stl::string& source, static bool CopyFileIfDifferent(const std::string& source,
const kwsys_stl::string& destination); const std::string& destination);
/** /**
* Compare the contents of two files. Return true if different * Compare the contents of two files. Return true if different
*/ */
static bool FilesDiffer(const kwsys_stl::string& source, const kwsys_stl::string& destination); static bool FilesDiffer(const std::string& source, const std::string& destination);
/** /**
* Return true if the two files are the same file * Return true if the two files are the same file
*/ */
static bool SameFile(const kwsys_stl::string& file1, const kwsys_stl::string& file2); static bool SameFile(const std::string& file1, const std::string& file2);
/** /**
* Copy a file. * Copy a file.
*/ */
static bool CopyFileAlways(const kwsys_stl::string& source, const kwsys_stl::string& destination); static bool CopyFileAlways(const std::string& source, const std::string& destination);
/** /**
* Copy a file. If the "always" argument is true the file is always * Copy a file. If the "always" argument is true the file is always
* copied. If it is false, the file is copied only if it is new or * copied. If it is false, the file is copied only if it is new or
* has changed. * has changed.
*/ */
static bool CopyAFile(const kwsys_stl::string& source, const kwsys_stl::string& destination, static bool CopyAFile(const std::string& source, const std::string& destination,
bool always = true); bool always = true);
/** /**
@ -608,18 +603,18 @@ public:
* always copied. If it is false, only files that have changed or * always copied. If it is false, only files that have changed or
* are new are copied. * are new are copied.
*/ */
static bool CopyADirectory(const kwsys_stl::string& source, const kwsys_stl::string& destination, static bool CopyADirectory(const std::string& source, const std::string& destination,
bool always = true); bool always = true);
/** /**
* Remove a file * Remove a file
*/ */
static bool RemoveFile(const kwsys_stl::string& source); static bool RemoveFile(const std::string& source);
/** /**
* Remove a directory * Remove a directory
*/ */
static bool RemoveADirectory(const kwsys_stl::string& source); static bool RemoveADirectory(const std::string& source);
/** /**
* Get the maximum full file path length * Get the maximum full file path length
@ -629,56 +624,56 @@ public:
/** /**
* Find a file in the system PATH, with optional extra paths * Find a file in the system PATH, with optional extra paths
*/ */
static kwsys_stl::string FindFile( static std::string FindFile(
const kwsys_stl::string& name, const std::string& name,
const kwsys_stl::vector<kwsys_stl::string>& path = const std::vector<std::string>& path =
kwsys_stl::vector<kwsys_stl::string>(), std::vector<std::string>(),
bool no_system_path = false); bool no_system_path = false);
/** /**
* Find a directory in the system PATH, with optional extra paths * Find a directory in the system PATH, with optional extra paths
*/ */
static kwsys_stl::string FindDirectory( static std::string FindDirectory(
const kwsys_stl::string& name, const std::string& name,
const kwsys_stl::vector<kwsys_stl::string>& path = const std::vector<std::string>& path =
kwsys_stl::vector<kwsys_stl::string>(), std::vector<std::string>(),
bool no_system_path = false); bool no_system_path = false);
/** /**
* Find an executable in the system PATH, with optional extra paths * Find an executable in the system PATH, with optional extra paths
*/ */
static kwsys_stl::string FindProgram( static std::string FindProgram(
const char* name, const char* name,
const kwsys_stl::vector<kwsys_stl::string>& path = const std::vector<std::string>& path =
kwsys_stl::vector<kwsys_stl::string>(), std::vector<std::string>(),
bool no_system_path = false); bool no_system_path = false);
static kwsys_stl::string FindProgram( static std::string FindProgram(
const kwsys_stl::string& name, const std::string& name,
const kwsys_stl::vector<kwsys_stl::string>& path = const std::vector<std::string>& path =
kwsys_stl::vector<kwsys_stl::string>(), std::vector<std::string>(),
bool no_system_path = false); bool no_system_path = false);
static kwsys_stl::string FindProgram( static std::string FindProgram(
const kwsys_stl::vector<kwsys_stl::string>& names, const std::vector<std::string>& names,
const kwsys_stl::vector<kwsys_stl::string>& path = const std::vector<std::string>& path =
kwsys_stl::vector<kwsys_stl::string>(), std::vector<std::string>(),
bool no_system_path = false); bool no_system_path = false);
/** /**
* Find a library in the system PATH, with optional extra paths * Find a library in the system PATH, with optional extra paths
*/ */
static kwsys_stl::string FindLibrary( static std::string FindLibrary(
const kwsys_stl::string& name, const std::string& name,
const kwsys_stl::vector<kwsys_stl::string>& path); const std::vector<std::string>& path);
/** /**
* Return true if the file is a directory * Return true if the file is a directory
*/ */
static bool FileIsDirectory(const kwsys_stl::string& name); static bool FileIsDirectory(const std::string& name);
/** /**
* Return true if the file is a symlink * Return true if the file is a symlink
*/ */
static bool FileIsSymlink(const kwsys_stl::string& name); static bool FileIsSymlink(const std::string& name);
/** /**
* Return true if the file has a given signature (first set of bytes) * Return true if the file has a given signature (first set of bytes)
@ -710,13 +705,13 @@ public:
* Create a symbolic link if the platform supports it. Returns whether * Create a symbolic link if the platform supports it. Returns whether
* creation succeded. * creation succeded.
*/ */
static bool CreateSymlink(const kwsys_stl::string& origName, const kwsys_stl::string& newName); static bool CreateSymlink(const std::string& origName, const std::string& newName);
/** /**
* Read the contents of a symbolic link. Returns whether reading * Read the contents of a symbolic link. Returns whether reading
* succeded. * succeded.
*/ */
static bool ReadSymlink(const kwsys_stl::string& newName, kwsys_stl::string& origName); static bool ReadSymlink(const std::string& newName, std::string& origName);
/** /**
* Try to locate the file 'filename' in the directory 'dir'. * Try to locate the file 'filename' in the directory 'dir'.
@ -735,7 +730,7 @@ public:
*/ */
static bool LocateFileInDir(const char *filename, static bool LocateFileInDir(const char *filename,
const char *dir, const char *dir,
kwsys_stl::string& filename_found, std::string& filename_found,
int try_filename_dirs = 0); int try_filename_dirs = 0);
/** compute the relative path from local to remote. local must /** compute the relative path from local to remote. local must
@ -746,17 +741,17 @@ public:
/a/b/c/d to /a/b/c1/d1 -> ../../c1/d1 /a/b/c/d to /a/b/c1/d1 -> ../../c1/d1
from /usr/src to /usr/src/test/blah/foo.cpp -> test/blah/foo.cpp from /usr/src to /usr/src/test/blah/foo.cpp -> test/blah/foo.cpp
*/ */
static kwsys_stl::string RelativePath(const kwsys_stl::string& local, const kwsys_stl::string& remote); static std::string RelativePath(const std::string& local, const std::string& remote);
/** /**
* Return file's modified time * Return file's modified time
*/ */
static long int ModifiedTime(const kwsys_stl::string& filename); static long int ModifiedTime(const std::string& filename);
/** /**
* Return file's creation time (Win32: works only for NTFS, not FAT) * Return file's creation time (Win32: works only for NTFS, not FAT)
*/ */
static long int CreationTime(const kwsys_stl::string& filename); static long int CreationTime(const std::string& filename);
/** /**
* Visual C++ does not define mode_t (note that Borland does, however). * Visual C++ does not define mode_t (note that Borland does, however).
@ -774,11 +769,9 @@ public:
* if a honor_umask parameter is set to true. * if a honor_umask parameter is set to true.
*/ */
static bool GetPermissions(const char* file, mode_t& mode); static bool GetPermissions(const char* file, mode_t& mode);
static bool GetPermissions(const kwsys_stl::string& file, mode_t& mode); static bool GetPermissions(const std::string& file, mode_t& mode);
static bool SetPermissions( static bool SetPermissions(const char* file, mode_t mode, bool honor_umask = false);
const char* file, mode_t mode, bool honor_umask = false); static bool SetPermissions(const std::string& file, mode_t mode, bool honor_umask = false);
static bool SetPermissions(
const kwsys_stl::string& file, mode_t mode, bool honor_umask = false);
/** ----------------------------------------------------------------- /** -----------------------------------------------------------------
* Time Manipulation Routines * Time Manipulation Routines
@ -791,7 +784,7 @@ public:
/** /**
* Get current date/time * Get current date/time
*/ */
static kwsys_stl::string GetCurrentDateTime(const char* format); static std::string GetCurrentDateTime(const char* format);
/** ----------------------------------------------------------------- /** -----------------------------------------------------------------
* Registry Manipulation Routines * Registry Manipulation Routines
@ -808,26 +801,26 @@ public:
/** /**
* Get a list of subkeys. * Get a list of subkeys.
*/ */
static bool GetRegistrySubKeys(const kwsys_stl::string& key, static bool GetRegistrySubKeys(const std::string& key,
kwsys_stl::vector<kwsys_stl::string>& subkeys, std::vector<std::string>& subkeys,
KeyWOW64 view = KeyWOW64_Default); KeyWOW64 view = KeyWOW64_Default);
/** /**
* Read a registry value * Read a registry value
*/ */
static bool ReadRegistryValue(const kwsys_stl::string& key, kwsys_stl::string &value, static bool ReadRegistryValue(const std::string& key, std::string &value,
KeyWOW64 view = KeyWOW64_Default); KeyWOW64 view = KeyWOW64_Default);
/** /**
* Write a registry value * Write a registry value
*/ */
static bool WriteRegistryValue(const kwsys_stl::string& key, const kwsys_stl::string& value, static bool WriteRegistryValue(const std::string& key, const std::string& value,
KeyWOW64 view = KeyWOW64_Default); KeyWOW64 view = KeyWOW64_Default);
/** /**
* Delete a registry value * Delete a registry value
*/ */
static bool DeleteRegistryValue(const kwsys_stl::string& key, static bool DeleteRegistryValue(const std::string& key,
KeyWOW64 view = KeyWOW64_Default); KeyWOW64 view = KeyWOW64_Default);
/** ----------------------------------------------------------------- /** -----------------------------------------------------------------
@ -840,39 +833,39 @@ public:
* string vector passed in. If env is set then the value * string vector passed in. If env is set then the value
* of env will be used instead of PATH. * of env will be used instead of PATH.
*/ */
static void GetPath(kwsys_stl::vector<kwsys_stl::string>& path, static void GetPath(std::vector<std::string>& path,
const char* env=0); const char* env=0);
/** /**
* Read an environment variable * Read an environment variable
*/ */
static const char* GetEnv(const char* key); static const char* GetEnv(const char* key);
static const char* GetEnv(const kwsys_stl::string& key); static const char* GetEnv(const std::string& key);
static bool GetEnv(const char* key, kwsys_stl::string& result); static bool GetEnv(const char* key, std::string& result);
static bool GetEnv(const kwsys_stl::string& key, kwsys_stl::string& result); static bool GetEnv(const std::string& key, std::string& result);
/** Put a string into the environment /** Put a string into the environment
of the form var=value */ of the form var=value */
static bool PutEnv(const kwsys_stl::string& env); static bool PutEnv(const std::string& env);
/** Remove a string from the environment. /** Remove a string from the environment.
Input is of the form "var" or "var=value" (value is ignored). */ Input is of the form "var" or "var=value" (value is ignored). */
static bool UnPutEnv(const kwsys_stl::string& env); static bool UnPutEnv(const std::string& env);
/** /**
* Get current working directory CWD * Get current working directory CWD
*/ */
static kwsys_stl::string GetCurrentWorkingDirectory(bool collapse =true); static std::string GetCurrentWorkingDirectory(bool collapse =true);
/** /**
* Change directory to the directory specified * Change directory to the directory specified
*/ */
static int ChangeDirectory(const kwsys_stl::string& dir); static int ChangeDirectory(const std::string& dir);
/** /**
* Get the result of strerror(errno) * Get the result of strerror(errno)
*/ */
static kwsys_stl::string GetLastSystemError(); static std::string GetLastSystemError();
/** /**
* When building DEBUG with MSVC, this enables a hook that prevents * When building DEBUG with MSVC, this enables a hook that prevents
@ -891,18 +884,18 @@ public:
/** /**
* Add an entry in the path translation table. * Add an entry in the path translation table.
*/ */
static void AddTranslationPath(const kwsys_stl::string& dir, const kwsys_stl::string& refdir); static void AddTranslationPath(const std::string& dir, const std::string& refdir);
/** /**
* If dir is different after CollapseFullPath is called, * If dir is different after CollapseFullPath is called,
* Then insert it into the path translation table * Then insert it into the path translation table
*/ */
static void AddKeepPath(const kwsys_stl::string& dir); static void AddKeepPath(const std::string& dir);
/** /**
* Update path by going through the Path Translation table; * Update path by going through the Path Translation table;
*/ */
static void CheckTranslationPath(kwsys_stl::string & path); static void CheckTranslationPath(std::string & path);
/** /**
* Delay the execution for a specified amount of time specified * Delay the execution for a specified amount of time specified
@ -914,7 +907,7 @@ public:
* Get the operating system name and version * Get the operating system name and version
* This is implemented for Win32 only for the moment * This is implemented for Win32 only for the moment
*/ */
static kwsys_stl::string GetOperatingSystemNameAndVersion(); static std::string GetOperatingSystemNameAndVersion();
/** ----------------------------------------------------------------- /** -----------------------------------------------------------------
* URL Manipulation Routines * URL Manipulation Routines
@ -927,9 +920,9 @@ public:
* and fill protocol as appropriate. * and fill protocol as appropriate.
* Return false if the URL does not have the required form, true otherwise. * Return false if the URL does not have the required form, true otherwise.
*/ */
static bool ParseURLProtocol( const kwsys_stl::string& URL, static bool ParseURLProtocol( const std::string& URL,
kwsys_stl::string& protocol, std::string& protocol,
kwsys_stl::string& dataglom ); std::string& dataglom );
/** /**
* Parse a string (a URL without protocol prefix) with the form: * Parse a string (a URL without protocol prefix) with the form:
@ -938,13 +931,13 @@ public:
* when values are found. * when values are found.
* Return true if the string matches the format; false otherwise. * Return true if the string matches the format; false otherwise.
*/ */
static bool ParseURL( const kwsys_stl::string& URL, static bool ParseURL( const std::string& URL,
kwsys_stl::string& protocol, std::string& protocol,
kwsys_stl::string& username, std::string& username,
kwsys_stl::string& password, std::string& password,
kwsys_stl::string& hostname, std::string& hostname,
kwsys_stl::string& dataport, std::string& dataport,
kwsys_stl::string& datapath ); std::string& datapath );
private: private:
/** /**
@ -968,10 +961,10 @@ private:
/** /**
* Actual implementation of ReplaceString. * Actual implementation of ReplaceString.
*/ */
static void ReplaceString(kwsys_stl::string& source, static void ReplaceString(std::string& source,
const char* replace, const char* replace,
size_t replaceSize, size_t replaceSize,
const kwsys_stl::string& with); const std::string& with);
/** /**
* Actual implementation of FileIsFullPath. * Actual implementation of FileIsFullPath.
@ -982,10 +975,10 @@ private:
* Find a filename (file or directory) in the system PATH, with * Find a filename (file or directory) in the system PATH, with
* optional extra paths. * optional extra paths.
*/ */
static kwsys_stl::string FindName( static std::string FindName(
const kwsys_stl::string& name, const std::string& name,
const kwsys_stl::vector<kwsys_stl::string>& path = const std::vector<std::string>& path =
kwsys_stl::vector<kwsys_stl::string>(), std::vector<std::string>(),
bool no_system_path = false); bool no_system_path = false);
@ -1005,10 +998,4 @@ private:
} // namespace @KWSYS_NAMESPACE@ } // namespace @KWSYS_NAMESPACE@
/* Undefine temporary macros. */
#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
# undef kwsys_stl
# undef kwsys_ios
#endif
#endif #endif

View File

@ -38,8 +38,8 @@
#define @KWSYS_NAMESPACE@_hash_fun_hxx #define @KWSYS_NAMESPACE@_hash_fun_hxx
#include <@KWSYS_NAMESPACE@/Configure.hxx> #include <@KWSYS_NAMESPACE@/Configure.hxx>
#include <@KWSYS_NAMESPACE@/cstddef> // size_t #include <stddef.h> // size_t
#include <@KWSYS_NAMESPACE@/stl/string> // string #include <string>
namespace @KWSYS_NAMESPACE@ namespace @KWSYS_NAMESPACE@
{ {
@ -55,90 +55,90 @@ inline size_t _stl_hash_string(const char* __s)
return size_t(__h); return size_t(__h);
} }
@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION template <>
struct hash<char*> { struct hash<char*> {
size_t operator()(const char* __s) const { return _stl_hash_string(__s); } size_t operator()(const char* __s) const { return _stl_hash_string(__s); }
}; };
@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION template <>
struct hash<const char*> { struct hash<const char*> {
size_t operator()(const char* __s) const { return _stl_hash_string(__s); } size_t operator()(const char* __s) const { return _stl_hash_string(__s); }
}; };
@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION template <>
struct hash<@KWSYS_NAMESPACE@_stl::string> { struct hash<std::string> {
size_t operator()(const @KWSYS_NAMESPACE@_stl::string & __s) const { return _stl_hash_string(__s.c_str()); } size_t operator()(const std::string & __s) const { return _stl_hash_string(__s.c_str()); }
}; };
#if !defined(__BORLANDC__) #if !defined(__BORLANDC__)
@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION template <>
struct hash<const @KWSYS_NAMESPACE@_stl::string> { struct hash<const std::string> {
size_t operator()(const @KWSYS_NAMESPACE@_stl::string & __s) const { return _stl_hash_string(__s.c_str()); } size_t operator()(const std::string & __s) const { return _stl_hash_string(__s.c_str()); }
}; };
#endif #endif
@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION template <>
struct hash<char> { struct hash<char> {
size_t operator()(char __x) const { return __x; } size_t operator()(char __x) const { return __x; }
}; };
@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION template <>
struct hash<unsigned char> { struct hash<unsigned char> {
size_t operator()(unsigned char __x) const { return __x; } size_t operator()(unsigned char __x) const { return __x; }
}; };
@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION template <>
struct hash<signed char> { struct hash<signed char> {
size_t operator()(unsigned char __x) const { return __x; } size_t operator()(unsigned char __x) const { return __x; }
}; };
@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION template <>
struct hash<short> { struct hash<short> {
size_t operator()(short __x) const { return __x; } size_t operator()(short __x) const { return __x; }
}; };
@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION template <>
struct hash<unsigned short> { struct hash<unsigned short> {
size_t operator()(unsigned short __x) const { return __x; } size_t operator()(unsigned short __x) const { return __x; }
}; };
@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION template <>
struct hash<int> { struct hash<int> {
size_t operator()(int __x) const { return __x; } size_t operator()(int __x) const { return __x; }
}; };
@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION template <>
struct hash<unsigned int> { struct hash<unsigned int> {
size_t operator()(unsigned int __x) const { return __x; } size_t operator()(unsigned int __x) const { return __x; }
}; };
@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION template <>
struct hash<long> { struct hash<long> {
size_t operator()(long __x) const { return __x; } size_t operator()(long __x) const { return __x; }
}; };
@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION template <>
struct hash<unsigned long> { struct hash<unsigned long> {
size_t operator()(unsigned long __x) const { return __x; } size_t operator()(unsigned long __x) const { return __x; }
}; };
// use long long or __int64 // use long long or __int64
#if @KWSYS_USE_LONG_LONG@ #if @KWSYS_USE_LONG_LONG@
@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION template <>
struct hash<long long> { struct hash<long long> {
size_t operator()(long long __x) const { return __x; } size_t operator()(long long __x) const { return __x; }
}; };
@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION template <>
struct hash<unsigned long long> { struct hash<unsigned long long> {
size_t operator()(unsigned long long __x) const { return __x; } size_t operator()(unsigned long long __x) const { return __x; }
}; };
#elif @KWSYS_USE___INT64@ #elif @KWSYS_USE___INT64@
@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION template <>
struct hash<__int64> { struct hash<__int64> {
size_t operator()(__int64 __x) const { return __x; } size_t operator()(__int64 __x) const { return __x; }
}; };
@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION template <>
struct hash<unsigned __int64> { struct hash<unsigned __int64> {
size_t operator()(unsigned __int64 __x) const { return __x; } size_t operator()(unsigned __int64 __x) const { return __x; }
}; };

View File

@ -39,7 +39,7 @@
#include <@KWSYS_NAMESPACE@/hashtable.hxx> #include <@KWSYS_NAMESPACE@/hashtable.hxx>
#include <@KWSYS_NAMESPACE@/hash_fun.hxx> #include <@KWSYS_NAMESPACE@/hash_fun.hxx>
#include <@KWSYS_NAMESPACE@/stl/functional> // equal_to #include <functional> // equal_to
#if defined(_MSC_VER) #if defined(_MSC_VER)
# pragma warning (push) # pragma warning (push)
@ -58,9 +58,9 @@ namespace @KWSYS_NAMESPACE@
// select1st is an extension: it is not part of the standard. // select1st is an extension: it is not part of the standard.
template <class T1, class T2> template <class T1, class T2>
struct hash_select1st: struct hash_select1st:
public @KWSYS_NAMESPACE@_stl::unary_function<@KWSYS_NAMESPACE@_stl::pair<T1, T2>, T1> public std::unary_function<std::pair<T1, T2>, T1>
{ {
const T1& operator()(const @KWSYS_NAMESPACE@_stl::pair<T1, T2>& __x) const const T1& operator()(const std::pair<T1, T2>& __x) const
{ return __x.first; } { return __x.first; }
}; };
@ -68,8 +68,8 @@ struct hash_select1st:
template <class _Key, class _Tp, template <class _Key, class _Tp,
class _HashFcn = hash<_Key>, class _HashFcn = hash<_Key>,
class _EqualKey = @KWSYS_NAMESPACE@_stl::equal_to<_Key>, class _EqualKey = std::equal_to<_Key>,
class _Alloc = @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(char) > class _Alloc = std::allocator<char> >
class hash_map; class hash_map;
template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc> template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
@ -81,7 +81,7 @@ template <class _Key, class _Tp, class _HashFcn, class _EqualKey,
class hash_map class hash_map
{ {
private: private:
typedef hashtable<@KWSYS_NAMESPACE@_stl::pair<const _Key,_Tp>,_Key,_HashFcn, typedef hashtable<std::pair<const _Key,_Tp>,_Key,_HashFcn,
hash_select1st<const _Key,_Tp>,_EqualKey,_Alloc> _Ht; hash_select1st<const _Key,_Tp>,_EqualKey,_Alloc> _Ht;
_Ht _M_ht; _Ht _M_ht;
@ -119,7 +119,6 @@ public:
const allocator_type& __a = allocator_type()) const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a) {} : _M_ht(__n, __hf, __eql, __a) {}
#if @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES
template <class _InputIterator> template <class _InputIterator>
hash_map(_InputIterator __f, _InputIterator __l) hash_map(_InputIterator __f, _InputIterator __l)
: _M_ht(100, hasher(), key_equal(), allocator_type()) : _M_ht(100, hasher(), key_equal(), allocator_type())
@ -140,47 +139,13 @@ public:
: _M_ht(__n, __hf, __eql, __a) : _M_ht(__n, __hf, __eql, __a)
{ _M_ht.insert_unique(__f, __l); } { _M_ht.insert_unique(__f, __l); }
#else
hash_map(const value_type* __f, const value_type* __l)
: _M_ht(100, hasher(), key_equal(), allocator_type())
{ _M_ht.insert_unique(__f, __l); }
hash_map(const value_type* __f, const value_type* __l, size_type __n)
: _M_ht(__n, hasher(), key_equal(), allocator_type())
{ _M_ht.insert_unique(__f, __l); }
hash_map(const value_type* __f, const value_type* __l, size_type __n,
const hasher& __hf)
: _M_ht(__n, __hf, key_equal(), allocator_type())
{ _M_ht.insert_unique(__f, __l); }
hash_map(const value_type* __f, const value_type* __l, size_type __n,
const hasher& __hf, const key_equal& __eql,
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a)
{ _M_ht.insert_unique(__f, __l); }
hash_map(const_iterator __f, const_iterator __l)
: _M_ht(100, hasher(), key_equal(), allocator_type())
{ _M_ht.insert_unique(__f, __l); }
hash_map(const_iterator __f, const_iterator __l, size_type __n)
: _M_ht(__n, hasher(), key_equal(), allocator_type())
{ _M_ht.insert_unique(__f, __l); }
hash_map(const_iterator __f, const_iterator __l, size_type __n,
const hasher& __hf)
: _M_ht(__n, __hf, key_equal(), allocator_type())
{ _M_ht.insert_unique(__f, __l); }
hash_map(const_iterator __f, const_iterator __l, size_type __n,
const hasher& __hf, const key_equal& __eql,
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a)
{ _M_ht.insert_unique(__f, __l); }
#endif
public: public:
size_type size() const { return _M_ht.size(); } size_type size() const { return _M_ht.size(); }
size_type max_size() const { return _M_ht.max_size(); } size_type max_size() const { return _M_ht.max_size(); }
bool empty() const { return _M_ht.empty(); } bool empty() const { return _M_ht.empty(); }
void swap(hash_map& __hs) { _M_ht.swap(__hs._M_ht); } void swap(hash_map& __hs) { _M_ht.swap(__hs._M_ht); }
friend bool operator==@KWSYS_NAMESPACE@_CXX_NULL_TEMPLATE_ARGS(const hash_map&, friend bool operator==<>(const hash_map&,
const hash_map&); const hash_map&);
iterator begin() { return _M_ht.begin(); } iterator begin() { return _M_ht.begin(); }
@ -189,20 +154,12 @@ public:
const_iterator end() const { return _M_ht.end(); } const_iterator end() const { return _M_ht.end(); }
public: public:
@KWSYS_NAMESPACE@_stl::pair<iterator,bool> insert(const value_type& __obj) std::pair<iterator,bool> insert(const value_type& __obj)
{ return _M_ht.insert_unique(__obj); } { return _M_ht.insert_unique(__obj); }
#if @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES
template <class _InputIterator> template <class _InputIterator>
void insert(_InputIterator __f, _InputIterator __l) void insert(_InputIterator __f, _InputIterator __l)
{ _M_ht.insert_unique(__f,__l); } { _M_ht.insert_unique(__f,__l); }
#else std::pair<iterator,bool> insert_noresize(const value_type& __obj)
void insert(const value_type* __f, const value_type* __l) {
_M_ht.insert_unique(__f,__l);
}
void insert(const_iterator __f, const_iterator __l)
{ _M_ht.insert_unique(__f, __l); }
#endif
@KWSYS_NAMESPACE@_stl::pair<iterator,bool> insert_noresize(const value_type& __obj)
{ return _M_ht.insert_unique_noresize(__obj); } { return _M_ht.insert_unique_noresize(__obj); }
iterator find(const key_type& __key) { return _M_ht.find(__key); } iterator find(const key_type& __key) { return _M_ht.find(__key); }
@ -215,9 +172,9 @@ public:
size_type count(const key_type& __key) const { return _M_ht.count(__key); } size_type count(const key_type& __key) const { return _M_ht.count(__key); }
@KWSYS_NAMESPACE@_stl::pair<iterator, iterator> equal_range(const key_type& __key) std::pair<iterator, iterator> equal_range(const key_type& __key)
{ return _M_ht.equal_range(__key); } { return _M_ht.equal_range(__key); }
@KWSYS_NAMESPACE@_stl::pair<const_iterator, const_iterator> std::pair<const_iterator, const_iterator>
equal_range(const key_type& __key) const equal_range(const key_type& __key) const
{ return _M_ht.equal_range(__key); } { return _M_ht.equal_range(__key); }
@ -260,8 +217,8 @@ swap(hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1,
template <class _Key, class _Tp, template <class _Key, class _Tp,
class _HashFcn = hash<_Key>, class _HashFcn = hash<_Key>,
class _EqualKey = @KWSYS_NAMESPACE@_stl::equal_to<_Key>, class _EqualKey = std::equal_to<_Key>,
class _Alloc = @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(char) > class _Alloc = std::allocator<char> >
class hash_multimap; class hash_multimap;
template <class _Key, class _Tp, class _HF, class _EqKey, class _Alloc> template <class _Key, class _Tp, class _HF, class _EqKey, class _Alloc>
@ -274,7 +231,7 @@ template <class _Key, class _Tp, class _HashFcn, class _EqualKey,
class hash_multimap class hash_multimap
{ {
private: private:
typedef hashtable<@KWSYS_NAMESPACE@_stl::pair<const _Key, _Tp>, _Key, _HashFcn, typedef hashtable<std::pair<const _Key, _Tp>, _Key, _HashFcn,
hash_select1st<const _Key, _Tp>, _EqualKey, _Alloc> hash_select1st<const _Key, _Tp>, _EqualKey, _Alloc>
_Ht; _Ht;
_Ht _M_ht; _Ht _M_ht;
@ -313,7 +270,6 @@ public:
const allocator_type& __a = allocator_type()) const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a) {} : _M_ht(__n, __hf, __eql, __a) {}
#if @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES
template <class _InputIterator> template <class _InputIterator>
hash_multimap(_InputIterator __f, _InputIterator __l) hash_multimap(_InputIterator __f, _InputIterator __l)
: _M_ht(100, hasher(), key_equal(), allocator_type()) : _M_ht(100, hasher(), key_equal(), allocator_type())
@ -334,47 +290,13 @@ public:
: _M_ht(__n, __hf, __eql, __a) : _M_ht(__n, __hf, __eql, __a)
{ _M_ht.insert_equal(__f, __l); } { _M_ht.insert_equal(__f, __l); }
#else
hash_multimap(const value_type* __f, const value_type* __l)
: _M_ht(100, hasher(), key_equal(), allocator_type())
{ _M_ht.insert_equal(__f, __l); }
hash_multimap(const value_type* __f, const value_type* __l, size_type __n)
: _M_ht(__n, hasher(), key_equal(), allocator_type())
{ _M_ht.insert_equal(__f, __l); }
hash_multimap(const value_type* __f, const value_type* __l, size_type __n,
const hasher& __hf)
: _M_ht(__n, __hf, key_equal(), allocator_type())
{ _M_ht.insert_equal(__f, __l); }
hash_multimap(const value_type* __f, const value_type* __l, size_type __n,
const hasher& __hf, const key_equal& __eql,
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a)
{ _M_ht.insert_equal(__f, __l); }
hash_multimap(const_iterator __f, const_iterator __l)
: _M_ht(100, hasher(), key_equal(), allocator_type())
{ _M_ht.insert_equal(__f, __l); }
hash_multimap(const_iterator __f, const_iterator __l, size_type __n)
: _M_ht(__n, hasher(), key_equal(), allocator_type())
{ _M_ht.insert_equal(__f, __l); }
hash_multimap(const_iterator __f, const_iterator __l, size_type __n,
const hasher& __hf)
: _M_ht(__n, __hf, key_equal(), allocator_type())
{ _M_ht.insert_equal(__f, __l); }
hash_multimap(const_iterator __f, const_iterator __l, size_type __n,
const hasher& __hf, const key_equal& __eql,
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a)
{ _M_ht.insert_equal(__f, __l); }
#endif
public: public:
size_type size() const { return _M_ht.size(); } size_type size() const { return _M_ht.size(); }
size_type max_size() const { return _M_ht.max_size(); } size_type max_size() const { return _M_ht.max_size(); }
bool empty() const { return _M_ht.empty(); } bool empty() const { return _M_ht.empty(); }
void swap(hash_multimap& __hs) { _M_ht.swap(__hs._M_ht); } void swap(hash_multimap& __hs) { _M_ht.swap(__hs._M_ht); }
friend bool operator==@KWSYS_NAMESPACE@_CXX_NULL_TEMPLATE_ARGS(const hash_multimap&, friend bool operator==<>(const hash_multimap&,
const hash_multimap&); const hash_multimap&);
iterator begin() { return _M_ht.begin(); } iterator begin() { return _M_ht.begin(); }
@ -385,17 +307,9 @@ public:
public: public:
iterator insert(const value_type& __obj) iterator insert(const value_type& __obj)
{ return _M_ht.insert_equal(__obj); } { return _M_ht.insert_equal(__obj); }
#if @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES
template <class _InputIterator> template <class _InputIterator>
void insert(_InputIterator __f, _InputIterator __l) void insert(_InputIterator __f, _InputIterator __l)
{ _M_ht.insert_equal(__f,__l); } { _M_ht.insert_equal(__f,__l); }
#else
void insert(const value_type* __f, const value_type* __l) {
_M_ht.insert_equal(__f,__l);
}
void insert(const_iterator __f, const_iterator __l)
{ _M_ht.insert_equal(__f, __l); }
#endif
iterator insert_noresize(const value_type& __obj) iterator insert_noresize(const value_type& __obj)
{ return _M_ht.insert_equal_noresize(__obj); } { return _M_ht.insert_equal_noresize(__obj); }
@ -405,9 +319,9 @@ public:
size_type count(const key_type& __key) const { return _M_ht.count(__key); } size_type count(const key_type& __key) const { return _M_ht.count(__key); }
@KWSYS_NAMESPACE@_stl::pair<iterator, iterator> equal_range(const key_type& __key) std::pair<iterator, iterator> equal_range(const key_type& __key)
{ return _M_ht.equal_range(__key); } { return _M_ht.equal_range(__key); }
@KWSYS_NAMESPACE@_stl::pair<const_iterator, const_iterator> std::pair<const_iterator, const_iterator>
equal_range(const key_type& __key) const equal_range(const key_type& __key) const
{ return _M_ht.equal_range(__key); } { return _M_ht.equal_range(__key); }

View File

@ -39,7 +39,7 @@
#include <@KWSYS_NAMESPACE@/hashtable.hxx> #include <@KWSYS_NAMESPACE@/hashtable.hxx>
#include <@KWSYS_NAMESPACE@/hash_fun.hxx> #include <@KWSYS_NAMESPACE@/hash_fun.hxx>
#include <@KWSYS_NAMESPACE@/stl/functional> // equal_to #include <functional> // equal_to
#if defined(_MSC_VER) #if defined(_MSC_VER)
# pragma warning (push) # pragma warning (push)
@ -57,7 +57,7 @@ namespace @KWSYS_NAMESPACE@
// identity is an extension: it is not part of the standard. // identity is an extension: it is not part of the standard.
template <class _Tp> template <class _Tp>
struct _Identity : public @KWSYS_NAMESPACE@_stl::unary_function<_Tp,_Tp> struct _Identity : public std::unary_function<_Tp,_Tp>
{ {
const _Tp& operator()(const _Tp& __x) const { return __x; } const _Tp& operator()(const _Tp& __x) const { return __x; }
}; };
@ -66,8 +66,8 @@ struct _Identity : public @KWSYS_NAMESPACE@_stl::unary_function<_Tp,_Tp>
template <class _Value, template <class _Value,
class _HashFcn = hash<_Value>, class _HashFcn = hash<_Value>,
class _EqualKey = @KWSYS_NAMESPACE@_stl::equal_to<_Value>, class _EqualKey = std::equal_to<_Value>,
class _Alloc = @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(char) > class _Alloc = std::allocator<char> >
class hash_set; class hash_set;
template <class _Value, class _HashFcn, class _EqualKey, class _Alloc> template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
@ -116,7 +116,6 @@ public:
const allocator_type& __a = allocator_type()) const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a) {} : _M_ht(__n, __hf, __eql, __a) {}
#if @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES
template <class _InputIterator> template <class _InputIterator>
hash_set(_InputIterator __f, _InputIterator __l) hash_set(_InputIterator __f, _InputIterator __l)
: _M_ht(100, hasher(), key_equal(), allocator_type()) : _M_ht(100, hasher(), key_equal(), allocator_type())
@ -136,40 +135,6 @@ public:
const allocator_type& __a = allocator_type()) const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a) : _M_ht(__n, __hf, __eql, __a)
{ _M_ht.insert_unique(__f, __l); } { _M_ht.insert_unique(__f, __l); }
#else
hash_set(const value_type* __f, const value_type* __l)
: _M_ht(100, hasher(), key_equal(), allocator_type())
{ _M_ht.insert_unique(__f, __l); }
hash_set(const value_type* __f, const value_type* __l, size_type __n)
: _M_ht(__n, hasher(), key_equal(), allocator_type())
{ _M_ht.insert_unique(__f, __l); }
hash_set(const value_type* __f, const value_type* __l, size_type __n,
const hasher& __hf)
: _M_ht(__n, __hf, key_equal(), allocator_type())
{ _M_ht.insert_unique(__f, __l); }
hash_set(const value_type* __f, const value_type* __l, size_type __n,
const hasher& __hf, const key_equal& __eql,
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a)
{ _M_ht.insert_unique(__f, __l); }
hash_set(const_iterator __f, const_iterator __l)
: _M_ht(100, hasher(), key_equal(), allocator_type())
{ _M_ht.insert_unique(__f, __l); }
hash_set(const_iterator __f, const_iterator __l, size_type __n)
: _M_ht(__n, hasher(), key_equal(), allocator_type())
{ _M_ht.insert_unique(__f, __l); }
hash_set(const_iterator __f, const_iterator __l, size_type __n,
const hasher& __hf)
: _M_ht(__n, __hf, key_equal(), allocator_type())
{ _M_ht.insert_unique(__f, __l); }
hash_set(const_iterator __f, const_iterator __l, size_type __n,
const hasher& __hf, const key_equal& __eql,
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a)
{ _M_ht.insert_unique(__f, __l); }
#endif
public: public:
size_type size() const { return _M_ht.size(); } size_type size() const { return _M_ht.size(); }
@ -177,43 +142,35 @@ public:
bool empty() const { return _M_ht.empty(); } bool empty() const { return _M_ht.empty(); }
void swap(hash_set& __hs) { _M_ht.swap(__hs._M_ht); } void swap(hash_set& __hs) { _M_ht.swap(__hs._M_ht); }
friend bool operator==@KWSYS_NAMESPACE@_CXX_NULL_TEMPLATE_ARGS(const hash_set&, friend bool operator==<>(const hash_set&,
const hash_set&); const hash_set&);
iterator begin() const { return _M_ht.begin(); } iterator begin() const { return _M_ht.begin(); }
iterator end() const { return _M_ht.end(); } iterator end() const { return _M_ht.end(); }
public: public:
@KWSYS_NAMESPACE@_stl::pair<iterator, bool> insert(const value_type& __obj) std::pair<iterator, bool> insert(const value_type& __obj)
{ {
typedef typename _Ht::iterator _Ht_iterator; typedef typename _Ht::iterator _Ht_iterator;
@KWSYS_NAMESPACE@_stl::pair<_Ht_iterator, bool> __p = _M_ht.insert_unique(__obj); std::pair<_Ht_iterator, bool> __p = _M_ht.insert_unique(__obj);
return @KWSYS_NAMESPACE@_stl::pair<iterator,bool>(__p.first, __p.second); return std::pair<iterator,bool>(__p.first, __p.second);
} }
#if @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES
template <class _InputIterator> template <class _InputIterator>
void insert(_InputIterator __f, _InputIterator __l) void insert(_InputIterator __f, _InputIterator __l)
{ _M_ht.insert_unique(__f,__l); } { _M_ht.insert_unique(__f,__l); }
#else std::pair<iterator, bool> insert_noresize(const value_type& __obj)
void insert(const value_type* __f, const value_type* __l) {
_M_ht.insert_unique(__f,__l);
}
void insert(const_iterator __f, const_iterator __l)
{_M_ht.insert_unique(__f, __l); }
#endif
@KWSYS_NAMESPACE@_stl::pair<iterator, bool> insert_noresize(const value_type& __obj)
{ {
typedef typename _Ht::iterator _Ht_iterator; typedef typename _Ht::iterator _Ht_iterator;
@KWSYS_NAMESPACE@_stl::pair<_Ht_iterator, bool> __p = std::pair<_Ht_iterator, bool> __p =
_M_ht.insert_unique_noresize(__obj); _M_ht.insert_unique_noresize(__obj);
return @KWSYS_NAMESPACE@_stl::pair<iterator, bool>(__p.first, __p.second); return std::pair<iterator, bool>(__p.first, __p.second);
} }
iterator find(const key_type& __key) const { return _M_ht.find(__key); } iterator find(const key_type& __key) const { return _M_ht.find(__key); }
size_type count(const key_type& __key) const { return _M_ht.count(__key); } size_type count(const key_type& __key) const { return _M_ht.count(__key); }
@KWSYS_NAMESPACE@_stl::pair<iterator, iterator> equal_range(const key_type& __key) const std::pair<iterator, iterator> equal_range(const key_type& __key) const
{ return _M_ht.equal_range(__key); } { return _M_ht.equal_range(__key); }
size_type erase(const key_type& __key) {return _M_ht.erase(__key); } size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
@ -254,8 +211,8 @@ swap(hash_set<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1,
template <class _Value, template <class _Value,
class _HashFcn = hash<_Value>, class _HashFcn = hash<_Value>,
class _EqualKey = @KWSYS_NAMESPACE@_stl::equal_to<_Value>, class _EqualKey = std::equal_to<_Value>,
class _Alloc = @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(char) > class _Alloc = std::allocator<char> >
class hash_multiset; class hash_multiset;
template <class _Val, class _HashFcn, class _EqualKey, class _Alloc> template <class _Val, class _HashFcn, class _EqualKey, class _Alloc>
@ -305,7 +262,6 @@ public:
const allocator_type& __a = allocator_type()) const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a) {} : _M_ht(__n, __hf, __eql, __a) {}
#if @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES
template <class _InputIterator> template <class _InputIterator>
hash_multiset(_InputIterator __f, _InputIterator __l) hash_multiset(_InputIterator __f, _InputIterator __l)
: _M_ht(100, hasher(), key_equal(), allocator_type()) : _M_ht(100, hasher(), key_equal(), allocator_type())
@ -325,40 +281,6 @@ public:
const allocator_type& __a = allocator_type()) const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a) : _M_ht(__n, __hf, __eql, __a)
{ _M_ht.insert_equal(__f, __l); } { _M_ht.insert_equal(__f, __l); }
#else
hash_multiset(const value_type* __f, const value_type* __l)
: _M_ht(100, hasher(), key_equal(), allocator_type())
{ _M_ht.insert_equal(__f, __l); }
hash_multiset(const value_type* __f, const value_type* __l, size_type __n)
: _M_ht(__n, hasher(), key_equal(), allocator_type())
{ _M_ht.insert_equal(__f, __l); }
hash_multiset(const value_type* __f, const value_type* __l, size_type __n,
const hasher& __hf)
: _M_ht(__n, __hf, key_equal(), allocator_type())
{ _M_ht.insert_equal(__f, __l); }
hash_multiset(const value_type* __f, const value_type* __l, size_type __n,
const hasher& __hf, const key_equal& __eql,
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a)
{ _M_ht.insert_equal(__f, __l); }
hash_multiset(const_iterator __f, const_iterator __l)
: _M_ht(100, hasher(), key_equal(), allocator_type())
{ _M_ht.insert_equal(__f, __l); }
hash_multiset(const_iterator __f, const_iterator __l, size_type __n)
: _M_ht(__n, hasher(), key_equal(), allocator_type())
{ _M_ht.insert_equal(__f, __l); }
hash_multiset(const_iterator __f, const_iterator __l, size_type __n,
const hasher& __hf)
: _M_ht(__n, __hf, key_equal(), allocator_type())
{ _M_ht.insert_equal(__f, __l); }
hash_multiset(const_iterator __f, const_iterator __l, size_type __n,
const hasher& __hf, const key_equal& __eql,
const allocator_type& __a = allocator_type())
: _M_ht(__n, __hf, __eql, __a)
{ _M_ht.insert_equal(__f, __l); }
#endif
public: public:
size_type size() const { return _M_ht.size(); } size_type size() const { return _M_ht.size(); }
@ -366,7 +288,7 @@ public:
bool empty() const { return _M_ht.empty(); } bool empty() const { return _M_ht.empty(); }
void swap(hash_multiset& hs) { _M_ht.swap(hs._M_ht); } void swap(hash_multiset& hs) { _M_ht.swap(hs._M_ht); }
friend bool operator==@KWSYS_NAMESPACE@_CXX_NULL_TEMPLATE_ARGS(const hash_multiset&, friend bool operator==<>(const hash_multiset&,
const hash_multiset&); const hash_multiset&);
iterator begin() const { return _M_ht.begin(); } iterator begin() const { return _M_ht.begin(); }
@ -375,17 +297,9 @@ public:
public: public:
iterator insert(const value_type& __obj) iterator insert(const value_type& __obj)
{ return _M_ht.insert_equal(__obj); } { return _M_ht.insert_equal(__obj); }
#if @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES
template <class _InputIterator> template <class _InputIterator>
void insert(_InputIterator __f, _InputIterator __l) void insert(_InputIterator __f, _InputIterator __l)
{ _M_ht.insert_equal(__f,__l); } { _M_ht.insert_equal(__f,__l); }
#else
void insert(const value_type* __f, const value_type* __l) {
_M_ht.insert_equal(__f,__l);
}
void insert(const_iterator __f, const_iterator __l)
{ _M_ht.insert_equal(__f, __l); }
#endif
iterator insert_noresize(const value_type& __obj) iterator insert_noresize(const value_type& __obj)
{ return _M_ht.insert_equal_noresize(__obj); } { return _M_ht.insert_equal_noresize(__obj); }
@ -393,7 +307,7 @@ public:
size_type count(const key_type& __key) const { return _M_ht.count(__key); } size_type count(const key_type& __key) const { return _M_ht.count(__key); }
@KWSYS_NAMESPACE@_stl::pair<iterator, iterator> equal_range(const key_type& __key) const std::pair<iterator, iterator> equal_range(const key_type& __key) const
{ return _M_ht.equal_range(__key); } { return _M_ht.equal_range(__key); }
size_type erase(const key_type& __key) {return _M_ht.erase(__key); } size_type erase(const key_type& __key) {return _M_ht.erase(__key); }

View File

@ -44,13 +44,13 @@
#include <@KWSYS_NAMESPACE@/Configure.hxx> #include <@KWSYS_NAMESPACE@/Configure.hxx>
#include <@KWSYS_NAMESPACE@/cstddef> // size_t #include <stddef.h> // size_t
#include <@KWSYS_NAMESPACE@/stl/algorithm> // lower_bound #include <algorithm> // lower_bound
#include <@KWSYS_NAMESPACE@/stl/functional> // unary_function #include <functional> // unary_function
#include <@KWSYS_NAMESPACE@/stl/iterator> // iterator_traits #include <iterator> // iterator_traits
#include <@KWSYS_NAMESPACE@/stl/memory> // allocator #include <memory> // allocator
#include <@KWSYS_NAMESPACE@/stl/utility> // pair #include <utility> // pair
#include <@KWSYS_NAMESPACE@/stl/vector> // vector #include <vector> // vector
#if defined(_MSC_VER) #if defined(_MSC_VER)
# pragma warning (push) # pragma warning (push)
@ -73,238 +73,9 @@
# endif # endif
#endif #endif
#if @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_TEMPLATE
# define @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(T) @KWSYS_NAMESPACE@_stl::allocator< T >
#elif @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_NONTEMPLATE
# define @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(T) @KWSYS_NAMESPACE@_stl::allocator
#else
# define @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(T) @KWSYS_NAMESPACE@_stl::alloc
#endif
#if @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_OBJECTS
# define @KWSYS_NAMESPACE@_HASH_BUCKETS_INIT(__a) _M_buckets(__a)
# define @KWSYS_NAMESPACE@_HASH_BUCKETS_GET_ALLOCATOR(__b) , __b.get_allocator()
#else
# define @KWSYS_NAMESPACE@_HASH_BUCKETS_INIT(__a) _M_buckets()
# define @KWSYS_NAMESPACE@_HASH_BUCKETS_GET_ALLOCATOR(__b)
#endif
namespace @KWSYS_NAMESPACE@ namespace @KWSYS_NAMESPACE@
{ {
//----------------------------------------------------------------------------
// Define an allocator adaptor for platforms that do not provide an
// allocator with the rebind member.
#if !@KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_REBIND
// Utility functions to convert item counts.
inline size_t hash_sizeof(void*) { return sizeof(char); }
inline size_t hash_sizeof(const void*) { return sizeof(char); }
template <class TPtr> inline size_t hash_sizeof(TPtr p)
{
static_cast<void>(p);
return sizeof(*p);
}
template <class POut, class PIn, class TSize>
inline TSize hash_allocator_n(POut out, PIn in, TSize n)
{
return n*(hash_sizeof(out)/hash_sizeof(in) +
(hash_sizeof(out)%hash_sizeof(in)>0));
}
// Define an allocation method to use the native allocator with
// the proper signature. The following signatures of the allocate
// method are used on various STL implementations:
// pointer allocate(size_type, const void* hint)
// pointer allocate(size_type)
// static pointer allocate(size_type, const void* hint)
// static pointer allocate(size_type)
// Where pointer might be a real type or void*.
// This set of overloads decodes the signature for a particular STL.
// The extra three int/long arguments will favor certain signatures
// over others in the case that multiple are present to avoid
// ambiguity errors.
template <class TAlloc, class PIn, class TSize, class THint, class POut>
inline void hash_allocate(TAlloc* a, PIn (TAlloc::*allocate)(TSize, THint),
TSize n_out, const void* hint, POut& out,
int, int, int)
{
TSize n_in = hash_allocator_n(POut(), PIn(), n_out);
void* vout = (a->*allocate)(n_in, const_cast<THint>(hint));
out = static_cast<POut>(vout);
}
template <class TAlloc, class PIn, class TSize, class POut>
inline void hash_allocate(TAlloc* a, PIn (TAlloc::*allocate)(TSize),
TSize n_out, const void*, POut& out,
int, int, long)
{
TSize n_in = hash_allocator_n(POut(), PIn(), n_out);
void* vout = (a->*allocate)(n_in);
out = static_cast<POut>(vout);
}
template <class PIn, class TSize, class THint, class POut>
inline void hash_allocate(void*, PIn (*allocate)(TSize, THint),
TSize n_out, const void* hint, POut& out,
int, long, long)
{
TSize n_in = hash_allocator_n(POut(), PIn(), n_out);
void* vout = allocate(n_in, const_cast<THint>(hint));
out = static_cast<POut>(vout);
}
template <class PIn, class TSize, class POut>
inline void hash_allocate(void*, PIn (*allocate)(TSize),
TSize n_out, const void*, POut& out,
long, long, long)
{
TSize n_in = hash_allocator_n(POut(), PIn(), n_out);
void* vout = allocate(n_in);
out = static_cast<POut>(vout);
}
// Define a deallocation method to use the native allocator with
// the proper signature. The following signatures of the deallocate
// method are used on various STL implementations:
// void deallocate(pointer, size_type)
// void deallocate(pointer)
// static void deallocate(pointer, size_type)
// static void deallocate(pointer)
// Where pointer might be a real type or void*.
// This set of overloads decodes the signature for a particular STL.
// The extra three int/long arguments will favor certain signatures
// over others in the case that multiple are present to avoid
// ambiguity errors.
template <class TAlloc, class PIn, class TSize, class PInReal, class POut>
inline void hash_deallocate(TAlloc* a, void (TAlloc::*deallocate)(PIn, TSize),
PInReal, POut p, TSize n_out, int, int, int)
{
TSize n_in = hash_allocator_n(POut(), PInReal(), n_out);
void* vout = p;
(a->*deallocate)(static_cast<PIn>(vout), n_in);
}
template <class TAlloc, class PIn, class TSize, class PInReal, class POut>
inline void hash_deallocate(TAlloc* a, void (TAlloc::*deallocate)(PIn),
PInReal, POut p, TSize, int, int, long)
{
void* vout = p;
(a->*deallocate)(static_cast<PIn>(vout));
}
template <class PIn, class TSize, class PInReal, class POut>
inline void hash_deallocate(void*, void (*deallocate)(PIn, TSize),
PInReal, POut p, TSize n_out, int, long, long)
{
TSize n_in = hash_allocator_n(POut(), PInReal(), n_out);
void* vout = p;
deallocate(static_cast<PIn>(vout), n_in);
}
template <class PIn, class TSize, class PInReal, class POut>
inline void hash_deallocate(void*, void (*deallocate)(PIn),
PInReal, POut p, TSize, long, long, long)
{
void* vout = p;
deallocate(static_cast<PIn>(vout));
}
// Use the same four overloads as hash_allocate to decode the type
// really used for allocation. This is passed as PInReal to the
// deallocate functions so that hash_allocator_n has the proper size.
template <class TAlloc, class PIn, class TSize, class THint>
inline PIn hash_allocate_type(PIn (TAlloc::*)(TSize, THint),
int, int, int) { return 0; }
template <class TAlloc, class PIn, class TSize>
inline PIn hash_allocate_type(PIn (TAlloc::*)(TSize),
int, int, long) { return 0; }
template <class PIn, class TSize, class THint>
inline PIn hash_allocate_type(PIn (*)(TSize, THint),
int, long, long) { return 0; }
template <class PIn, class TSize>
inline PIn hash_allocate_type(PIn (*)(TSize),
long, long, long) { return 0; }
// Define the comparison operators in terms of a base type to avoid
// needing templated versions.
class hash_allocator_base {};
inline bool operator==(const hash_allocator_base&,
const hash_allocator_base&) throw() { return true; }
inline bool operator!=(const hash_allocator_base&,
const hash_allocator_base&) throw() { return false; }
// Define the allocator template.
template <class T, class Alloc>
class hash_allocator: public hash_allocator_base
{
private:
// Store the real allocator privately.
typedef Alloc alloc_type;
alloc_type alloc_;
public:
// Standard allocator interface.
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef T* pointer;
typedef const T* const_pointer;
typedef T& reference;
typedef const T& const_reference;
typedef T value_type;
hash_allocator() throw(): alloc_() {}
hash_allocator(const hash_allocator_base&) throw() : alloc_() {}
hash_allocator(const hash_allocator& a) throw() : alloc_(a.alloc_) {}
hash_allocator(const alloc_type& a) throw() : alloc_(a) {}
~hash_allocator() throw() {}
# if @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES
template <class U>
struct rebind { typedef hash_allocator<U, alloc_type> other; };
# endif
pointer address(reference x) const { return &x; }
const_pointer address(const_reference x) const { return &x; }
typedef void* void_pointer;
typedef const void* const_void_pointer;
pointer allocate(size_type n=1, const_void_pointer hint = 0)
{
if(n)
{
pointer p;
hash_allocate(&alloc_, &alloc_type::allocate, n, hint, p, 1, 1, 1);
return p;
}
else
{
return 0;
}
}
void deallocate(pointer p, size_type n=1)
{
if(n)
{
hash_deallocate(&alloc_, &alloc_type::deallocate,
hash_allocate_type(&alloc_type::allocate, 1, 1, 1),
p, n, 1, 1, 1);
}
}
#if @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
size_type max_size(size_type s) const throw()
{
return alloc_.max_size(s);
}
#else
size_type max_size() const throw()
{
size_type n = alloc_.max_size() / sizeof(value_type);
return n>0? n:1;
}
#endif
void construct(pointer p, const value_type& val) { new (p) value_type(val); }
void destroy(pointer p) { (void)p; p->~value_type(); }
};
#endif
template <class _Val> template <class _Val>
struct _Hashtable_node struct _Hashtable_node
{ {
@ -317,7 +88,7 @@ private:
template <class _Val, class _Key, class _HashFcn, template <class _Val, class _Key, class _HashFcn,
class _ExtractKey, class _EqualKey, class _ExtractKey, class _EqualKey,
class _Alloc = @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(char) > class _Alloc = std::allocator<char> >
class hashtable; class hashtable;
template <class _Val, class _Key, class _HashFcn, template <class _Val, class _Key, class _HashFcn,
@ -341,7 +112,7 @@ struct _Hashtable_iterator {
const_iterator; const_iterator;
typedef _Hashtable_node<_Val> _Node; typedef _Hashtable_node<_Val> _Node;
typedef @KWSYS_NAMESPACE@_stl::forward_iterator_tag iterator_category; typedef std::forward_iterator_tag iterator_category;
typedef _Val value_type; typedef _Val value_type;
typedef ptrdiff_t difference_type; typedef ptrdiff_t difference_type;
typedef size_t size_type; typedef size_t size_type;
@ -378,7 +149,7 @@ struct _Hashtable_const_iterator {
const_iterator; const_iterator;
typedef _Hashtable_node<_Val> _Node; typedef _Hashtable_node<_Val> _Node;
typedef @KWSYS_NAMESPACE@_stl::forward_iterator_tag iterator_category; typedef std::forward_iterator_tag iterator_category;
typedef _Val value_type; typedef _Val value_type;
typedef ptrdiff_t difference_type; typedef ptrdiff_t difference_type;
typedef size_t size_type; typedef size_t size_type;
@ -427,7 +198,7 @@ static inline size_t _stl_next_prime(size_t __n)
{ {
const unsigned long* __first = get_stl_prime_list(); const unsigned long* __first = get_stl_prime_list();
const unsigned long* __last = get_stl_prime_list() + (int)_stl_num_primes; const unsigned long* __last = get_stl_prime_list() + (int)_stl_num_primes;
const unsigned long* pos = @KWSYS_NAMESPACE@_stl::lower_bound(__first, __last, __n); const unsigned long* pos = std::lower_bound(__first, __last, __n);
return pos == __last ? *(__last - 1) : *pos; return pos == __last ? *(__last - 1) : *pos;
} }
@ -470,27 +241,13 @@ public:
private: private:
typedef _Hashtable_node<_Val> _Node; typedef _Hashtable_node<_Val> _Node;
#if @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_REBIND
public: public:
typedef typename _Alloc::template rebind<_Val>::other allocator_type; typedef typename _Alloc::template rebind<_Val>::other allocator_type;
allocator_type get_allocator() const { return _M_node_allocator; } allocator_type get_allocator() const { return _M_node_allocator; }
private: private:
typedef typename _Alloc::template rebind<_Node>::other _M_node_allocator_type; typedef typename _Alloc::template rebind<_Node>::other _M_node_allocator_type;
typedef typename _Alloc::template rebind<_Node*>::other _M_node_ptr_allocator_type; typedef typename _Alloc::template rebind<_Node*>::other _M_node_ptr_allocator_type;
typedef @KWSYS_NAMESPACE@_stl::vector<_Node*,_M_node_ptr_allocator_type> _M_buckets_type; typedef std::vector<_Node*,_M_node_ptr_allocator_type> _M_buckets_type;
#else
public:
typedef hash_allocator<_Val, _Alloc> allocator_type;
allocator_type get_allocator() const { return allocator_type(); }
private:
typedef hash_allocator<_Node, _Alloc> _M_node_allocator_type;
# if @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_OBJECTS
typedef hash_allocator<_Node*, _Alloc> _M_node_ptr_allocator_type;
# else
typedef _Alloc _M_node_ptr_allocator_type;
# endif
typedef @KWSYS_NAMESPACE@_stl::vector<_Node*,_M_node_ptr_allocator_type> _M_buckets_type;
#endif
private: private:
_M_node_allocator_type _M_node_allocator; _M_node_allocator_type _M_node_allocator;
@ -525,7 +282,7 @@ public:
_M_hash(__hf), _M_hash(__hf),
_M_equals(__eql), _M_equals(__eql),
_M_get_key(__ext), _M_get_key(__ext),
@KWSYS_NAMESPACE@_HASH_BUCKETS_INIT(__a), _M_buckets(__a),
_M_num_elements(0) _M_num_elements(0)
{ {
_M_initialize_buckets(__n); _M_initialize_buckets(__n);
@ -539,7 +296,7 @@ public:
_M_hash(__hf), _M_hash(__hf),
_M_equals(__eql), _M_equals(__eql),
_M_get_key(_ExtractKey()), _M_get_key(_ExtractKey()),
@KWSYS_NAMESPACE@_HASH_BUCKETS_INIT(__a), _M_buckets(__a),
_M_num_elements(0) _M_num_elements(0)
{ {
_M_initialize_buckets(__n); _M_initialize_buckets(__n);
@ -550,7 +307,7 @@ public:
_M_hash(__ht._M_hash), _M_hash(__ht._M_hash),
_M_equals(__ht._M_equals), _M_equals(__ht._M_equals),
_M_get_key(__ht._M_get_key), _M_get_key(__ht._M_get_key),
@KWSYS_NAMESPACE@_HASH_BUCKETS_INIT(__ht.get_allocator()), _M_buckets(__ht.get_allocator()),
_M_num_elements(0) _M_num_elements(0)
{ {
_M_copy_from(__ht); _M_copy_from(__ht);
@ -576,11 +333,11 @@ public:
void swap(hashtable& __ht) void swap(hashtable& __ht)
{ {
@KWSYS_NAMESPACE@_stl::swap(_M_hash, __ht._M_hash); std::swap(_M_hash, __ht._M_hash);
@KWSYS_NAMESPACE@_stl::swap(_M_equals, __ht._M_equals); std::swap(_M_equals, __ht._M_equals);
@KWSYS_NAMESPACE@_stl::swap(_M_get_key, __ht._M_get_key); std::swap(_M_get_key, __ht._M_get_key);
_M_buckets.swap(__ht._M_buckets); _M_buckets.swap(__ht._M_buckets);
@KWSYS_NAMESPACE@_stl::swap(_M_num_elements, __ht._M_num_elements); std::swap(_M_num_elements, __ht._M_num_elements);
} }
iterator begin() iterator begin()
@ -603,7 +360,7 @@ public:
const_iterator end() const { return const_iterator(0, this); } const_iterator end() const { return const_iterator(0, this); }
friend bool operator==@KWSYS_NAMESPACE@_CXX_NULL_TEMPLATE_ARGS(const hashtable&, friend bool operator==<>(const hashtable&,
const hashtable&); const hashtable&);
public: public:
@ -621,7 +378,7 @@ public:
return __result; return __result;
} }
@KWSYS_NAMESPACE@_stl::pair<iterator, bool> insert_unique(const value_type& __obj) std::pair<iterator, bool> insert_unique(const value_type& __obj)
{ {
resize(_M_num_elements + 1); resize(_M_num_elements + 1);
return insert_unique_noresize(__obj); return insert_unique_noresize(__obj);
@ -633,38 +390,26 @@ public:
return insert_equal_noresize(__obj); return insert_equal_noresize(__obj);
} }
@KWSYS_NAMESPACE@_stl::pair<iterator, bool> insert_unique_noresize(const value_type& __obj); std::pair<iterator, bool> insert_unique_noresize(const value_type& __obj);
iterator insert_equal_noresize(const value_type& __obj); iterator insert_equal_noresize(const value_type& __obj);
#if @KWSYS_NAMESPACE@_STL_HAS_ITERATOR_TRAITS
# define @KWSYS_NAMESPACE@_HASH_ITERATOR_CATEGORY(T,I) \
typename @KWSYS_NAMESPACE@_stl::iterator_traits< T >::iterator_category()
#elif @KWSYS_NAMESPACE@_STL_HAS_ITERATOR_CATEGORY
# define @KWSYS_NAMESPACE@_HASH_ITERATOR_CATEGORY(T,I) \
@KWSYS_NAMESPACE@_stl::iterator_category( I )
#elif @KWSYS_NAMESPACE@_STL_HAS___ITERATOR_CATEGORY
# define @KWSYS_NAMESPACE@_HASH_ITERATOR_CATEGORY(T,I) \
@KWSYS_NAMESPACE@_stl::__iterator_category( I )
#endif
#if @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES && defined(@KWSYS_NAMESPACE@_HASH_ITERATOR_CATEGORY)
template <class _InputIterator> template <class _InputIterator>
void insert_unique(_InputIterator __f, _InputIterator __l) void insert_unique(_InputIterator __f, _InputIterator __l)
{ {
insert_unique(__f, __l, insert_unique(__f, __l,
@KWSYS_NAMESPACE@_HASH_ITERATOR_CATEGORY(_InputIterator, __f)); typename std::iterator_traits<_InputIterator>::iterator_category());
} }
template <class _InputIterator> template <class _InputIterator>
void insert_equal(_InputIterator __f, _InputIterator __l) void insert_equal(_InputIterator __f, _InputIterator __l)
{ {
insert_equal(__f, __l, insert_equal(__f, __l,
@KWSYS_NAMESPACE@_HASH_ITERATOR_CATEGORY(_InputIterator, __f)); typename std::iterator_traits<_InputIterator>::iterator_category());
} }
template <class _InputIterator> template <class _InputIterator>
void insert_unique(_InputIterator __f, _InputIterator __l, void insert_unique(_InputIterator __f, _InputIterator __l,
@KWSYS_NAMESPACE@_stl::input_iterator_tag) std::input_iterator_tag)
{ {
for ( ; __f != __l; ++__f) for ( ; __f != __l; ++__f)
insert_unique(*__f); insert_unique(*__f);
@ -672,7 +417,7 @@ public:
template <class _InputIterator> template <class _InputIterator>
void insert_equal(_InputIterator __f, _InputIterator __l, void insert_equal(_InputIterator __f, _InputIterator __l,
@KWSYS_NAMESPACE@_stl::input_iterator_tag) std::input_iterator_tag)
{ {
for ( ; __f != __l; ++__f) for ( ; __f != __l; ++__f)
insert_equal(*__f); insert_equal(*__f);
@ -680,10 +425,10 @@ public:
template <class _ForwardIterator> template <class _ForwardIterator>
void insert_unique(_ForwardIterator __f, _ForwardIterator __l, void insert_unique(_ForwardIterator __f, _ForwardIterator __l,
@KWSYS_NAMESPACE@_stl::forward_iterator_tag) std::forward_iterator_tag)
{ {
size_type __n = 0; size_type __n = 0;
@KWSYS_NAMESPACE@_stl::distance(__f, __l, __n); std::distance(__f, __l, __n);
resize(_M_num_elements + __n); resize(_M_num_elements + __n);
for ( ; __n > 0; --__n, ++__f) for ( ; __n > 0; --__n, ++__f)
insert_unique_noresize(*__f); insert_unique_noresize(*__f);
@ -691,51 +436,15 @@ public:
template <class _ForwardIterator> template <class _ForwardIterator>
void insert_equal(_ForwardIterator __f, _ForwardIterator __l, void insert_equal(_ForwardIterator __f, _ForwardIterator __l,
@KWSYS_NAMESPACE@_stl::forward_iterator_tag) std::forward_iterator_tag)
{ {
size_type __n = 0; size_type __n = 0;
@KWSYS_NAMESPACE@_stl::distance(__f, __l, __n); std::distance(__f, __l, __n);
resize(_M_num_elements + __n); resize(_M_num_elements + __n);
for ( ; __n > 0; --__n, ++__f) for ( ; __n > 0; --__n, ++__f)
insert_equal_noresize(*__f); insert_equal_noresize(*__f);
} }
#else
void insert_unique(const value_type* __f, const value_type* __l)
{
size_type __n = __l - __f;
resize(_M_num_elements + __n);
for ( ; __n > 0; --__n, ++__f)
insert_unique_noresize(*__f);
}
void insert_equal(const value_type* __f, const value_type* __l)
{
size_type __n = __l - __f;
resize(_M_num_elements + __n);
for ( ; __n > 0; --__n, ++__f)
insert_equal_noresize(*__f);
}
void insert_unique(const_iterator __f, const_iterator __l)
{
size_type __n = 0;
@KWSYS_NAMESPACE@_stl::distance(__f, __l, __n);
resize(_M_num_elements + __n);
for ( ; __n > 0; --__n, ++__f)
insert_unique_noresize(*__f);
}
void insert_equal(const_iterator __f, const_iterator __l)
{
size_type __n = 0;
@KWSYS_NAMESPACE@_stl::distance(__f, __l, __n);
resize(_M_num_elements + __n);
for ( ; __n > 0; --__n, ++__f)
insert_equal_noresize(*__f);
}
#endif
reference find_or_insert(const value_type& __obj); reference find_or_insert(const value_type& __obj);
iterator find(const key_type& __key) iterator find(const key_type& __key)
@ -771,10 +480,10 @@ public:
return __result; return __result;
} }
@KWSYS_NAMESPACE@_stl::pair<iterator, iterator> std::pair<iterator, iterator>
equal_range(const key_type& __key); equal_range(const key_type& __key);
@KWSYS_NAMESPACE@_stl::pair<const_iterator, const_iterator> std::pair<const_iterator, const_iterator>
equal_range(const key_type& __key) const; equal_range(const key_type& __key) const;
size_type erase(const key_type& __key); size_type erase(const key_type& __key);
@ -936,7 +645,7 @@ inline void swap(hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht1,
} }
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
@KWSYS_NAMESPACE@_stl::pair<@KWSYS_NAMESPACE@_CXX_DECL_TYPENAME hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator, bool> std::pair<typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator, bool>
hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
::insert_unique_noresize(const value_type& __obj) ::insert_unique_noresize(const value_type& __obj)
{ {
@ -945,13 +654,13 @@ hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
for (_Node* __cur = __first; __cur; __cur = __cur->_M_next) for (_Node* __cur = __first; __cur; __cur = __cur->_M_next)
if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj))) if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj)))
return @KWSYS_NAMESPACE@_stl::pair<iterator, bool>(iterator(__cur, this), false); return std::pair<iterator, bool>(iterator(__cur, this), false);
_Node* __tmp = _M_new_node(__obj); _Node* __tmp = _M_new_node(__obj);
__tmp->_M_next = __first; __tmp->_M_next = __first;
_M_buckets[__n] = __tmp; _M_buckets[__n] = __tmp;
++_M_num_elements; ++_M_num_elements;
return @KWSYS_NAMESPACE@_stl::pair<iterator, bool>(iterator(__tmp, this), true); return std::pair<iterator, bool>(iterator(__tmp, this), true);
} }
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
@ -999,11 +708,11 @@ hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::find_or_insert(const value_type& __obj)
} }
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
@KWSYS_NAMESPACE@_stl::pair<@KWSYS_NAMESPACE@_CXX_DECL_TYPENAME hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator, std::pair<typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator,
@KWSYS_NAMESPACE@_CXX_DECL_TYPENAME hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator> typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator>
hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::equal_range(const key_type& __key) hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::equal_range(const key_type& __key)
{ {
typedef @KWSYS_NAMESPACE@_stl::pair<iterator, iterator> _Pii; typedef std::pair<iterator, iterator> _Pii;
const size_type __n = _M_bkt_num_key(__key); const size_type __n = _M_bkt_num_key(__key);
for (_Node* __first = _M_buckets[__n]; __first; __first = __first->_M_next) for (_Node* __first = _M_buckets[__n]; __first; __first = __first->_M_next)
@ -1021,12 +730,12 @@ hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::equal_range(const key_type& __key)
} }
template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
@KWSYS_NAMESPACE@_stl::pair<@KWSYS_NAMESPACE@_CXX_DECL_TYPENAME hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::const_iterator, std::pair<typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::const_iterator,
@KWSYS_NAMESPACE@_CXX_DECL_TYPENAME hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::const_iterator> typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::const_iterator>
hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
::equal_range(const key_type& __key) const ::equal_range(const key_type& __key) const
{ {
typedef @KWSYS_NAMESPACE@_stl::pair<const_iterator, const_iterator> _Pii; typedef std::pair<const_iterator, const_iterator> _Pii;
const size_type __n = _M_bkt_num_key(__key); const size_type __n = _M_bkt_num_key(__key);
for (const _Node* __first = _M_buckets[__n] ; for (const _Node* __first = _M_buckets[__n] ;
@ -1164,8 +873,8 @@ void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
const size_type __n = _M_next_size(__num_elements_hint); const size_type __n = _M_next_size(__num_elements_hint);
if (__n > __old_n) { if (__n > __old_n) {
_M_buckets_type __tmp( _M_buckets_type __tmp(
__n, (_Node*)(0) __n, (_Node*)(0),
@KWSYS_NAMESPACE@_HASH_BUCKETS_GET_ALLOCATOR(_M_buckets)); _M_buckets.get_allocator());
try { try {
for (size_type __bucket = 0; __bucket < __old_n; ++__bucket) { for (size_type __bucket = 0; __bucket < __old_n; ++__bucket) {
_Node* __first = _M_buckets[__bucket]; _Node* __first = _M_buckets[__bucket];
@ -1274,14 +983,6 @@ void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
} // namespace @KWSYS_NAMESPACE@ } // namespace @KWSYS_NAMESPACE@
// Normally the comparison operators should be found in the @KWSYS_NAMESPACE@
// namespace by argument dependent lookup. For compilers that do not
// support it we must bring them into the global namespace now.
#if !@KWSYS_NAMESPACE@_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP
using @KWSYS_NAMESPACE@::operator==;
using @KWSYS_NAMESPACE@::operator!=;
#endif
// Undo warning suppression. // Undo warning suppression.
#if defined(__clang__) && defined(__has_warning) #if defined(__clang__) && defined(__has_warning)
# if __has_warning("-Wdeprecated") # if __has_warning("-Wdeprecated")

View File

@ -9,110 +9,11 @@
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information. See the License for more information.
============================================================================*/ ============================================================================*/
// Setup for tests that use result of stl namespace test.
#if defined(KWSYS_STL_HAVE_STD)
# if KWSYS_STL_HAVE_STD
# define kwsys_stl std
# else
# define kwsys_stl
# endif
#endif
// Setup for tests that use iostreams.
#if defined(KWSYS_IOS_USE_ANSI) && defined(KWSYS_IOS_HAVE_STD)
# if defined(_MSC_VER)
# pragma warning (push,1)
# endif
# if KWSYS_IOS_USE_ANSI
# include <iostream>
# else
# include <iostream.h>
# endif
# if defined(_MSC_VER)
# pragma warning (pop)
# endif
# if KWSYS_IOS_HAVE_STD
# define kwsys_ios std
# else
# define kwsys_ios
# endif
#endif
#ifdef TEST_KWSYS_STL_HAVE_STD
#include <list>
void f(std ::list<int>*) {}
int main() { return 0; }
#endif
#ifdef TEST_KWSYS_IOS_USE_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_USE_SSTREAM
#include <sstream>
#if defined(__GNUC__) && __GNUC__ == 2 && __GNUC_MINOR__ == 96
# error "GCC 2.96 stringstream is buggy"
#endif
int main()
{
std ::ostringstream ostr;
ostr << "hello";
if(ostr.str().size() == 5)
{
return 0;
}
return -1;
}
#endif
#ifdef TEST_KWSYS_IOS_USE_STRSTREAM_H
#include <strstream.h>
int main() { return 0; }
#endif
#ifdef TEST_KWSYS_IOS_USE_STRSTREA_H
#include <strstrea.h>
int main() { return 0; }
#endif
#ifdef TEST_KWSYS_STL_STRING_HAVE_OSTREAM
# include <iostream.h>
# include <string>
void f(ostream& os, const kwsys_stl::string& s) { os << s; }
int main() { return 0; }
#endif
#ifdef TEST_KWSYS_STL_STRING_HAVE_ISTREAM
# include <iostream.h>
# include <string>
void f(istream& is, kwsys_stl::string& s) { is >> s; }
int main() { return 0; }
#endif
#ifdef TEST_KWSYS_STL_STRING_HAVE_NEQ_CHAR
# include <string>
bool f(const kwsys_stl::string& s) { return s != ""; }
int main() { return 0; }
#endif
#ifdef TEST_KWSYS_CXX_HAS_CSTDIO #ifdef TEST_KWSYS_CXX_HAS_CSTDIO
#include <cstdio> #include <cstdio>
int main() { return 0; } int main() { return 0; }
#endif #endif
#ifdef TEST_KWSYS_CXX_HAS_CSTDDEF
#include <cstddef>
void f(size_t) {}
int main() { return 0; }
#endif
#ifdef TEST_KWSYS_CXX_HAS_LONG_LONG #ifdef TEST_KWSYS_CXX_HAS_LONG_LONG
long long f(long long n) { return n; } long long f(long long n) { return n; }
int main() int main()
@ -131,150 +32,6 @@ int main()
} }
#endif #endif
#ifdef TEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS
template <class T> class A;
template <class T> int f(A<T>&);
template <class T> class A
{
public:
// "friend int f<>(A<T>&)" would conform
friend int f(A<T>&);
private:
int x;
};
template <class T> int f(A<T>& a) { return a.x = 0; }
template int f(A<int>&);
int main()
{
A<int> a;
return f(a);
}
#endif
#ifdef TEST_KWSYS_CXX_HAS_MEMBER_TEMPLATES
template <class U>
class A
{
public:
U u;
A(): u(0) {}
template <class V> V m(V* p) { return *p = u; }
};
int main()
{
A<short> a;
int s = 1;
return a.m(&s);
}
#endif
#ifdef TEST_KWSYS_CXX_HAS_FULL_SPECIALIZATION
template <class T> struct A {};
template <> struct A<int*>
{
static int f() { return 0; }
};
int main() { return A<int*>::f(); }
#endif
#ifdef TEST_KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP
namespace N
{
class A {};
int f(A*) { return 0; }
}
void f(void*);
int main()
{
N::A* a = 0;
return f(a);
}
#endif
#ifdef TEST_KWSYS_STL_HAS_ITERATOR_TRAITS
#include <iterator>
#include <list>
void f(kwsys_stl::iterator_traits<kwsys_stl::list<int>::iterator>::iterator_category const&) {}
int main() { return 0; }
#endif
#ifdef TEST_KWSYS_STL_HAS_ITERATOR_CATEGORY
#include <iterator>
#include <list>
void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::iterator_category(x); }
int main() { return 0; }
#endif
#ifdef TEST_KWSYS_STL_HAS___ITERATOR_CATEGORY
#include <iterator>
#include <list>
void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::__iterator_category(x); }
int main() { return 0; }
#endif
#ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_TEMPLATE
#include <memory>
template <class Alloc>
void f(const Alloc&)
{
typedef typename Alloc::size_type alloc_size_type;
}
int main()
{
f(kwsys_stl::allocator<char>());
return 0;
}
#endif
#ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE
#include <memory>
void f(kwsys_stl::allocator::size_type const&) {}
int main() { return 0; }
#endif
#ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_REBIND
#include <memory>
template <class T, class Alloc>
void f(const T&, const Alloc&)
{
typedef typename Alloc::template rebind<T>::other alloc_type;
}
int main()
{
f(0, kwsys_stl::allocator<char>());
return 0;
}
#endif
#ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
#include <memory>
void f(kwsys_stl::allocator<char> const& a)
{
a.max_size(sizeof(int));
}
int main()
{
f(kwsys_stl::allocator<char>());
return 0;
}
#endif
#ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_OBJECTS
#include <vector>
void f(kwsys_stl::vector<int> const& v1)
{
kwsys_stl::vector<int>(1, 1, v1.get_allocator());
}
int main()
{
f(kwsys_stl::vector<int>());
return 0;
}
#endif
#ifdef TEST_KWSYS_STAT_HAS_ST_MTIM #ifdef TEST_KWSYS_STAT_HAS_ST_MTIM
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -323,62 +80,55 @@ int main()
} }
#endif #endif
#ifdef TEST_KWSYS_IOS_HAVE_BINARY
int test_binary(int, ...)
{
return 0;
}
int main()
{
return test_binary(1, kwsys_ios::ios::binary);
}
#endif
#ifdef TEST_KWSYS_IOS_HAS_ISTREAM_LONG_LONG #ifdef TEST_KWSYS_IOS_HAS_ISTREAM_LONG_LONG
int test_istream(kwsys_ios::istream& is, long long& x) # include <iostream>
int test_istream(std::istream& is, long long& x)
{ {
return (is >> x)? 1:0; return (is >> x)? 1:0;
} }
int main() int main()
{ {
long long x = 0; long long x = 0;
return test_istream(kwsys_ios::cin, x); return test_istream(std::cin, x);
} }
#endif #endif
#ifdef TEST_KWSYS_IOS_HAS_OSTREAM_LONG_LONG #ifdef TEST_KWSYS_IOS_HAS_OSTREAM_LONG_LONG
int test_ostream(kwsys_ios::ostream& os, long long x) # include <iostream>
int test_ostream(std::ostream& os, long long x)
{ {
return (os << x)? 1:0; return (os << x)? 1:0;
} }
int main() int main()
{ {
long long x = 0; long long x = 0;
return test_ostream(kwsys_ios::cout, x); return test_ostream(std::cout, x);
} }
#endif #endif
#ifdef TEST_KWSYS_IOS_HAS_ISTREAM___INT64 #ifdef TEST_KWSYS_IOS_HAS_ISTREAM___INT64
int test_istream(kwsys_ios::istream& is, __int64& x) # include <iostream>
int test_istream(std::istream& is, __int64& x)
{ {
return (is >> x)? 1:0; return (is >> x)? 1:0;
} }
int main() int main()
{ {
__int64 x = 0; __int64 x = 0;
return test_istream(kwsys_ios::cin, x); return test_istream(std::cin, x);
} }
#endif #endif
#ifdef TEST_KWSYS_IOS_HAS_OSTREAM___INT64 #ifdef TEST_KWSYS_IOS_HAS_OSTREAM___INT64
int test_ostream(kwsys_ios::ostream& os, __int64 x) # include <iostream>
int test_ostream(std::ostream& os, __int64 x)
{ {
return (os << x)? 1:0; return (os << x)? 1:0;
} }
int main() int main()
{ {
__int64 x = 0; __int64 x = 0;
return test_ostream(kwsys_ios::cout, x); return test_ostream(std::cout, x);
} }
#endif #endif

View File

@ -1,35 +0,0 @@
/*============================================================================
KWSys - Kitware System Library
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#ifndef @KWSYS_NAMESPACE@_cstddef
#define @KWSYS_NAMESPACE@_cstddef
#include <@KWSYS_NAMESPACE@/Configure.hxx>
/* Avoid warnings in MSVC standard headers. */
#ifdef _MSC_VER
# pragma warning (push, 1)
# pragma warning (disable: 4702)
# pragma warning (disable: 4786)
#endif
/* Include the real header. */
#if @KWSYS_NAMESPACE@_CXX_HAS_CSTDDEF
# include <cstddef>
#else
# include <stddef.h>
#endif
#ifdef _MSC_VER
# pragma warning(pop)
#endif
#endif

View File

@ -1,46 +0,0 @@
/*============================================================================
KWSys - Kitware System Library
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License 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)
# pragma warning (disable: 4995) /* Old streams are deprecated. */
#endif
#if @KWSYS_NAMESPACE@_IOS_USE_ANSI
# include <fstream>
#else
# include <fstream.h>
#endif
#if !@KWSYS_NAMESPACE@_IOS_USE_SSTREAM
namespace @KWSYS_NAMESPACE@_ios
{
using @KWSYS_NAMESPACE@_ios_namespace::ostream;
using @KWSYS_NAMESPACE@_ios_namespace::istream;
using @KWSYS_NAMESPACE@_ios_namespace::ofstream;
using @KWSYS_NAMESPACE@_ios_namespace::ifstream;
using @KWSYS_NAMESPACE@_ios_namespace::ios;
using @KWSYS_NAMESPACE@_ios_namespace::endl;
using @KWSYS_NAMESPACE@_ios_namespace::flush;
}
#endif
#ifdef _MSC_VER
# pragma warning(pop)
#endif
#endif

View File

@ -1,49 +0,0 @@
/*============================================================================
KWSys - Kitware System Library
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License 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_USE_ANSI
# include <iosfwd>
#else
class fstream;
class ifstream;
class ios;
class istream;
class ofstream;
class ostream;
#endif
#if !@KWSYS_NAMESPACE@_IOS_USE_SSTREAM
namespace @KWSYS_NAMESPACE@_ios
{
using @KWSYS_NAMESPACE@_ios_namespace::fstream;
using @KWSYS_NAMESPACE@_ios_namespace::ifstream;
using @KWSYS_NAMESPACE@_ios_namespace::ios;
using @KWSYS_NAMESPACE@_ios_namespace::istream;
using @KWSYS_NAMESPACE@_ios_namespace::ofstream;
using @KWSYS_NAMESPACE@_ios_namespace::ostream;
}
#endif
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#endif

View File

@ -1,99 +0,0 @@
/*============================================================================
KWSys - Kitware System Library
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License 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)
# pragma warning (disable: 4995) /* Old streams are deprecated. */
#endif
#if @KWSYS_NAMESPACE@_IOS_USE_ANSI
# include <iostream>
#else
# include <iostream.h>
#endif
// The HP implementation of iostream defines cin, cout, cerr, and clog
// as macros in order to do thread-private streams.
// See /opt/aCC/include/iostream/iostream.h for details.
// This block redefines the macros in a safe way that is also compatible
// with the HP definitions and the using declarations below.
#if !@KWSYS_NAMESPACE@_IOS_USE_SSTREAM
# if defined(__HP_aCC) && (defined(HP_THREAD_SAFE) || defined(_THREAD_SAFE))
# if defined(cin) && !defined(@KWSYS_NAMESPACE@_IOS_HP_HACK_CIN)
# define @KWSYS_NAMESPACE@_IOS_HP_HACK_CIN
# undef cin
# define cin __tcin.ref()
# endif
# if defined(cout) && !defined(@KWSYS_NAMESPACE@_IOS_HP_HACK_COUT)
# define @KWSYS_NAMESPACE@_IOS_HP_HACK_COUT
# undef cout
# define cout __tcout.ref()
# endif
# if defined(cerr) && !defined(@KWSYS_NAMESPACE@_IOS_HP_HACK_CERR)
# define @KWSYS_NAMESPACE@_IOS_HP_HACK_CERR
# undef cerr
# define cerr __tcerr.ref()
# endif
# if defined(clog) && !defined(@KWSYS_NAMESPACE@_IOS_HP_HACK_CLOG)
# define @KWSYS_NAMESPACE@_IOS_HP_HACK_CLOG
# undef clog
# define clog __tclog.ref()
# endif
# endif
#endif
// If using our own sstream emulation code, put the standard
// streams in the same namespace.
#if !@KWSYS_NAMESPACE@_IOS_USE_SSTREAM
namespace @KWSYS_NAMESPACE@_ios
{
typedef int streamsize;
typedef int streamoff;
using @KWSYS_NAMESPACE@_ios_namespace::ostream;
using @KWSYS_NAMESPACE@_ios_namespace::istream;
using @KWSYS_NAMESPACE@_ios_namespace::ios;
using @KWSYS_NAMESPACE@_ios_namespace::endl;
using @KWSYS_NAMESPACE@_ios_namespace::flush;
# if defined(@KWSYS_NAMESPACE@_IOS_HP_HACK_CIN)
using @KWSYS_NAMESPACE@_ios_namespace::__tcin;
# else
using @KWSYS_NAMESPACE@_ios_namespace::cin;
# endif
# if defined(@KWSYS_NAMESPACE@_IOS_HP_HACK_COUT)
using @KWSYS_NAMESPACE@_ios_namespace::__tcout;
# else
using @KWSYS_NAMESPACE@_ios_namespace::cout;
# endif
# if defined(@KWSYS_NAMESPACE@_IOS_HP_HACK_CERR)
using @KWSYS_NAMESPACE@_ios_namespace::__tcerr;
# else
using @KWSYS_NAMESPACE@_ios_namespace::cerr;
# endif
# if defined(@KWSYS_NAMESPACE@_IOS_HP_HACK_CLOG)
using @KWSYS_NAMESPACE@_ios_namespace::__tclog;
# else
using @KWSYS_NAMESPACE@_ios_namespace::clog;
# endif
}
#endif
#ifdef _MSC_VER
# pragma warning(pop)
#endif
#endif

View File

@ -1,199 +0,0 @@
/*============================================================================
KWSys - Kitware System Library
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License 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_USE_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)
# pragma warning (disable: 4995) /* Old streams are deprecated. */
# endif
# if @KWSYS_NAMESPACE@_IOS_USE_ANSI
# include <strstream>
# elif @KWSYS_NAMESPACE@_IOS_USE_STRSTREAM_H
# include <strstream.h>
# elif @KWSYS_NAMESPACE@_IOS_USE_STRSTREA_H
# include <strstrea.h>
# endif
# if @KWSYS_NAMESPACE@_IOS_USE_ANSI
# include <new> // Need placement operator new.
# else
# include <new.h> // Need placement operator new.
# 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::streambuf;
using @KWSYS_NAMESPACE@_ios_namespace::ostream;
using @KWSYS_NAMESPACE@_ios_namespace::istream;
using @KWSYS_NAMESPACE@_ios_namespace::strstream;
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 stringstream_cleanup
{
public:
stringstream_cleanup(strstream& str): m_StrStream(str) {}
~stringstream_cleanup() { m_StrStream.rdbuf()->freeze(0); }
static void IgnoreUnusedVariable(const stringstream_cleanup&) {}
protected:
strstream& m_StrStream;
private:
void operator=(stringstream_cleanup const&);
};
class stringstream: public strstream
{
public:
typedef strstream Superclass;
stringstream() {}
stringstream(const kwsys_stl::string& s) { *this << s.c_str(); }
kwsys_stl::string str()
{
stringstream_cleanup cleanup(*this);
stringstream_cleanup::IgnoreUnusedVariable(cleanup);
// Visual Studio 6 has a strstream::pcount, but this is not rdbuf()->pcount()
#if (@KWSYS_NAMESPACE@_IOS_USE_STRSTREA_H) && defined(_MSC_VER) && (_MSC_VER == 1200)
int count = this->pcount();
#elif defined(__WATCOMC__)
int count = this->rdbuf()->out_waiting();
#else
int count = this->rdbuf()->pcount();
#endif
const char* ptr = this->Superclass::str();
return kwsys_stl::string(ptr?ptr:"", count);
}
void str(const kwsys_stl::string& s)
{
this->~stringstream();
new (this) stringstream(s);
}
private:
stringstream(const stringstream&);
void operator=(const stringstream&);
};
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;
private:
void operator=(ostringstream_cleanup const&);
};
class ostringstream: public ostrstream
{
public:
typedef ostrstream Superclass;
ostringstream() {}
ostringstream(const kwsys_stl::string& s) { *this << s.c_str(); }
kwsys_stl::string str()
{
ostringstream_cleanup cleanup(*this);
ostringstream_cleanup::IgnoreUnusedVariable(cleanup);
int count = this->pcount();
const char* ptr = this->Superclass::str();
return kwsys_stl::string(ptr?ptr:"", count);
}
void str(const kwsys_stl::string& s)
{
this->~ostringstream();
new (this) ostringstream(s);
}
private:
ostringstream(const ostringstream&);
void operator=(const ostringstream&);
};
#if defined(_MSC_VER)
# pragma warning (push)
# pragma warning (disable: 4097) /* typedef-name used as synonym for class */
#endif
#if defined(__WATCOMC__)
// W728: class modifiers for 'A' conflict with class modifiers for 'B'
# pragma warning 728 10
#endif
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);
}
void clear(int flags)
{
this->IStrStream::clear(flags);
}
private:
istringstream(const istringstream&);
void operator=(const istringstream&);
};
#if defined(__WATCOMC__)
# pragma warning 728 9
#endif
#if defined(_MSC_VER)
# pragma warning (pop)
#endif
} // namespace @KWSYS_NAMESPACE@_ios
#endif
/* Undefine temporary macro. */
#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS
# undef kwsys_stl
#endif
#endif

View File

@ -1,49 +0,0 @@
/*============================================================================
KWSys - Kitware System Library
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#ifndef @KWSYS_NAMESPACE@_stl_@KWSYS_STL_HEADER@
#define @KWSYS_NAMESPACE@_stl_@KWSYS_STL_HEADER@
#include <@KWSYS_NAMESPACE@/Configure.hxx>
/* Avoid warnings in MSVC standard headers. */
#ifdef _MSC_VER
# pragma warning (push, 1)
# pragma warning (disable: 4702)
# pragma warning (disable: 4786)
#endif
/* The HP standard library defines the functor "times" instead of
"multiplies" as specified by C++98 20.3.2 for backward
compatibility with earlier specifications. Defining this macro
fixes this behavior. The name "times" also conflicts with the
function declared in sys/times.h on that platform, so we must do
this as a work-around anyway. */
#if defined(__HP_aCC) && !defined(__HPACC_USING_MULTIPLIES_IN_FUNCTIONAL)
# define __HPACC_USING_MULTIPLIES_IN_FUNCTIONAL
# define @KWSYS_NAMESPACE@_DEFINED___HPACC_USING_MULTIPLIES_IN_FUNCTIONAL
#endif
/* Include the real header. */
#include <@KWSYS_STL_HEADER@>
/* Cleanup. */
#if defined(@KWSYS_NAMESPACE@_DEFINED___HPACC_USING_MULTIPLIES_IN_FUNCTIONAL)
# undef @KWSYS_NAMESPACE@_DEFINED___HPACC_USING_MULTIPLIES_IN_FUNCTIONAL
# undef __HPACC_USING_MULTIPLIES_IN_FUNCTIONAL
#endif
#ifdef _MSC_VER
# pragma warning(pop)
#endif
@KWSYS_STL_HEADER_EXTRA@
#endif

View File

@ -1,123 +0,0 @@
/*============================================================================
KWSys - Kitware System Library
Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
// This header is extra code for <@KWSYS_NAMESPACE@/stl/string>.
#if !defined(@KWSYS_NAMESPACE@_stl_string_including_hxx)
# error "The header <@KWSYS_NAMESPACE@/stl/string.hxx> may be included only by <@KWSYS_NAMESPACE@/stl/string>."
#endif
// Provide the istream operator for the stl string if it is not
// provided by the system or another copy of kwsys. Allow user code
// to block this definition by defining the macro
// @KWSYS_NAMESPACE@_STL_STRING_NO_ISTREAM
// to avoid conflicts with other libraries. User code can test for
// this definition by checking the macro
// @KWSYS_NAMESPACE@_STL_STRING_ISTREAM_DEFINED
#if !@KWSYS_NAMESPACE@_STL_STRING_HAVE_ISTREAM && !defined(@KWSYS_NAMESPACE@_STL_STRING_NO_ISTREAM) && !defined(KWSYS_STL_STRING_ISTREAM_DEFINED)
# define KWSYS_STL_STRING_ISTREAM_DEFINED
# define @KWSYS_NAMESPACE@_STL_STRING_ISTREAM_DEFINED
# include <ctype.h> // isspace
# include <@KWSYS_NAMESPACE@/ios/iostream>
# if defined(__WATCOMC__)
namespace @KWSYS_NAMESPACE@
{
struct ios_istream_hack: public kwsys_ios::istream
{ void eatwhite() { this->@KWSYS_NAMESPACE@_ios::istream::eatwhite(); } };
}
# endif
inline @KWSYS_NAMESPACE@_ios::istream&
operator>>(@KWSYS_NAMESPACE@_ios::istream& is,
@KWSYS_NAMESPACE@_stl::string& s)
{
// Keep track of the resulting state.
int state = @KWSYS_NAMESPACE@_ios::ios::goodbit;
// Save the width setting and set it back to zero.
size_t n = static_cast<size_t>(is.width(0));
// Clear any old contents of the output string.
s.erase();
// Skip leading whitespace.
#if defined(__WATCOMC__)
static_cast<@KWSYS_NAMESPACE@::ios_istream_hack&>(is).eatwhite();
#else
is.eatwhite();
#endif
@KWSYS_NAMESPACE@_ios::istream& okay = is;
if(okay)
{
// Select a maximum possible length.
if(n == 0 || n >= s.max_size())
{
n = s.max_size();
}
// Read until a space is found or the maximum length is reached.
bool success = false;
for(int c = is.peek(); (--n > 0 && c != EOF && !isspace(c)); c = is.peek())
{
s += static_cast<char>(c);
success = true;
is.ignore();
}
// Set flags for resulting state.
if(is.peek() == EOF) { state |= @KWSYS_NAMESPACE@_ios::ios::eofbit; }
if(!success) { state |= @KWSYS_NAMESPACE@_ios::ios::failbit; }
}
// Set the final result state.
is.clear(state);
return is;
}
#endif
// Provide the ostream operator for the stl string if it is not
// provided by the system or another copy of kwsys. Allow user code
// to block this definition by defining the macro
// @KWSYS_NAMESPACE@_STL_STRING_NO_OSTREAM
// to avoid conflicts with other libraries. User code can test for
// this definition by checking the macro
// @KWSYS_NAMESPACE@_STL_STRING_OSTREAM_DEFINED
#if !@KWSYS_NAMESPACE@_STL_STRING_HAVE_OSTREAM && !defined(@KWSYS_NAMESPACE@_STL_STRING_NO_OSTREAM) && !defined(KWSYS_STL_STRING_OSTREAM_DEFINED)
# define KWSYS_STL_STRING_OSTREAM_DEFINED
# define @KWSYS_NAMESPACE@_STL_STRING_OSTREAM_DEFINED
# include <@KWSYS_NAMESPACE@/ios/iostream>
inline @KWSYS_NAMESPACE@_ios::ostream&
operator<<(@KWSYS_NAMESPACE@_ios::ostream& os,
@KWSYS_NAMESPACE@_stl::string const& s)
{
return os << s.c_str();
}
#endif
// Provide the operator!= for the stl string and char* if it is not
// provided by the system or another copy of kwsys. Allow user code
// to block this definition by defining the macro
// @KWSYS_NAMESPACE@_STL_STRING_NO_NEQ_CHAR
// to avoid conflicts with other libraries. User code can test for
// this definition by checking the macro
// @KWSYS_NAMESPACE@_STL_STRING_NEQ_CHAR_DEFINED
#if !@KWSYS_NAMESPACE@_STL_STRING_HAVE_NEQ_CHAR && !defined(@KWSYS_NAMESPACE@_STL_STRING_NO_NEQ_CHAR) && !defined(KWSYS_STL_STRING_NEQ_CHAR_DEFINED)
# define KWSYS_STL_STRING_NEQ_CHAR_DEFINED
# define @KWSYS_NAMESPACE@_STL_STRING_NEQ_CHAR_DEFINED
inline bool operator!=(@KWSYS_NAMESPACE@_stl::string const& s, const char* c)
{
return !(s == c);
}
inline bool operator!=(const char* c, @KWSYS_NAMESPACE@_stl::string const& s)
{
return !(s == c);
}
#endif

View File

@ -11,16 +11,16 @@
============================================================================*/ ============================================================================*/
#include "kwsysPrivate.h" #include "kwsysPrivate.h"
#include KWSYS_HEADER(CommandLineArguments.hxx) #include KWSYS_HEADER(CommandLineArguments.hxx)
#include KWSYS_HEADER(ios/iostream)
#include KWSYS_HEADER(stl/vector)
// Work-around CMake dependency scanning limitation. This must // Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers. // duplicate the above list of headers.
#if 0 #if 0
# include "CommandLineArguments.hxx.in" # include "CommandLineArguments.hxx.in"
# include "kwsys_ios_iostream.h.in"
#endif #endif
#include <iostream>
#include <vector>
#include <stddef.h> /* size_t */ #include <stddef.h> /* size_t */
#include <string.h> /* strcmp */ #include <string.h> /* strcmp */
@ -28,10 +28,10 @@ static void* random_ptr = reinterpret_cast<void*>(0x123);
static int argument(const char* arg, const char* value, void* call_data) static int argument(const char* arg, const char* value, void* call_data)
{ {
kwsys_ios::cout << "Got argument: \"" << arg << "\" value: \"" << (value?value:"(null)") << "\"" << kwsys_ios::endl; std::cout << "Got argument: \"" << arg << "\" value: \"" << (value?value:"(null)") << "\"" << std::endl;
if ( call_data != random_ptr ) if ( call_data != random_ptr )
{ {
kwsys_ios::cerr << "Problem processing call_data" << kwsys_ios::endl; std::cerr << "Problem processing call_data" << std::endl;
return 0; return 0;
} }
return 1; return 1;
@ -39,10 +39,10 @@ static int argument(const char* arg, const char* value, void* call_data)
static int unknown_argument(const char* argument, void* call_data) static int unknown_argument(const char* argument, void* call_data)
{ {
kwsys_ios::cout << "Got unknown argument: \"" << argument << "\"" << kwsys_ios::endl; std::cout << "Got unknown argument: \"" << argument << "\"" << std::endl;
if ( call_data != random_ptr ) if ( call_data != random_ptr )
{ {
kwsys_ios::cerr << "Problem processing call_data" << kwsys_ios::endl; std::cerr << "Problem processing call_data" << std::endl;
return 0; return 0;
} }
return 1; return 1;
@ -53,8 +53,8 @@ static bool CompareTwoItemsOnList(int i1, int i2) { return i1 == i2; }
static bool CompareTwoItemsOnList(double i1, double i2) { return i1 == i2; } static bool CompareTwoItemsOnList(double i1, double i2) { return i1 == i2; }
static bool CompareTwoItemsOnList(const char* i1, static bool CompareTwoItemsOnList(const char* i1,
const char* i2) { return strcmp(i1, i2) == 0; } const char* i2) { return strcmp(i1, i2) == 0; }
static bool CompareTwoItemsOnList(const kwsys_stl::string& i1, static bool CompareTwoItemsOnList(const std::string& i1,
const kwsys_stl::string& i2) { return i1 == i2; } const std::string& i2) { return i1 == i2; }
int testCommandLineArguments(int argc, char* argv[]) int testCommandLineArguments(int argc, char* argv[])
{ {
@ -74,26 +74,26 @@ int testCommandLineArguments(int argc, char* argv[])
int some_int_variable = 10; int some_int_variable = 10;
double some_double_variable = 10.10; double some_double_variable = 10.10;
char* some_string_variable = 0; char* some_string_variable = 0;
kwsys_stl::string some_stl_string_variable = ""; std::string some_stl_string_variable = "";
bool some_bool_variable = false; bool some_bool_variable = false;
bool some_bool_variable1 = false; bool some_bool_variable1 = false;
bool bool_arg1 = false; bool bool_arg1 = false;
int bool_arg2 = 0; int bool_arg2 = 0;
kwsys_stl::vector<int> numbers_argument; std::vector<int> numbers_argument;
int valid_numbers[] = { 5, 1, 8, 3, 7, 1, 3, 9, 7, 1 }; int valid_numbers[] = { 5, 1, 8, 3, 7, 1, 3, 9, 7, 1 };
kwsys_stl::vector<double> doubles_argument; std::vector<double> doubles_argument;
double valid_doubles[] = { 12.5, 1.31, 22 }; double valid_doubles[] = { 12.5, 1.31, 22 };
kwsys_stl::vector<bool> bools_argument; std::vector<bool> bools_argument;
bool valid_bools[] = { true, true, false }; bool valid_bools[] = { true, true, false };
kwsys_stl::vector<char*> strings_argument; std::vector<char*> strings_argument;
const char* valid_strings[] = { "andy", "bill", "brad", "ken" }; const char* valid_strings[] = { "andy", "bill", "brad", "ken" };
kwsys_stl::vector<kwsys_stl::string> stl_strings_argument; std::vector<std::string> stl_strings_argument;
kwsys_stl::string valid_stl_strings[] = { "ken", "brad", "bill", "andy" }; std::string valid_stl_strings[] = { "ken", "brad", "bill", "andy" };
typedef kwsys::CommandLineArguments argT; typedef kwsys::CommandLineArguments argT;
@ -122,47 +122,47 @@ int testCommandLineArguments(int argc, char* argv[])
if ( !arg.Parse() ) if ( !arg.Parse() )
{ {
kwsys_ios::cerr << "Problem parsing arguments" << kwsys_ios::endl; std::cerr << "Problem parsing arguments" << std::endl;
res = 1; res = 1;
} }
kwsys_ios::cout << "Help: " << arg.GetHelp() << kwsys_ios::endl; std::cout << "Help: " << arg.GetHelp() << std::endl;
kwsys_ios::cout << "Some int variable was set to: " << some_int_variable << kwsys_ios::endl; std::cout << "Some int variable was set to: " << some_int_variable << std::endl;
kwsys_ios::cout << "Some double variable was set to: " << some_double_variable << kwsys_ios::endl; std::cout << "Some double variable was set to: " << some_double_variable << std::endl;
if ( some_string_variable && strcmp(some_string_variable, "test string with space") == 0) if ( some_string_variable && strcmp(some_string_variable, "test string with space") == 0)
{ {
kwsys_ios::cout << "Some string variable was set to: " << some_string_variable << kwsys_ios::endl; std::cout << "Some string variable was set to: " << some_string_variable << std::endl;
delete [] some_string_variable; delete [] some_string_variable;
} }
else else
{ {
kwsys_ios::cerr << "Problem setting string variable" << kwsys_ios::endl; std::cerr << "Problem setting string variable" << std::endl;
res = 1; res = 1;
} }
size_t cc; size_t cc;
#define CompareTwoLists(list1, list_valid, lsize) \ #define CompareTwoLists(list1, list_valid, lsize) \
if ( list1.size() != lsize ) \ if ( list1.size() != lsize ) \
{ \ { \
kwsys_ios::cerr << "Problem setting " #list1 ". Size is: " << list1.size() \ std::cerr << "Problem setting " #list1 ". Size is: " << list1.size() \
<< " should be: " << lsize << kwsys_ios::endl; \ << " should be: " << lsize << std::endl; \
res = 1; \ res = 1; \
} \ } \
else \ else \
{ \ { \
kwsys_ios::cout << #list1 " argument set:"; \ std::cout << #list1 " argument set:"; \
for ( cc =0; cc < lsize; ++ cc ) \ for ( cc =0; cc < lsize; ++ cc ) \
{ \ { \
kwsys_ios::cout << " " << list1[cc]; \ std::cout << " " << list1[cc]; \
if ( !CompareTwoItemsOnList(list1[cc], list_valid[cc]) ) \ if ( !CompareTwoItemsOnList(list1[cc], list_valid[cc]) ) \
{ \ { \
kwsys_ios::cerr << "Problem setting " #list1 ". Value of " \ std::cerr << "Problem setting " #list1 ". Value of " \
<< cc << " is: [" << list1[cc] << "] <> [" \ << cc << " is: [" << list1[cc] << "] <> [" \
<< list_valid[cc] << "]" << kwsys_ios::endl; \ << list_valid[cc] << "]" << std::endl; \
res = 1; \ res = 1; \
break; \ break; \
} \ } \
} \ } \
kwsys_ios::cout << kwsys_ios::endl; \ std::cout << std::endl; \
} }
CompareTwoLists(numbers_argument, valid_numbers, 10); CompareTwoLists(numbers_argument, valid_numbers, 10);
@ -171,12 +171,12 @@ int testCommandLineArguments(int argc, char* argv[])
CompareTwoLists(strings_argument, valid_strings, 4); CompareTwoLists(strings_argument, valid_strings, 4);
CompareTwoLists(stl_strings_argument, valid_stl_strings, 4); CompareTwoLists(stl_strings_argument, valid_stl_strings, 4);
kwsys_ios::cout << "Some STL String variable was set to: " << some_stl_string_variable << kwsys_ios::endl; std::cout << "Some STL String variable was set to: " << some_stl_string_variable << std::endl;
kwsys_ios::cout << "Some bool variable was set to: " << some_bool_variable << kwsys_ios::endl; std::cout << "Some bool variable was set to: " << some_bool_variable << std::endl;
kwsys_ios::cout << "Some bool variable was set to: " << some_bool_variable1 << kwsys_ios::endl; std::cout << "Some bool variable was set to: " << some_bool_variable1 << std::endl;
kwsys_ios::cout << "bool_arg1 variable was set to: " << bool_arg1 << kwsys_ios::endl; std::cout << "bool_arg1 variable was set to: " << bool_arg1 << std::endl;
kwsys_ios::cout << "bool_arg2 variable was set to: " << bool_arg2 << kwsys_ios::endl; std::cout << "bool_arg2 variable was set to: " << bool_arg2 << std::endl;
kwsys_ios::cout << kwsys_ios::endl; std::cout << std::endl;
for ( cc = 0; cc < strings_argument.size(); ++ cc ) for ( cc = 0; cc < strings_argument.size(); ++ cc )
{ {

View File

@ -11,16 +11,16 @@
============================================================================*/ ============================================================================*/
#include "kwsysPrivate.h" #include "kwsysPrivate.h"
#include KWSYS_HEADER(CommandLineArguments.hxx) #include KWSYS_HEADER(CommandLineArguments.hxx)
#include KWSYS_HEADER(ios/iostream)
#include KWSYS_HEADER(stl/vector)
// Work-around CMake dependency scanning limitation. This must // Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers. // duplicate the above list of headers.
#if 0 #if 0
# include "CommandLineArguments.hxx.in" # include "CommandLineArguments.hxx.in"
# include "kwsys_ios_iostream.h.in"
#endif #endif
#include <iostream>
#include <vector>
#include <assert.h> /* assert */ #include <assert.h> /* assert */
#include <string.h> /* strcmp */ #include <string.h> /* strcmp */
@ -31,7 +31,7 @@ int testCommandLineArguments1(int argc, char* argv[])
int n = 0; int n = 0;
char* m = 0; char* m = 0;
kwsys_stl::string p; std::string p;
int res = 0; int res = 0;
typedef kwsys::CommandLineArguments argT; typedef kwsys::CommandLineArguments argT;
@ -43,27 +43,27 @@ int testCommandLineArguments1(int argc, char* argv[])
if ( !arg.Parse() ) if ( !arg.Parse() )
{ {
kwsys_ios::cerr << "Problem parsing arguments" << kwsys_ios::endl; std::cerr << "Problem parsing arguments" << std::endl;
res = 1; res = 1;
} }
if ( n != 24 ) if ( n != 24 )
{ {
kwsys_ios::cout << "Problem setting N. Value of N: " << n << kwsys_ios::endl; std::cout << "Problem setting N. Value of N: " << n << std::endl;
res = 1; res = 1;
} }
if ( !m || strcmp(m, "test value") != 0 ) if ( !m || strcmp(m, "test value") != 0 )
{ {
kwsys_ios::cout << "Problem setting M. Value of M: " << m << kwsys_ios::endl; std::cout << "Problem setting M. Value of M: " << m << std::endl;
res = 1; res = 1;
} }
if ( p != "1" ) if ( p != "1" )
{ {
kwsys_ios::cout << "Problem setting P. Value of P: " << p << kwsys_ios::endl; std::cout << "Problem setting P. Value of P: " << p << std::endl;
res = 1; res = 1;
} }
kwsys_ios::cout << "Value of N: " << n << kwsys_ios::endl; std::cout << "Value of N: " << n << std::endl;
kwsys_ios::cout << "Value of M: " << m << kwsys_ios::endl; std::cout << "Value of M: " << m << std::endl;
kwsys_ios::cout << "Value of P: " << p << kwsys_ios::endl; std::cout << "Value of P: " << p << std::endl;
if ( m ) if ( m )
{ {
delete [] m; delete [] m;
@ -79,25 +79,25 @@ int testCommandLineArguments1(int argc, char* argv[])
}; };
if ( newArgc != 9 ) if ( newArgc != 9 )
{ {
kwsys_ios::cerr << "Bad number of unused arguments: " << newArgc << kwsys_ios::endl; std::cerr << "Bad number of unused arguments: " << newArgc << std::endl;
res = 1; res = 1;
} }
for ( cc = 0; cc < newArgc; ++ cc ) for ( cc = 0; cc < newArgc; ++ cc )
{ {
assert(newArgv[cc]); /* Quiet Clang scan-build. */ assert(newArgv[cc]); /* Quiet Clang scan-build. */
kwsys_ios::cout << "Unused argument[" << cc << "] = [" << newArgv[cc] << "]" std::cout << "Unused argument[" << cc << "] = [" << newArgv[cc] << "]"
<< kwsys_ios::endl; << std::endl;
if ( cc >= 9 ) if ( cc >= 9 )
{ {
kwsys_ios::cerr << "Too many unused arguments: " << cc << kwsys_ios::endl; std::cerr << "Too many unused arguments: " << cc << std::endl;
res = 1; res = 1;
} }
else if ( valid_unused_args[cc] && else if ( valid_unused_args[cc] &&
strcmp(valid_unused_args[cc], newArgv[cc]) != 0 ) strcmp(valid_unused_args[cc], newArgv[cc]) != 0 )
{ {
kwsys_ios::cerr << "Bad unused argument [" << cc << "] \"" std::cerr << "Bad unused argument [" << cc << "] \""
<< newArgv[cc] << "\" should be: \"" << valid_unused_args[cc] << "\"" << newArgv[cc] << "\" should be: \"" << valid_unused_args[cc] << "\""
<< kwsys_ios::endl; << std::endl;
res = 1; res = 1;
} }
} }

View File

@ -12,8 +12,6 @@
#include "kwsysPrivate.h" #include "kwsysPrivate.h"
#include KWSYS_HEADER(DynamicLoader.hxx) #include KWSYS_HEADER(DynamicLoader.hxx)
#include KWSYS_HEADER(ios/iostream)
#include KWSYS_HEADER(stl/string)
#if defined(__BEOS__) || defined(__HAIKU__) #if defined(__BEOS__) || defined(__HAIKU__)
#include <be/kernel/OS.h> /* disable_debugger() API. */ #include <be/kernel/OS.h> /* disable_debugger() API. */
@ -23,18 +21,19 @@
// duplicate the above list of headers. // duplicate the above list of headers.
#if 0 #if 0
# include "DynamicLoader.hxx.in" # include "DynamicLoader.hxx.in"
# include "kwsys_ios_iostream.h.in"
# include "kwsys_stl_string.hxx.in"
#endif #endif
#include <string>
#include <iostream>
// Include with <> instead of "" to avoid getting any in-source copy // Include with <> instead of "" to avoid getting any in-source copy
// left on disk. // left on disk.
#include <testSystemTools.h> #include <testSystemTools.h>
static kwsys_stl::string GetLibName(const char* lname) static std::string GetLibName(const char* lname)
{ {
// Construct proper name of lib // Construct proper name of lib
kwsys_stl::string slname; std::string slname;
slname = EXECUTABLE_OUTPUT_PATH; slname = EXECUTABLE_OUTPUT_PATH;
#ifdef CMAKE_INTDIR #ifdef CMAKE_INTDIR
slname += "/"; slname += "/";
@ -56,30 +55,30 @@ static kwsys_stl::string GetLibName(const char* lname)
*/ */
int TestDynamicLoader(const char* libname, const char* symbol, int r1, int r2, int r3) int TestDynamicLoader(const char* libname, const char* symbol, int r1, int r2, int r3)
{ {
kwsys_ios::cerr << "Testing: " << libname << kwsys_ios::endl; std::cerr << "Testing: " << libname << std::endl;
kwsys::DynamicLoader::LibraryHandle l kwsys::DynamicLoader::LibraryHandle l
= kwsys::DynamicLoader::OpenLibrary(libname); = kwsys::DynamicLoader::OpenLibrary(libname);
// If result is incompatible with expectation just fails (xor): // If result is incompatible with expectation just fails (xor):
if( (r1 && !l) || (!r1 && l) ) if( (r1 && !l) || (!r1 && l) )
{ {
kwsys_ios::cerr std::cerr
<< kwsys::DynamicLoader::LastError() << kwsys_ios::endl; << kwsys::DynamicLoader::LastError() << std::endl;
return 1; return 1;
} }
kwsys::DynamicLoader::SymbolPointer f kwsys::DynamicLoader::SymbolPointer f
= kwsys::DynamicLoader::GetSymbolAddress(l, symbol); = kwsys::DynamicLoader::GetSymbolAddress(l, symbol);
if( (r2 && !f) || (!r2 && f) ) if( (r2 && !f) || (!r2 && f) )
{ {
kwsys_ios::cerr std::cerr
<< kwsys::DynamicLoader::LastError() << kwsys_ios::endl; << kwsys::DynamicLoader::LastError() << std::endl;
return 1; return 1;
} }
#ifndef __APPLE__ #ifndef __APPLE__
int s = kwsys::DynamicLoader::CloseLibrary(l); int s = kwsys::DynamicLoader::CloseLibrary(l);
if( (r3 && !s) || (!r3 && s) ) if( (r3 && !s) || (!r3 && s) )
{ {
kwsys_ios::cerr std::cerr
<< kwsys::DynamicLoader::LastError() << kwsys_ios::endl; << kwsys::DynamicLoader::LastError() << std::endl;
return 1; return 1;
} }
#else #else
@ -118,7 +117,7 @@ int testDynamicLoader(int argc, char *argv[])
res += TestDynamicLoader("libdl.so", "TestDynamicLoader",1,0,1); res += TestDynamicLoader("libdl.so", "TestDynamicLoader",1,0,1);
#endif #endif
// Now try on the generated library // Now try on the generated library
kwsys_stl::string libname = GetLibName(KWSYS_NAMESPACE_STRING "TestDynload"); std::string libname = GetLibName(KWSYS_NAMESPACE_STRING "TestDynload");
res += TestDynamicLoader(libname.c_str(), "dummy",1,0,1); res += TestDynamicLoader(libname.c_str(), "dummy",1,0,1);
res += TestDynamicLoader(libname.c_str(), "TestDynamicLoaderSymbolPointer",1,1,1); res += TestDynamicLoader(libname.c_str(), "TestDynamicLoaderSymbolPointer",1,1,1);
res += TestDynamicLoader(libname.c_str(), "_TestDynamicLoaderSymbolPointer",1,0,1); res += TestDynamicLoader(libname.c_str(), "_TestDynamicLoaderSymbolPointer",1,0,1);

View File

@ -17,8 +17,8 @@
#include KWSYS_HEADER(Encoding.hxx) #include KWSYS_HEADER(Encoding.hxx)
#include KWSYS_HEADER(Encoding.h) #include KWSYS_HEADER(Encoding.h)
#include KWSYS_HEADER(ios/iostream)
#include <iostream>
#include <locale.h> #include <locale.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
@ -28,7 +28,6 @@
#if 0 #if 0
# include "Encoding.hxx.in" # include "Encoding.hxx.in"
# include "Encoding.h.in" # include "Encoding.h.in"
# include "kwsys_ios_iostream.h.in"
#endif #endif
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -16,7 +16,6 @@
#endif #endif
#include KWSYS_HEADER(FStream.hxx) #include KWSYS_HEADER(FStream.hxx)
#include KWSYS_HEADER(ios/iostream)
#include <string.h> #include <string.h>
#ifdef __BORLANDC__ #ifdef __BORLANDC__
# include <mem.h> /* memcmp */ # include <mem.h> /* memcmp */
@ -26,9 +25,9 @@
// duplicate the above list of headers. // duplicate the above list of headers.
#if 0 #if 0
# include "FStream.hxx.in" # include "FStream.hxx.in"
# include "kwsys_ios_iostream.h.in"
#endif #endif
#include <iostream>
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static int testNoFile() static int testNoFile()
@ -95,20 +94,20 @@ static int testBOM()
kwsys::FStream::BOM bom = kwsys::FStream::ReadBOM(in); kwsys::FStream::BOM bom = kwsys::FStream::ReadBOM(in);
if(bom != expected_bom[i]) if(bom != expected_bom[i])
{ {
kwsys_ios::cout << "Unexpected BOM " << i << std::endl; std::cout << "Unexpected BOM " << i << std::endl;
return 1; return 1;
} }
char data[45]; char data[45];
in.read(data, file_data[i][0]); in.read(data, file_data[i][0]);
if(!in.good()) if(!in.good())
{ {
kwsys_ios::cout << "Unable to read data " << i << std::endl; std::cout << "Unable to read data " << i << std::endl;
return 1; return 1;
} }
if(memcmp(data, file_data[i]+1, file_data[i][0]) != 0) if(memcmp(data, file_data[i]+1, file_data[i][0]) != 0)
{ {
kwsys_ios::cout << "Incorrect read data " << i << std::endl; std::cout << "Incorrect read data " << i << std::endl;
return 1; return 1;
} }
@ -125,20 +124,20 @@ static int testBOM()
kwsys::FStream::BOM bom = kwsys::FStream::ReadBOM(in); kwsys::FStream::BOM bom = kwsys::FStream::ReadBOM(in);
if(bom != kwsys::FStream::BOM_None) if(bom != kwsys::FStream::BOM_None)
{ {
kwsys_ios::cout << "Unexpected BOM for none case" << std::endl; std::cout << "Unexpected BOM for none case" << std::endl;
return 1; return 1;
} }
char data[45]; char data[45];
in.read(data, file_data[0][0]); in.read(data, file_data[0][0]);
if(!in.good()) if(!in.good())
{ {
kwsys_ios::cout << "Unable to read data for none case" << std::endl; std::cout << "Unable to read data for none case" << std::endl;
return 1; return 1;
} }
if(memcmp(data, file_data[0]+1, file_data[0][0]) != 0) if(memcmp(data, file_data[0]+1, file_data[0][0]) != 0)
{ {
kwsys_ios::cout << "Incorrect read data for none case" << std::endl; std::cout << "Incorrect read data for none case" << std::endl;
return 1; return 1;
} }
} }
@ -156,20 +155,20 @@ static int testBOM()
kwsys::FStream::BOM bom = kwsys::FStream::ReadBOM(in); kwsys::FStream::BOM bom = kwsys::FStream::ReadBOM(in);
if(bom != kwsys::FStream::BOM_UTF8) if(bom != kwsys::FStream::BOM_UTF8)
{ {
kwsys_ios::cout << "Unexpected BOM for utf-8 case" << std::endl; std::cout << "Unexpected BOM for utf-8 case" << std::endl;
return 1; return 1;
} }
char data[45]; char data[45];
in.read(data, file_data[0][0]); in.read(data, file_data[0][0]);
if(!in.good()) if(!in.good())
{ {
kwsys_ios::cout << "Unable to read data for utf-8 case" << std::endl; std::cout << "Unable to read data for utf-8 case" << std::endl;
return 1; return 1;
} }
if(memcmp(data, file_data[0]+1, file_data[0][0]) != 0) if(memcmp(data, file_data[0]+1, file_data[0][0]) != 0)
{ {
kwsys_ios::cout << "Incorrect read data for utf-8 case" << std::endl; std::cout << "Incorrect read data for utf-8 case" << std::endl;
return 1; return 1;
} }
} }

View File

@ -12,7 +12,6 @@
#include "kwsysPrivate.h" #include "kwsysPrivate.h"
#include KWSYS_HEADER(hash_map.hxx) #include KWSYS_HEADER(hash_map.hxx)
#include KWSYS_HEADER(hash_set.hxx) #include KWSYS_HEADER(hash_set.hxx)
#include KWSYS_HEADER(ios/iostream)
// Work-around CMake dependency scanning limitation. This must // Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers. // duplicate the above list of headers.
@ -20,9 +19,10 @@
# include "hash_map.hxx.in" # include "hash_map.hxx.in"
# include "hash_set.hxx.in" # include "hash_set.hxx.in"
# include "hashtable.hxx.in" # include "hashtable.hxx.in"
# include "kwsys_ios_iostream.h.in"
#endif #endif
#include <iostream>
#if defined(_MSC_VER) #if defined(_MSC_VER)
# pragma warning (disable:4786) # pragma warning (disable:4786)
#endif #endif
@ -44,8 +44,8 @@ static bool test_hash_map()
int sum = 0; int sum = 0;
for(mtype::iterator mi = m.begin(); mi != m.end(); ++mi) for(mtype::iterator mi = m.begin(); mi != m.end(); ++mi)
{ {
kwsys_ios::cout << "Found entry [" << mi->first << "," << mi->second << "]" std::cout << "Found entry [" << mi->first << "," << mi->second << "]"
<< kwsys_ios::endl; << std::endl;
sum += mi->second; sum += mi->second;
} }
return sum == 3; return sum == 3;
@ -60,7 +60,7 @@ static bool test_hash_set()
int sum = 0; int sum = 0;
for(stype::iterator si = s.begin(); si != s.end(); ++si) for(stype::iterator si = s.begin(); si != s.end(); ++si)
{ {
kwsys_ios::cout << "Found entry [" << *si << "]" << kwsys_ios::endl; std::cout << "Found entry [" << *si << "]" << std::endl;
sum += *si; sum += *si;
} }
return sum == 3; return sum == 3;

View File

@ -10,158 +10,149 @@
See the License for more information. See the License for more information.
============================================================================*/ ============================================================================*/
#include "kwsysPrivate.h" #include "kwsysPrivate.h"
#include KWSYS_HEADER(stl/vector) #include KWSYS_HEADER(Configure.hxx)
#include KWSYS_HEADER(ios/sstream)
#include KWSYS_HEADER(ios/fstream)
#include KWSYS_HEADER(ios/iostream)
// Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers.
#if 0
# include "kwsys_stl_string.hxx.in"
# include "kwsys_stl_vector.h.in"
# include "kwsys_ios_sstream.h.in"
# include "kwsys_ios_fstream.h.in"
# include "kwsys_ios_iostream.h.in"
#endif
#include <sstream>
#include <fstream>
#include <iostream>
#include <vector>
#include <string.h> /* strlen */ #include <string.h> /* strlen */
int testIOS(int, char*[]) int testIOS(int, char*[])
{ {
kwsys_ios::ostringstream ostr; std::ostringstream ostr;
const char hello[] = "hello"; const char hello[] = "hello";
ostr << hello; ostr << hello;
if(ostr.str() != hello) if(ostr.str() != hello)
{ {
kwsys_ios::cerr << "failed to write hello to ostr" << kwsys_ios::endl; std::cerr << "failed to write hello to ostr" << std::endl;
return 1; return 1;
} }
const char world[] = "world"; const char world[] = "world";
kwsys_ios::ostringstream ostr2; std::ostringstream ostr2;
ostr2.write( hello, strlen(hello) ); /* I could do sizeof */ ostr2.write( hello, strlen(hello) ); /* I could do sizeof */
ostr2.put( '\0' ); ostr2.put( '\0' );
ostr2.write( world, strlen(world) ); ostr2.write( world, strlen(world) );
if(ostr2.str().size() != strlen(hello) + 1 + strlen(world) ) if(ostr2.str().size() != strlen(hello) + 1 + strlen(world) )
{ {
kwsys_ios::cerr << "failed to write hello to ostr2" << kwsys_ios::endl; std::cerr << "failed to write hello to ostr2" << std::endl;
return 1; return 1;
} }
static const unsigned char array[] = { 0xff,0x4f,0xff,0x51,0x00,0x29,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x07,0x01,0x01,0xff,0x52,0x00,0x0c,0x00,0x00,0x00,0x01,0x00,0x05,0x04,0x04,0x00,0x01,0xff,0x5c,0x00,0x13,0x40,0x40,0x48,0x48,0x50,0x48,0x48,0x50,0x48,0x48,0x50,0x48,0x48,0x50,0x48,0x48,0x50,0xff,0x64,0x00,0x2c,0x00,0x00,0x43,0x72,0x65,0x61,0x74,0x65,0x64,0x20,0x62,0x79,0x20,0x49,0x54,0x4b,0x2f,0x47,0x44,0x43,0x4d,0x2f,0x4f,0x70,0x65,0x6e,0x4a,0x50,0x45,0x47,0x20,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x31,0x2e,0x30,0xff,0x90,0x00,0x0a,0x00,0x00,0x00,0x00,0x06,0x2c,0x00,0x01,0xff,0x93,0xcf,0xb0,0x18,0x08,0x7f,0xc6,0x99,0xbf,0xff,0xc0,0xf8,0xc1,0xc1,0xf3,0x05,0x81,0xf2,0x83,0x0a,0xa5,0xff,0x10,0x90,0xbf,0x2f,0xff,0x04,0xa8,0x7f,0xc0,0xf8,0xc4,0xc1,0xf3,0x09,0x81,0xf3,0x0c,0x19,0x34 }; static const unsigned char array[] = { 0xff,0x4f,0xff,0x51,0x00,0x29,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x07,0x01,0x01,0xff,0x52,0x00,0x0c,0x00,0x00,0x00,0x01,0x00,0x05,0x04,0x04,0x00,0x01,0xff,0x5c,0x00,0x13,0x40,0x40,0x48,0x48,0x50,0x48,0x48,0x50,0x48,0x48,0x50,0x48,0x48,0x50,0x48,0x48,0x50,0xff,0x64,0x00,0x2c,0x00,0x00,0x43,0x72,0x65,0x61,0x74,0x65,0x64,0x20,0x62,0x79,0x20,0x49,0x54,0x4b,0x2f,0x47,0x44,0x43,0x4d,0x2f,0x4f,0x70,0x65,0x6e,0x4a,0x50,0x45,0x47,0x20,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x20,0x31,0x2e,0x30,0xff,0x90,0x00,0x0a,0x00,0x00,0x00,0x00,0x06,0x2c,0x00,0x01,0xff,0x93,0xcf,0xb0,0x18,0x08,0x7f,0xc6,0x99,0xbf,0xff,0xc0,0xf8,0xc1,0xc1,0xf3,0x05,0x81,0xf2,0x83,0x0a,0xa5,0xff,0x10,0x90,0xbf,0x2f,0xff,0x04,0xa8,0x7f,0xc0,0xf8,0xc4,0xc1,0xf3,0x09,0x81,0xf3,0x0c,0x19,0x34 };
const size_t narray = sizeof(array); // 180 const size_t narray = sizeof(array); // 180
kwsys_ios::stringstream strstr; std::stringstream strstr;
strstr.write( (char*)array, narray ); strstr.write( (char*)array, narray );
//strstr.seekp( narray / 2 ); // set position of put pointer in mid string //strstr.seekp( narray / 2 ); // set position of put pointer in mid string
if(strstr.str().size() != narray ) if(strstr.str().size() != narray )
{ {
kwsys_ios::cerr << "failed to write array to strstr" << kwsys_ios::endl; std::cerr << "failed to write array to strstr" << std::endl;
return 1; return 1;
} }
kwsys_ios::istringstream istr(" 10 20 str "); std::istringstream istr(" 10 20 str ");
kwsys_stl::string s; std::string s;
int x; int x;
if(istr >> x) if(istr >> x)
{ {
if(x != 10) if(x != 10)
{ {
kwsys_ios::cerr << "x != 10" << kwsys_ios::endl; std::cerr << "x != 10" << std::endl;
return 1; return 1;
} }
} }
else else
{ {
kwsys_ios::cerr << "Failed to read 10 from istr" << kwsys_ios::endl; std::cerr << "Failed to read 10 from istr" << std::endl;
return 1; return 1;
} }
if(istr >> x) if(istr >> x)
{ {
if(x != 20) if(x != 20)
{ {
kwsys_ios::cerr << "x != 20" << kwsys_ios::endl; std::cerr << "x != 20" << std::endl;
return 1; return 1;
} }
} }
else else
{ {
kwsys_ios::cerr << "Failed to read 20 from istr" << kwsys_ios::endl; std::cerr << "Failed to read 20 from istr" << std::endl;
return 1; return 1;
} }
if(istr >> s) if(istr >> s)
{ {
if(s != "str") if(s != "str")
{ {
kwsys_ios::cerr << "s != \"str\"" << kwsys_ios::endl; std::cerr << "s != \"str\"" << std::endl;
return 1; return 1;
} }
} }
else else
{ {
kwsys_ios::cerr << "Failed to read str from istr" << kwsys_ios::endl; std::cerr << "Failed to read str from istr" << std::endl;
return 1; return 1;
} }
if(istr >> s) if(istr >> s)
{ {
kwsys_ios::cerr << "Able to read past end of stream" << kwsys_ios::endl; std::cerr << "Able to read past end of stream" << std::endl;
return 1; return 1;
} }
else else
{ {
// Clear the failure. // Clear the failure.
istr.clear(istr.rdstate() & ~kwsys_ios::ios::eofbit); istr.clear(istr.rdstate() & ~std::ios::eofbit);
istr.clear(istr.rdstate() & ~kwsys_ios::ios::failbit); istr.clear(istr.rdstate() & ~std::ios::failbit);
} }
istr.str("30"); istr.str("30");
if(istr >> x) if(istr >> x)
{ {
if(x != 30) if(x != 30)
{ {
kwsys_ios::cerr << "x != 30" << kwsys_ios::endl; std::cerr << "x != 30" << std::endl;
return 1; return 1;
} }
} }
else else
{ {
kwsys_ios::cerr << "Failed to read 30 from istr" << kwsys_ios::endl; std::cerr << "Failed to read 30 from istr" << std::endl;
return 1; return 1;
} }
kwsys_ios::stringstream sstr; std::stringstream sstr;
sstr << "40 str2"; sstr << "40 str2";
if(sstr >> x) if(sstr >> x)
{ {
if(x != 40) if(x != 40)
{ {
kwsys_ios::cerr << "x != 40" << kwsys_ios::endl; std::cerr << "x != 40" << std::endl;
return 1; return 1;
} }
} }
else else
{ {
kwsys_ios::cerr << "Failed to read 40 from sstr" << kwsys_ios::endl; std::cerr << "Failed to read 40 from sstr" << std::endl;
return 1; return 1;
} }
if(sstr >> s) if(sstr >> s)
{ {
if(s != "str2") if(s != "str2")
{ {
kwsys_ios::cerr << "s != \"str2\"" << kwsys_ios::endl; std::cerr << "s != \"str2\"" << std::endl;
return 1; return 1;
} }
} }
else else
{ {
kwsys_ios::cerr << "Failed to read str2 from sstr" << kwsys_ios::endl; std::cerr << "Failed to read str2 from sstr" << std::endl;
return 1; return 1;
} }
// Just try to compile this. // Just try to compile this.
if(x == 12345) if(x == 12345)
{ {
kwsys_ios::ifstream fin("/does_not_exist", std::ifstream fin("/does_not_exist",
kwsys_ios::ios::in | kwsys_ios_binary); std::ios::in | std::ios::binary);
} }
kwsys_ios::cout << "IOS tests passed" << kwsys_ios::endl; std::cout << "IOS tests passed" << std::endl;
return 0; return 0;
} }

View File

@ -11,15 +11,15 @@
============================================================================*/ ============================================================================*/
#include "kwsysPrivate.h" #include "kwsysPrivate.h"
#include KWSYS_HEADER(SystemInformation.hxx) #include KWSYS_HEADER(SystemInformation.hxx)
#include KWSYS_HEADER(ios/iostream)
// Work-around CMake dependency scanning limitation. This must // Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers. // duplicate the above list of headers.
#if 0 #if 0
# include "SystemInformation.hxx.in" # include "SystemInformation.hxx.in"
# include "kwsys_ios_iostream.h.in"
#endif #endif
#include <iostream>
#if defined(KWSYS_USE_LONG_LONG) #if defined(KWSYS_USE_LONG_LONG)
# if defined(KWSYS_IOS_HAS_OSTREAM_LONG_LONG) # if defined(KWSYS_IOS_HAS_OSTREAM_LONG_LONG)
# define iostreamLongLong(x) (x) # define iostreamLongLong(x) (x)
@ -36,18 +36,18 @@
# error "No Long Long" # error "No Long Long"
#endif #endif
#define printMethod(info, m) kwsys_ios::cout << #m << ": " \ #define printMethod(info, m) std::cout << #m << ": " \
<< info.m() << "\n" << info.m() << "\n"
#define printMethod2(info, m, unit) kwsys_ios::cout << #m << ": " \ #define printMethod2(info, m, unit) std::cout << #m << ": " \
<< info.m() << " " << unit << "\n" << info.m() << " " << unit << "\n"
#define printMethod3(info, m, unit) kwsys_ios::cout << #m << ": " \ #define printMethod3(info, m, unit) std::cout << #m << ": " \
<< iostreamLongLong(info.m) << " " << unit << "\n" << iostreamLongLong(info.m) << " " << unit << "\n"
int testSystemInformation(int, char*[]) int testSystemInformation(int, char*[])
{ {
kwsys_ios::cout << "CTEST_FULL_OUTPUT\n"; // avoid truncation std::cout << "CTEST_FULL_OUTPUT\n"; // avoid truncation
kwsys::SystemInformation info; kwsys::SystemInformation info;
info.RunCPUCheck(); info.RunCPUCheck();
@ -93,16 +93,16 @@ int testSystemInformation(int, char*[])
{ {
if (info.DoesCPUSupportFeature(static_cast<long int>(1) << i)) if (info.DoesCPUSupportFeature(static_cast<long int>(1) << i))
{ {
kwsys_ios::cout << "CPU feature " << i << "\n"; std::cout << "CPU feature " << i << "\n";
} }
} }
/* test stack trace /* test stack trace
*/ */
kwsys_ios::cout std::cout
<< "Program Stack:" << kwsys_ios::endl << "Program Stack:" << std::endl
<< kwsys::SystemInformation::GetProgramStack(0,0) << kwsys_ios::endl << kwsys::SystemInformation::GetProgramStack(0,0) << std::endl
<< kwsys_ios::endl; << std::endl;
/* test segv handler /* test segv handler
info.SetStackTraceOnError(1); info.SetStackTraceOnError(1);

View File

@ -16,19 +16,18 @@
#endif #endif
#include KWSYS_HEADER(SystemTools.hxx) #include KWSYS_HEADER(SystemTools.hxx)
#include KWSYS_HEADER(ios/iostream)
// Work-around CMake dependency scanning limitation. This must // Work-around CMake dependency scanning limitation. This must
// duplicate the above list of headers. // duplicate the above list of headers.
#if 0 #if 0
# include "SystemTools.hxx.in" # include "SystemTools.hxx.in"
# include "kwsys_ios_iostream.h.in"
#endif #endif
// Include with <> instead of "" to avoid getting any in-source copy // Include with <> instead of "" to avoid getting any in-source copy
// left on disk. // left on disk.
#include <testSystemTools.h> #include <testSystemTools.h>
#include <iostream>
#include <string.h> /* strcmp */ #include <string.h> /* strcmp */
#if defined(_WIN32) && !defined(__CYGWIN__) #if defined(_WIN32) && !defined(__CYGWIN__)
# include <io.h> /* _umask (MSVC) / umask (Borland) */ # include <io.h> /* _umask (MSVC) / umask (Borland) */
@ -63,17 +62,17 @@ static const char* toUnixPaths[][2] =
{0, 0} {0, 0}
}; };
static bool CheckConvertToUnixSlashes(kwsys_stl::string input, static bool CheckConvertToUnixSlashes(std::string input,
kwsys_stl::string output) std::string output)
{ {
kwsys_stl::string result = input; std::string result = input;
kwsys::SystemTools::ConvertToUnixSlashes(result); kwsys::SystemTools::ConvertToUnixSlashes(result);
if ( result != output ) if ( result != output )
{ {
kwsys_ios::cerr std::cerr
<< "Problem with ConvertToUnixSlashes - input: " << input << "Problem with ConvertToUnixSlashes - input: " << input
<< " output: " << result << " expected: " << output << " output: " << result << " expected: " << output
<< kwsys_ios::endl; << std::endl;
return false; return false;
} }
return true; return true;
@ -87,19 +86,19 @@ static const char* checkEscapeChars[][4] =
{0, 0, 0, 0} {0, 0, 0, 0}
}; };
static bool CheckEscapeChars(kwsys_stl::string input, static bool CheckEscapeChars(std::string input,
const char *chars_to_escape, const char *chars_to_escape,
char escape_char, char escape_char,
kwsys_stl::string output) std::string output)
{ {
kwsys_stl::string result = kwsys::SystemTools::EscapeChars( std::string result = kwsys::SystemTools::EscapeChars(
input.c_str(), chars_to_escape, escape_char); input.c_str(), chars_to_escape, escape_char);
if (result != output) if (result != output)
{ {
kwsys_ios::cerr std::cerr
<< "Problem with CheckEscapeChars - input: " << input << "Problem with CheckEscapeChars - input: " << input
<< " output: " << result << " expected: " << output << " output: " << result << " expected: " << output
<< kwsys_ios::endl; << std::endl;
return false; return false;
} }
return true; return true;
@ -109,75 +108,75 @@ static bool CheckEscapeChars(kwsys_stl::string input,
static bool CheckFileOperations() static bool CheckFileOperations()
{ {
bool res = true; bool res = true;
const kwsys_stl::string testNonExistingFile(TEST_SYSTEMTOOLS_SOURCE_DIR const std::string testNonExistingFile(TEST_SYSTEMTOOLS_SOURCE_DIR
"/testSystemToolsNonExistingFile"); "/testSystemToolsNonExistingFile");
const kwsys_stl::string testDotFile(TEST_SYSTEMTOOLS_SOURCE_DIR const std::string testDotFile(TEST_SYSTEMTOOLS_SOURCE_DIR
"/."); "/.");
const kwsys_stl::string testBinFile(TEST_SYSTEMTOOLS_SOURCE_DIR const std::string testBinFile(TEST_SYSTEMTOOLS_SOURCE_DIR
"/testSystemTools.bin"); "/testSystemTools.bin");
const kwsys_stl::string testTxtFile(TEST_SYSTEMTOOLS_SOURCE_DIR const std::string testTxtFile(TEST_SYSTEMTOOLS_SOURCE_DIR
"/testSystemTools.cxx"); "/testSystemTools.cxx");
const kwsys_stl::string testNewDir(TEST_SYSTEMTOOLS_BINARY_DIR const std::string testNewDir(TEST_SYSTEMTOOLS_BINARY_DIR
"/testSystemToolsNewDir"); "/testSystemToolsNewDir");
const kwsys_stl::string testNewFile(testNewDir + "/testNewFile.txt"); const std::string testNewFile(testNewDir + "/testNewFile.txt");
if (kwsys::SystemTools::DetectFileType(testNonExistingFile.c_str()) != if (kwsys::SystemTools::DetectFileType(testNonExistingFile.c_str()) !=
kwsys::SystemTools::FileTypeUnknown) kwsys::SystemTools::FileTypeUnknown)
{ {
kwsys_ios::cerr std::cerr
<< "Problem with DetectFileType - failed to detect type of: " << "Problem with DetectFileType - failed to detect type of: "
<< testNonExistingFile << kwsys_ios::endl; << testNonExistingFile << std::endl;
res = false; res = false;
} }
if (kwsys::SystemTools::DetectFileType(testDotFile.c_str()) != if (kwsys::SystemTools::DetectFileType(testDotFile.c_str()) !=
kwsys::SystemTools::FileTypeUnknown) kwsys::SystemTools::FileTypeUnknown)
{ {
kwsys_ios::cerr std::cerr
<< "Problem with DetectFileType - failed to detect type of: " << "Problem with DetectFileType - failed to detect type of: "
<< testDotFile << kwsys_ios::endl; << testDotFile << std::endl;
res = false; res = false;
} }
if (kwsys::SystemTools::DetectFileType(testBinFile.c_str()) != if (kwsys::SystemTools::DetectFileType(testBinFile.c_str()) !=
kwsys::SystemTools::FileTypeBinary) kwsys::SystemTools::FileTypeBinary)
{ {
kwsys_ios::cerr std::cerr
<< "Problem with DetectFileType - failed to detect type of: " << "Problem with DetectFileType - failed to detect type of: "
<< testBinFile << kwsys_ios::endl; << testBinFile << std::endl;
res = false; res = false;
} }
if (kwsys::SystemTools::DetectFileType(testTxtFile.c_str()) != if (kwsys::SystemTools::DetectFileType(testTxtFile.c_str()) !=
kwsys::SystemTools::FileTypeText) kwsys::SystemTools::FileTypeText)
{ {
kwsys_ios::cerr std::cerr
<< "Problem with DetectFileType - failed to detect type of: " << "Problem with DetectFileType - failed to detect type of: "
<< testTxtFile << kwsys_ios::endl; << testTxtFile << std::endl;
res = false; res = false;
} }
if (kwsys::SystemTools::FileLength(testBinFile) != 766) if (kwsys::SystemTools::FileLength(testBinFile) != 766)
{ {
kwsys_ios::cerr std::cerr
<< "Problem with FileLength - incorrect length for: " << "Problem with FileLength - incorrect length for: "
<< testBinFile << kwsys_ios::endl; << testBinFile << std::endl;
res = false; res = false;
} }
if (!kwsys::SystemTools::MakeDirectory(testNewDir)) if (!kwsys::SystemTools::MakeDirectory(testNewDir))
{ {
kwsys_ios::cerr std::cerr
<< "Problem with MakeDirectory for: " << "Problem with MakeDirectory for: "
<< testNewDir << kwsys_ios::endl; << testNewDir << std::endl;
res = false; res = false;
} }
if (!kwsys::SystemTools::Touch(testNewFile.c_str(), true)) if (!kwsys::SystemTools::Touch(testNewFile.c_str(), true))
{ {
kwsys_ios::cerr std::cerr
<< "Problem with Touch for: " << "Problem with Touch for: "
<< testNewFile << kwsys_ios::endl; << testNewFile << std::endl;
res = false; res = false;
} }
@ -195,34 +194,34 @@ static bool CheckFileOperations()
mode_t origPerm, thisPerm; mode_t origPerm, thisPerm;
if (!kwsys::SystemTools::GetPermissions(testNewFile, origPerm)) if (!kwsys::SystemTools::GetPermissions(testNewFile, origPerm))
{ {
kwsys_ios::cerr std::cerr
<< "Problem with GetPermissions (1) for: " << "Problem with GetPermissions (1) for: "
<< testNewFile << kwsys_ios::endl; << testNewFile << std::endl;
res = false; res = false;
} }
if (!kwsys::SystemTools::SetPermissions(testNewFile, 0)) if (!kwsys::SystemTools::SetPermissions(testNewFile, 0))
{ {
kwsys_ios::cerr std::cerr
<< "Problem with SetPermissions (1) for: " << "Problem with SetPermissions (1) for: "
<< testNewFile << kwsys_ios::endl; << testNewFile << std::endl;
res = false; res = false;
} }
if (!kwsys::SystemTools::GetPermissions(testNewFile, thisPerm)) if (!kwsys::SystemTools::GetPermissions(testNewFile, thisPerm))
{ {
kwsys_ios::cerr std::cerr
<< "Problem with GetPermissions (2) for: " << "Problem with GetPermissions (2) for: "
<< testNewFile << kwsys_ios::endl; << testNewFile << std::endl;
res = false; res = false;
} }
if ((thisPerm & fullMask) != 0) if ((thisPerm & fullMask) != 0)
{ {
kwsys_ios::cerr std::cerr
<< "SetPermissions failed to set permissions (1) for: " << "SetPermissions failed to set permissions (1) for: "
<< testNewFile << ": actual = " << thisPerm << "; expected = " << testNewFile << ": actual = " << thisPerm << "; expected = "
<< 0 << kwsys_ios::endl; << 0 << std::endl;
res = false; res = false;
} }
@ -230,70 +229,70 @@ static bool CheckFileOperations()
if (kwsys::SystemTools::TestFileAccess(testNewFile, if (kwsys::SystemTools::TestFileAccess(testNewFile,
kwsys::TEST_FILE_WRITE)) kwsys::TEST_FILE_WRITE))
{ {
kwsys_ios::cerr std::cerr
<< "TestFileAccess incorrectly indicated that this is a writable file:" << "TestFileAccess incorrectly indicated that this is a writable file:"
<< testNewFile << kwsys_ios::endl; << testNewFile << std::endl;
res = false; res = false;
} }
if (!kwsys::SystemTools::TestFileAccess(testNewFile, if (!kwsys::SystemTools::TestFileAccess(testNewFile,
kwsys::TEST_FILE_OK)) kwsys::TEST_FILE_OK))
{ {
kwsys_ios::cerr std::cerr
<< "TestFileAccess incorrectly indicated that this file does not exist:" << "TestFileAccess incorrectly indicated that this file does not exist:"
<< testNewFile << kwsys_ios::endl; << testNewFile << std::endl;
res = false; res = false;
} }
// Test restoring/setting full permissions. // Test restoring/setting full permissions.
if (!kwsys::SystemTools::SetPermissions(testNewFile, fullMask)) if (!kwsys::SystemTools::SetPermissions(testNewFile, fullMask))
{ {
kwsys_ios::cerr std::cerr
<< "Problem with SetPermissions (2) for: " << "Problem with SetPermissions (2) for: "
<< testNewFile << kwsys_ios::endl; << testNewFile << std::endl;
res = false; res = false;
} }
if (!kwsys::SystemTools::GetPermissions(testNewFile, thisPerm)) if (!kwsys::SystemTools::GetPermissions(testNewFile, thisPerm))
{ {
kwsys_ios::cerr std::cerr
<< "Problem with GetPermissions (3) for: " << "Problem with GetPermissions (3) for: "
<< testNewFile << kwsys_ios::endl; << testNewFile << std::endl;
res = false; res = false;
} }
if ((thisPerm & fullMask) != fullMask) if ((thisPerm & fullMask) != fullMask)
{ {
kwsys_ios::cerr std::cerr
<< "SetPermissions failed to set permissions (2) for: " << "SetPermissions failed to set permissions (2) for: "
<< testNewFile << ": actual = " << thisPerm << "; expected = " << testNewFile << ": actual = " << thisPerm << "; expected = "
<< fullMask << kwsys_ios::endl; << fullMask << std::endl;
res = false; res = false;
} }
// Test setting file permissions while honoring umask // Test setting file permissions while honoring umask
if (!kwsys::SystemTools::SetPermissions(testNewFile, fullMask, true)) if (!kwsys::SystemTools::SetPermissions(testNewFile, fullMask, true))
{ {
kwsys_ios::cerr std::cerr
<< "Problem with SetPermissions (3) for: " << "Problem with SetPermissions (3) for: "
<< testNewFile << kwsys_ios::endl; << testNewFile << std::endl;
res = false; res = false;
} }
if (!kwsys::SystemTools::GetPermissions(testNewFile, thisPerm)) if (!kwsys::SystemTools::GetPermissions(testNewFile, thisPerm))
{ {
kwsys_ios::cerr std::cerr
<< "Problem with GetPermissions (4) for: " << "Problem with GetPermissions (4) for: "
<< testNewFile << kwsys_ios::endl; << testNewFile << std::endl;
res = false; res = false;
} }
if ((thisPerm & fullMask) != 0) if ((thisPerm & fullMask) != 0)
{ {
kwsys_ios::cerr std::cerr
<< "SetPermissions failed to honor umask for: " << "SetPermissions failed to honor umask for: "
<< testNewFile << ": actual = " << thisPerm << "; expected = " << testNewFile << ": actual = " << thisPerm << "; expected = "
<< 0 << kwsys_ios::endl; << 0 << std::endl;
res = false; res = false;
} }
@ -303,35 +302,35 @@ static bool CheckFileOperations()
// Restore file permissions // Restore file permissions
if (!kwsys::SystemTools::SetPermissions(testNewFile, origPerm)) if (!kwsys::SystemTools::SetPermissions(testNewFile, origPerm))
{ {
kwsys_ios::cerr std::cerr
<< "Problem with SetPermissions (4) for: " << "Problem with SetPermissions (4) for: "
<< testNewFile << kwsys_ios::endl; << testNewFile << std::endl;
res = false; res = false;
} }
// Remove the test file // Remove the test file
if (!kwsys::SystemTools::RemoveFile(testNewFile)) if (!kwsys::SystemTools::RemoveFile(testNewFile))
{ {
kwsys_ios::cerr std::cerr
<< "Problem with RemoveFile: " << "Problem with RemoveFile: "
<< testNewFile << kwsys_ios::endl; << testNewFile << std::endl;
res = false; res = false;
} }
kwsys_stl::string const testFileMissing(testNewDir + "/testMissingFile.txt"); std::string const testFileMissing(testNewDir + "/testMissingFile.txt");
if (!kwsys::SystemTools::RemoveFile(testFileMissing)) if (!kwsys::SystemTools::RemoveFile(testFileMissing))
{ {
std::string const& msg = kwsys::SystemTools::GetLastSystemError(); std::string const& msg = kwsys::SystemTools::GetLastSystemError();
kwsys_ios::cerr << std::cerr <<
"RemoveFile(\"" << testFileMissing << "\") failed: " << msg << "\n"; "RemoveFile(\"" << testFileMissing << "\") failed: " << msg << "\n";
res = false; res = false;
} }
kwsys_stl::string const testFileMissingDir(testNewDir + "/missing/file.txt"); std::string const testFileMissingDir(testNewDir + "/missing/file.txt");
if (!kwsys::SystemTools::RemoveFile(testFileMissingDir)) if (!kwsys::SystemTools::RemoveFile(testFileMissingDir))
{ {
std::string const& msg = kwsys::SystemTools::GetLastSystemError(); std::string const& msg = kwsys::SystemTools::GetLastSystemError();
kwsys_ios::cerr << std::cerr <<
"RemoveFile(\"" << testFileMissingDir << "\") failed: " << msg << "\n"; "RemoveFile(\"" << testFileMissingDir << "\") failed: " << msg << "\n";
res = false; res = false;
} }
@ -339,9 +338,9 @@ static bool CheckFileOperations()
kwsys::SystemTools::Touch(testNewFile.c_str(), true); kwsys::SystemTools::Touch(testNewFile.c_str(), true);
if (!kwsys::SystemTools::RemoveADirectory(testNewDir)) if (!kwsys::SystemTools::RemoveADirectory(testNewDir))
{ {
kwsys_ios::cerr std::cerr
<< "Problem with RemoveADirectory for: " << "Problem with RemoveADirectory for: "
<< testNewDir << kwsys_ios::endl; << testNewDir << std::endl;
res = false; res = false;
} }
@ -349,14 +348,14 @@ static bool CheckFileOperations()
// Perform the same file and directory creation and deletion tests but // Perform the same file and directory creation and deletion tests but
// with paths > 256 characters in length. // with paths > 256 characters in length.
const kwsys_stl::string testNewLongDir( const std::string testNewLongDir(
TEST_SYSTEMTOOLS_BINARY_DIR "/" TEST_SYSTEMTOOLS_BINARY_DIR "/"
"012345678901234567890123456789012345678901234567890123456789" "012345678901234567890123456789012345678901234567890123456789"
"012345678901234567890123456789012345678901234567890123456789" "012345678901234567890123456789012345678901234567890123456789"
"012345678901234567890123456789012345678901234567890123456789" "012345678901234567890123456789012345678901234567890123456789"
"012345678901234567890123456789012345678901234567890123456789" "012345678901234567890123456789012345678901234567890123456789"
"01234567890123"); "01234567890123");
const kwsys_stl::string testNewLongFile(testNewLongDir + "/" const std::string testNewLongFile(testNewLongDir + "/"
"012345678901234567890123456789012345678901234567890123456789" "012345678901234567890123456789012345678901234567890123456789"
"012345678901234567890123456789012345678901234567890123456789" "012345678901234567890123456789012345678901234567890123456789"
"012345678901234567890123456789012345678901234567890123456789" "012345678901234567890123456789012345678901234567890123456789"
@ -365,34 +364,34 @@ static bool CheckFileOperations()
if (!kwsys::SystemTools::MakeDirectory(testNewLongDir)) if (!kwsys::SystemTools::MakeDirectory(testNewLongDir))
{ {
kwsys_ios::cerr std::cerr
<< "Problem with MakeDirectory for: " << "Problem with MakeDirectory for: "
<< testNewLongDir << kwsys_ios::endl; << testNewLongDir << std::endl;
res = false; res = false;
} }
if (!kwsys::SystemTools::Touch(testNewLongFile.c_str(), true)) if (!kwsys::SystemTools::Touch(testNewLongFile.c_str(), true))
{ {
kwsys_ios::cerr std::cerr
<< "Problem with Touch for: " << "Problem with Touch for: "
<< testNewLongFile << kwsys_ios::endl; << testNewLongFile << std::endl;
res = false; res = false;
} }
if (!kwsys::SystemTools::RemoveFile(testNewLongFile)) if (!kwsys::SystemTools::RemoveFile(testNewLongFile))
{ {
kwsys_ios::cerr std::cerr
<< "Problem with RemoveFile: " << "Problem with RemoveFile: "
<< testNewLongFile << kwsys_ios::endl; << testNewLongFile << std::endl;
res = false; res = false;
} }
kwsys::SystemTools::Touch(testNewLongFile.c_str(), true); kwsys::SystemTools::Touch(testNewLongFile.c_str(), true);
if (!kwsys::SystemTools::RemoveADirectory(testNewLongDir)) if (!kwsys::SystemTools::RemoveADirectory(testNewLongDir))
{ {
kwsys_ios::cerr std::cerr
<< "Problem with RemoveADirectory for: " << "Problem with RemoveADirectory for: "
<< testNewLongDir << kwsys_ios::endl; << testNewLongDir << std::endl;
res = false; res = false;
} }
#endif #endif
@ -405,12 +404,12 @@ static bool CheckStringOperations()
{ {
bool res = true; bool res = true;
kwsys_stl::string test = "mary had a little lamb."; std::string test = "mary had a little lamb.";
if (kwsys::SystemTools::CapitalizedWords(test) != "Mary Had A Little Lamb.") if (kwsys::SystemTools::CapitalizedWords(test) != "Mary Had A Little Lamb.")
{ {
kwsys_ios::cerr std::cerr
<< "Problem with CapitalizedWords " << "Problem with CapitalizedWords "
<< '"' << test << '"' << kwsys_ios::endl; << '"' << test << '"' << std::endl;
res = false; res = false;
} }
@ -418,9 +417,9 @@ static bool CheckStringOperations()
if (kwsys::SystemTools::UnCapitalizedWords(test) != if (kwsys::SystemTools::UnCapitalizedWords(test) !=
"mary had a little lamb.") "mary had a little lamb.")
{ {
kwsys_ios::cerr std::cerr
<< "Problem with UnCapitalizedWords " << "Problem with UnCapitalizedWords "
<< '"' << test << '"' << kwsys_ios::endl; << '"' << test << '"' << std::endl;
res = false; res = false;
} }
@ -428,9 +427,9 @@ static bool CheckStringOperations()
if (kwsys::SystemTools::AddSpaceBetweenCapitalizedWords(test) != if (kwsys::SystemTools::AddSpaceBetweenCapitalizedWords(test) !=
"Mary Had The Little Lamb.") "Mary Had The Little Lamb.")
{ {
kwsys_ios::cerr std::cerr
<< "Problem with AddSpaceBetweenCapitalizedWords " << "Problem with AddSpaceBetweenCapitalizedWords "
<< '"' << test << '"' << kwsys_ios::endl; << '"' << test << '"' << std::endl;
res = false; res = false;
} }
@ -438,9 +437,9 @@ static bool CheckStringOperations()
kwsys::SystemTools::AppendStrings("Mary Had A"," Little Lamb."); kwsys::SystemTools::AppendStrings("Mary Had A"," Little Lamb.");
if (strcmp(cres,"Mary Had A Little Lamb.")) if (strcmp(cres,"Mary Had A Little Lamb."))
{ {
kwsys_ios::cerr std::cerr
<< "Problem with AppendStrings " << "Problem with AppendStrings "
<< "\"Mary Had A\" \" Little Lamb.\"" << kwsys_ios::endl; << "\"Mary Had A\" \" Little Lamb.\"" << std::endl;
res = false; res = false;
} }
delete [] cres; delete [] cres;
@ -449,18 +448,18 @@ static bool CheckStringOperations()
kwsys::SystemTools::AppendStrings("Mary Had"," A ","Little Lamb."); kwsys::SystemTools::AppendStrings("Mary Had"," A ","Little Lamb.");
if (strcmp(cres,"Mary Had A Little Lamb.")) if (strcmp(cres,"Mary Had A Little Lamb."))
{ {
kwsys_ios::cerr std::cerr
<< "Problem with AppendStrings " << "Problem with AppendStrings "
<< "\"Mary Had\" \" A \" \"Little Lamb.\"" << kwsys_ios::endl; << "\"Mary Had\" \" A \" \"Little Lamb.\"" << std::endl;
res = false; res = false;
} }
delete [] cres; delete [] cres;
if (kwsys::SystemTools::CountChar("Mary Had A Little Lamb.",'a') != 3) if (kwsys::SystemTools::CountChar("Mary Had A Little Lamb.",'a') != 3)
{ {
kwsys_ios::cerr std::cerr
<< "Problem with CountChar " << "Problem with CountChar "
<< "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl; << "\"Mary Had A Little Lamb.\"" << std::endl;
res = false; res = false;
} }
@ -468,9 +467,9 @@ static bool CheckStringOperations()
kwsys::SystemTools::RemoveChars("Mary Had A Little Lamb.","aeiou"); kwsys::SystemTools::RemoveChars("Mary Had A Little Lamb.","aeiou");
if (strcmp(cres,"Mry Hd A Lttl Lmb.")) if (strcmp(cres,"Mry Hd A Lttl Lmb."))
{ {
kwsys_ios::cerr std::cerr
<< "Problem with RemoveChars " << "Problem with RemoveChars "
<< "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl; << "\"Mary Had A Little Lamb.\"" << std::endl;
res = false; res = false;
} }
delete [] cres; delete [] cres;
@ -479,9 +478,9 @@ static bool CheckStringOperations()
kwsys::SystemTools::RemoveCharsButUpperHex("Mary Had A Little Lamb."); kwsys::SystemTools::RemoveCharsButUpperHex("Mary Had A Little Lamb.");
if (strcmp(cres,"A")) if (strcmp(cres,"A"))
{ {
kwsys_ios::cerr std::cerr
<< "Problem with RemoveCharsButUpperHex " << "Problem with RemoveCharsButUpperHex "
<< "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl; << "\"Mary Had A Little Lamb.\"" << std::endl;
res = false; res = false;
} }
delete [] cres; delete [] cres;
@ -491,9 +490,9 @@ static bool CheckStringOperations()
kwsys::SystemTools::ReplaceChars(cres2,"aeiou",'X'); kwsys::SystemTools::ReplaceChars(cres2,"aeiou",'X');
if (strcmp(cres2,"MXry HXd A LXttlX LXmb.")) if (strcmp(cres2,"MXry HXd A LXttlX LXmb."))
{ {
kwsys_ios::cerr std::cerr
<< "Problem with ReplaceChars " << "Problem with ReplaceChars "
<< "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl; << "\"Mary Had A Little Lamb.\"" << std::endl;
res = false; res = false;
} }
delete [] cres2; delete [] cres2;
@ -501,27 +500,27 @@ static bool CheckStringOperations()
if (!kwsys::SystemTools::StringStartsWith("Mary Had A Little Lamb.", if (!kwsys::SystemTools::StringStartsWith("Mary Had A Little Lamb.",
"Mary ")) "Mary "))
{ {
kwsys_ios::cerr std::cerr
<< "Problem with StringStartsWith " << "Problem with StringStartsWith "
<< "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl; << "\"Mary Had A Little Lamb.\"" << std::endl;
res = false; res = false;
} }
if (!kwsys::SystemTools::StringEndsWith("Mary Had A Little Lamb.", if (!kwsys::SystemTools::StringEndsWith("Mary Had A Little Lamb.",
" Lamb.")) " Lamb."))
{ {
kwsys_ios::cerr std::cerr
<< "Problem with StringEndsWith " << "Problem with StringEndsWith "
<< "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl; << "\"Mary Had A Little Lamb.\"" << std::endl;
res = false; res = false;
} }
cres = kwsys::SystemTools::DuplicateString("Mary Had A Little Lamb."); cres = kwsys::SystemTools::DuplicateString("Mary Had A Little Lamb.");
if (strcmp(cres,"Mary Had A Little Lamb.")) if (strcmp(cres,"Mary Had A Little Lamb."))
{ {
kwsys_ios::cerr std::cerr
<< "Problem with DuplicateString " << "Problem with DuplicateString "
<< "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl; << "\"Mary Had A Little Lamb.\"" << std::endl;
res = false; res = false;
} }
delete [] cres; delete [] cres;
@ -530,20 +529,20 @@ static bool CheckStringOperations()
if (kwsys::SystemTools::CropString(test,13) != if (kwsys::SystemTools::CropString(test,13) !=
"Mary ...Lamb.") "Mary ...Lamb.")
{ {
kwsys_ios::cerr std::cerr
<< "Problem with CropString " << "Problem with CropString "
<< "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl; << "\"Mary Had A Little Lamb.\"" << std::endl;
res = false; res = false;
} }
kwsys_stl::vector<kwsys_stl::string> lines; std::vector<std::string> lines;
kwsys::SystemTools::Split("Mary Had A Little Lamb.",lines,' '); kwsys::SystemTools::Split("Mary Had A Little Lamb.",lines,' ');
if (lines[0] != "Mary" || lines[1] != "Had" || if (lines[0] != "Mary" || lines[1] != "Had" ||
lines[2] != "A" || lines[3] != "Little" || lines[4] != "Lamb.") lines[2] != "A" || lines[3] != "Little" || lines[4] != "Lamb.")
{ {
kwsys_ios::cerr std::cerr
<< "Problem with Split " << "Problem with Split "
<< "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl; << "\"Mary Had A Little Lamb.\"" << std::endl;
res = false; res = false;
} }
@ -552,10 +551,10 @@ static bool CheckStringOperations()
("L:\\Local Mojo\\Hex Power Pack\\Iffy Voodoo") != ("L:\\Local Mojo\\Hex Power Pack\\Iffy Voodoo") !=
L"\\\\?\\L:\\Local Mojo\\Hex Power Pack\\Iffy Voodoo") L"\\\\?\\L:\\Local Mojo\\Hex Power Pack\\Iffy Voodoo")
{ {
kwsys_ios::cerr std::cerr
<< "Problem with ConvertToWindowsExtendedPath " << "Problem with ConvertToWindowsExtendedPath "
<< "\"L:\\Local Mojo\\Hex Power Pack\\Iffy Voodoo\"" << "\"L:\\Local Mojo\\Hex Power Pack\\Iffy Voodoo\""
<< kwsys_ios::endl; << std::endl;
res = false; res = false;
} }
@ -563,10 +562,10 @@ static bool CheckStringOperations()
("L:/Local Mojo/Hex Power Pack/Iffy Voodoo") != ("L:/Local Mojo/Hex Power Pack/Iffy Voodoo") !=
L"\\\\?\\L:\\Local Mojo\\Hex Power Pack\\Iffy Voodoo") L"\\\\?\\L:\\Local Mojo\\Hex Power Pack\\Iffy Voodoo")
{ {
kwsys_ios::cerr std::cerr
<< "Problem with ConvertToWindowsExtendedPath " << "Problem with ConvertToWindowsExtendedPath "
<< "\"L:/Local Mojo/Hex Power Pack/Iffy Voodoo\"" << "\"L:/Local Mojo/Hex Power Pack/Iffy Voodoo\""
<< kwsys_ios::endl; << std::endl;
res = false; res = false;
} }
@ -574,10 +573,10 @@ static bool CheckStringOperations()
("\\\\Foo\\Local Mojo\\Hex Power Pack\\Iffy Voodoo") != ("\\\\Foo\\Local Mojo\\Hex Power Pack\\Iffy Voodoo") !=
L"\\\\?\\UNC\\Foo\\Local Mojo\\Hex Power Pack\\Iffy Voodoo") L"\\\\?\\UNC\\Foo\\Local Mojo\\Hex Power Pack\\Iffy Voodoo")
{ {
kwsys_ios::cerr std::cerr
<< "Problem with ConvertToWindowsExtendedPath " << "Problem with ConvertToWindowsExtendedPath "
<< "\"\\\\Foo\\Local Mojo\\Hex Power Pack\\Iffy Voodoo\"" << "\"\\\\Foo\\Local Mojo\\Hex Power Pack\\Iffy Voodoo\""
<< kwsys_ios::endl; << std::endl;
res = false; res = false;
} }
@ -585,70 +584,70 @@ static bool CheckStringOperations()
("//Foo/Local Mojo/Hex Power Pack/Iffy Voodoo") != ("//Foo/Local Mojo/Hex Power Pack/Iffy Voodoo") !=
L"\\\\?\\UNC\\Foo\\Local Mojo\\Hex Power Pack\\Iffy Voodoo") L"\\\\?\\UNC\\Foo\\Local Mojo\\Hex Power Pack\\Iffy Voodoo")
{ {
kwsys_ios::cerr std::cerr
<< "Problem with ConvertToWindowsExtendedPath " << "Problem with ConvertToWindowsExtendedPath "
<< "\"//Foo/Local Mojo/Hex Power Pack/Iffy Voodoo\"" << "\"//Foo/Local Mojo/Hex Power Pack/Iffy Voodoo\""
<< kwsys_ios::endl; << std::endl;
res = false; res = false;
} }
if (kwsys::SystemTools::ConvertToWindowsExtendedPath("//") != if (kwsys::SystemTools::ConvertToWindowsExtendedPath("//") !=
L"//") L"//")
{ {
kwsys_ios::cerr std::cerr
<< "Problem with ConvertToWindowsExtendedPath " << "Problem with ConvertToWindowsExtendedPath "
<< "\"//\"" << "\"//\""
<< kwsys_ios::endl; << std::endl;
res = false; res = false;
} }
if (kwsys::SystemTools::ConvertToWindowsExtendedPath("\\\\.\\") != if (kwsys::SystemTools::ConvertToWindowsExtendedPath("\\\\.\\") !=
L"\\\\.\\") L"\\\\.\\")
{ {
kwsys_ios::cerr std::cerr
<< "Problem with ConvertToWindowsExtendedPath " << "Problem with ConvertToWindowsExtendedPath "
<< "\"\\\\.\\\"" << "\"\\\\.\\\""
<< kwsys_ios::endl; << std::endl;
res = false; res = false;
} }
if (kwsys::SystemTools::ConvertToWindowsExtendedPath("\\\\.\\X") != if (kwsys::SystemTools::ConvertToWindowsExtendedPath("\\\\.\\X") !=
L"\\\\.\\X") L"\\\\.\\X")
{ {
kwsys_ios::cerr std::cerr
<< "Problem with ConvertToWindowsExtendedPath " << "Problem with ConvertToWindowsExtendedPath "
<< "\"\\\\.\\X\"" << "\"\\\\.\\X\""
<< kwsys_ios::endl; << std::endl;
res = false; res = false;
} }
if (kwsys::SystemTools::ConvertToWindowsExtendedPath("\\\\.\\X:") != if (kwsys::SystemTools::ConvertToWindowsExtendedPath("\\\\.\\X:") !=
L"\\\\?\\X:") L"\\\\?\\X:")
{ {
kwsys_ios::cerr std::cerr
<< "Problem with ConvertToWindowsExtendedPath " << "Problem with ConvertToWindowsExtendedPath "
<< "\"\\\\.\\X:\"" << "\"\\\\.\\X:\""
<< kwsys_ios::endl; << std::endl;
res = false; res = false;
} }
if (kwsys::SystemTools::ConvertToWindowsExtendedPath("\\\\.\\X:\\") != if (kwsys::SystemTools::ConvertToWindowsExtendedPath("\\\\.\\X:\\") !=
L"\\\\?\\X:\\") L"\\\\?\\X:\\")
{ {
kwsys_ios::cerr std::cerr
<< "Problem with ConvertToWindowsExtendedPath " << "Problem with ConvertToWindowsExtendedPath "
<< "\"\\\\.\\X:\\\"" << "\"\\\\.\\X:\\\""
<< kwsys_ios::endl; << std::endl;
res = false; res = false;
} }
if (kwsys::SystemTools::ConvertToWindowsExtendedPath("NUL") != if (kwsys::SystemTools::ConvertToWindowsExtendedPath("NUL") !=
L"\\\\.\\NUL") L"\\\\.\\NUL")
{ {
kwsys_ios::cerr std::cerr
<< "Problem with ConvertToWindowsExtendedPath " << "Problem with ConvertToWindowsExtendedPath "
<< "\"NUL\"" << "\"NUL\""
<< kwsys_ios::endl; << std::endl;
res = false; res = false;
} }
@ -658,10 +657,10 @@ static bool CheckStringOperations()
("L://Local Mojo/Hex Power Pack/Iffy Voodoo") != ("L://Local Mojo/Hex Power Pack/Iffy Voodoo") !=
"\"L:\\Local Mojo\\Hex Power Pack\\Iffy Voodoo\"") "\"L:\\Local Mojo\\Hex Power Pack\\Iffy Voodoo\"")
{ {
kwsys_ios::cerr std::cerr
<< "Problem with ConvertToWindowsOutputPath " << "Problem with ConvertToWindowsOutputPath "
<< "\"L://Local Mojo/Hex Power Pack/Iffy Voodoo\"" << "\"L://Local Mojo/Hex Power Pack/Iffy Voodoo\""
<< kwsys_ios::endl; << std::endl;
res = false; res = false;
} }
@ -669,10 +668,10 @@ static bool CheckStringOperations()
("//grayson/Local Mojo/Hex Power Pack/Iffy Voodoo") != ("//grayson/Local Mojo/Hex Power Pack/Iffy Voodoo") !=
"\"\\\\grayson\\Local Mojo\\Hex Power Pack\\Iffy Voodoo\"") "\"\\\\grayson\\Local Mojo\\Hex Power Pack\\Iffy Voodoo\"")
{ {
kwsys_ios::cerr std::cerr
<< "Problem with ConvertToWindowsOutputPath " << "Problem with ConvertToWindowsOutputPath "
<< "\"//grayson/Local Mojo/Hex Power Pack/Iffy Voodoo\"" << "\"//grayson/Local Mojo/Hex Power Pack/Iffy Voodoo\""
<< kwsys_ios::endl; << std::endl;
res = false; res = false;
} }
@ -680,10 +679,10 @@ static bool CheckStringOperations()
("//Local Mojo/Hex Power Pack/Iffy Voodoo") != ("//Local Mojo/Hex Power Pack/Iffy Voodoo") !=
"//Local\\ Mojo/Hex\\ Power\\ Pack/Iffy\\ Voodoo") "//Local\\ Mojo/Hex\\ Power\\ Pack/Iffy\\ Voodoo")
{ {
kwsys_ios::cerr std::cerr
<< "Problem with ConvertToUnixOutputPath " << "Problem with ConvertToUnixOutputPath "
<< "\"//Local Mojo/Hex Power Pack/Iffy Voodoo\"" << "\"//Local Mojo/Hex Power Pack/Iffy Voodoo\""
<< kwsys_ios::endl; << std::endl;
res = false; res = false;
} }
@ -692,20 +691,20 @@ static bool CheckStringOperations()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static bool CheckPutEnv(const kwsys_stl::string& env, const char* name, const char* value) static bool CheckPutEnv(const std::string& env, const char* name, const char* value)
{ {
if(!kwsys::SystemTools::PutEnv(env)) if(!kwsys::SystemTools::PutEnv(env))
{ {
kwsys_ios::cerr << "PutEnv(\"" << env std::cerr << "PutEnv(\"" << env
<< "\") failed!" << kwsys_ios::endl; << "\") failed!" << std::endl;
return false; return false;
} }
const char* v = kwsys::SystemTools::GetEnv(name); const char* v = kwsys::SystemTools::GetEnv(name);
v = v? v : "(null)"; v = v? v : "(null)";
if(strcmp(v, value) != 0) if(strcmp(v, value) != 0)
{ {
kwsys_ios::cerr << "GetEnv(\"" << name << "\") returned \"" std::cerr << "GetEnv(\"" << name << "\") returned \""
<< v << "\", not \"" << value << "\"!" << kwsys_ios::endl; << v << "\", not \"" << value << "\"!" << std::endl;
return false; return false;
} }
return true; return true;
@ -715,14 +714,14 @@ static bool CheckUnPutEnv(const char* env, const char* name)
{ {
if(!kwsys::SystemTools::UnPutEnv(env)) if(!kwsys::SystemTools::UnPutEnv(env))
{ {
kwsys_ios::cerr << "UnPutEnv(\"" << env << "\") failed!" std::cerr << "UnPutEnv(\"" << env << "\") failed!"
<< kwsys_ios::endl; << std::endl;
return false; return false;
} }
if(const char* v = kwsys::SystemTools::GetEnv(name)) if(const char* v = kwsys::SystemTools::GetEnv(name))
{ {
kwsys_ios::cerr << "GetEnv(\"" << name << "\") returned \"" std::cerr << "GetEnv(\"" << name << "\") returned \""
<< v << "\", not (null)!" << kwsys_ios::endl; << v << "\", not (null)!" << std::endl;
return false; return false;
} }
return true; return true;
@ -744,15 +743,15 @@ static bool CheckEnvironmentOperations()
static bool CheckRelativePath( static bool CheckRelativePath(
const kwsys_stl::string& local, const std::string& local,
const kwsys_stl::string& remote, const std::string& remote,
const kwsys_stl::string& expected) const std::string& expected)
{ {
kwsys_stl::string result = kwsys::SystemTools::RelativePath(local, remote); std::string result = kwsys::SystemTools::RelativePath(local, remote);
if(expected != result) if(expected != result)
{ {
kwsys_ios::cerr << "RelativePath(" << local << ", " << remote std::cerr << "RelativePath(" << local << ", " << remote
<< ") yielded " << result << " instead of " << expected << kwsys_ios::endl; << ") yielded " << result << " instead of " << expected << std::endl;
return false; return false;
} }
return true; return true;
@ -770,14 +769,14 @@ static bool CheckRelativePaths()
} }
static bool CheckCollapsePath( static bool CheckCollapsePath(
const kwsys_stl::string& path, const std::string& path,
const kwsys_stl::string& expected) const std::string& expected)
{ {
kwsys_stl::string result = kwsys::SystemTools::CollapseFullPath(path); std::string result = kwsys::SystemTools::CollapseFullPath(path);
if(expected != result) if(expected != result)
{ {
kwsys_ios::cerr << "CollapseFullPath(" << path std::cerr << "CollapseFullPath(" << path
<< ") yielded " << result << " instead of " << expected << kwsys_ios::endl; << ") yielded " << result << " instead of " << expected << std::endl;
return false; return false;
} }
return true; return true;
@ -803,7 +802,7 @@ int testSystemTools(int, char*[])
} }
// Special check for ~ // Special check for ~
kwsys_stl::string output; std::string output;
if(kwsys::SystemTools::GetEnv("HOME", output)) if(kwsys::SystemTools::GetEnv("HOME", output))
{ {
output += "/foo bar/lala"; output += "/foo bar/lala";