From 1b79433a6d7cdd1da1a0af74240f2299c78e4112 Mon Sep 17 00:00:00 2001 From: KWSys Robot Date: Fri, 28 Aug 2015 14:50:49 -0400 Subject: KWSys 2015-08-28 (dc3fdd7f) Extract upstream KWSys using the following shell commands. $ git archive --prefix=upstream-kwsys/ dc3fdd7f | tar x $ git shortlog --no-merges --abbrev=8 --format='%h %s' cdaf522c..dc3fdd7f Brad King (9): 15a16826 Remove include and kwsys_ios:: compatibility layer a5799c17 Remove unused KWSYS_IOS_USE_{SSTREAM,STRSTREAM_H,STRSTREA_H} checks 198957cf Remove unused KWSYS_IOS_USE_SSTREAM check 24d2b60e Remove support for pre-C++98 streams 2a581c30 Remove support for pre-C++98 std::string missing operators 5f3fd465 Remove support for pre-C++98 STL cded1574 Remove support for pre-C++98 STL from hash_map and hash_set f130a3ab Remove kwsys/cstddef compatibility header dc3fdd7f Remove support for pre-C++98 template capabilities --- CMakeLists.txt | 190 ---------- CommandLineArguments.cxx | 103 +++--- CommandLineArguments.hxx.in | 56 ++- Configure.hxx.in | 144 -------- Directory.cxx | 21 +- Directory.hxx.in | 16 +- DynamicLoader.cxx | 28 +- DynamicLoader.hxx.in | 18 +- Encoding.hxx.in | 22 +- EncodingCXX.cxx | 16 +- FStream.hxx.in | 6 +- Glob.cxx | 93 +++-- Glob.hxx.in | 44 +-- IOStream.cxx | 88 ++--- IOStream.hxx.in | 32 +- RegularExpression.hxx.in | 60 ++- String.hxx.in | 10 +- SystemInformation.cxx | 344 +++++++++--------- SystemInformation.hxx.in | 35 +- SystemTools.cxx | 828 +++++++++++++++++++++--------------------- SystemTools.hxx.in | 325 ++++++++--------- hash_fun.hxx.in | 46 +-- hash_map.hxx.in | 124 +------ hash_set.hxx.in | 122 +------ hashtable.hxx.in | 387 +++----------------- kwsysPlatformTestsCXX.cxx | 274 +------------- kwsys_cstddef.hxx.in | 35 -- kwsys_ios_fstream.h.in | 46 --- kwsys_ios_iosfwd.h.in | 49 --- kwsys_ios_iostream.h.in | 99 ----- kwsys_ios_sstream.h.in | 199 ---------- kwsys_stl.hxx.in | 49 --- kwsys_stl_string.hxx.in | 123 ------- testCommandLineArguments.cxx | 70 ++-- testCommandLineArguments1.cxx | 34 +- testDynamicLoader.cxx | 27 +- testEncoding.cxx | 3 +- testFStream.cxx | 21 +- testHashSTL.cxx | 10 +- testIOS.cxx | 73 ++-- testSystemInformation.cxx | 22 +- testSystemTools.cxx | 305 ++++++++-------- 42 files changed, 1394 insertions(+), 3203 deletions(-) delete mode 100644 kwsys_cstddef.hxx.in delete mode 100644 kwsys_ios_fstream.h.in delete mode 100644 kwsys_ios_iosfwd.h.in delete mode 100644 kwsys_ios_iostream.h.in delete mode 100644 kwsys_ios_sstream.h.in delete mode 100644 kwsys_stl.hxx.in delete mode 100644 kwsys_stl_string.hxx.in diff --git a/CMakeLists.txt b/CMakeLists.txt index c1229ff..84010d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,15 +35,6 @@ # SET(KWSYS_HEADER_ROOT ${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: # # 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 # 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) KWSYS_PLATFORM_CXX_TEST(KWSYS_STAT_HAS_ST_MTIM "Checking whether struct stat has st_mtim member" DIRECT) @@ -558,9 +450,6 @@ ENDIF() IF(KWSYS_USE_IOStream) # 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) KWSYS_PLATFORM_CXX_TEST(KWSYS_IOS_HAS_ISTREAM_LONG_LONG "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_OSTREAM___INT64 0) ENDIF() - SET(KWSYS_PLATFORM_CXX_TEST_DEFINES) ENDIF() IF(KWSYS_NAMESPACE MATCHES "^kwsys$") @@ -832,84 +720,6 @@ IF(KWSYS_INSTALL_DOC_DIR) 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 # selected components. Initialize with required components. SET(KWSYS_CLASSES) diff --git a/CommandLineArguments.cxx b/CommandLineArguments.cxx index 9fa9802..3636836 100644 --- a/CommandLineArguments.cxx +++ b/CommandLineArguments.cxx @@ -15,22 +15,19 @@ #include KWSYS_HEADER(Configure.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 // duplicate the above list of headers. #if 0 # include "CommandLineArguments.hxx.in" # include "Configure.hxx.in" -# include "kwsys_stl.hxx.in" -# include "kwsys_ios_sstream.h.in" -# include "kwsys_ios_iostream.h.in" #endif +#include +#include +#include +#include +#include + #include #include #include @@ -45,7 +42,7 @@ #if 0 # define CommandLineArguments_DEBUG(x) \ - kwsys_ios::cout << __LINE__ << " CLA: " << x << kwsys_ios::endl + std::cout << __LINE__ << " CLA: " << x << std::endl #else # define CommandLineArguments_DEBUG(x) #endif @@ -67,11 +64,11 @@ struct CommandLineArgumentsCallbackStructure }; class CommandLineArgumentsVectorOfStrings : - public kwsys_stl::vector {}; + public std::vector {}; class CommandLineArgumentsSetOfStrings : - public kwsys_stl::set {}; + public std::set {}; class CommandLineArgumentsMapOfStrucs : - public kwsys_stl::map {}; class CommandLineArgumentsInternal @@ -152,8 +149,8 @@ void CommandLineArguments::ProcessArgument(const char* arg) //---------------------------------------------------------------------------- bool CommandLineArguments::GetMatchedArguments( - kwsys_stl::vector* matches, - const kwsys_stl::string& arg) + std::vector* matches, + const std::string& arg) { matches->clear(); CommandLineArguments::Internal::CallbacksMap::iterator it; @@ -184,15 +181,15 @@ bool CommandLineArguments::GetMatchedArguments( //---------------------------------------------------------------------------- int CommandLineArguments::Parse() { - kwsys_stl::vector::size_type cc; - kwsys_stl::vector matches; + std::vector::size_type cc; + std::vector matches; if ( this->StoreUnusedArgumentsFlag ) { this->Internals->UnusedArguments.clear(); } 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); this->Internals->LastArgument = cc; if ( this->GetMatchedArguments(&matches, arg) ) @@ -214,7 +211,7 @@ int CommandLineArguments::Parse() // additional value CommandLineArgumentsCallbackStructure *cs = &this->Internals->Callbacks[matches[maxidx]]; - const kwsys_stl::string& sarg = matches[maxidx]; + const std::string& sarg = matches[maxidx]; if ( cs->Argument != sarg ) { abort(); @@ -267,7 +264,7 @@ int CommandLineArguments::Parse() CommandLineArguments_DEBUG("This is a multi argument: " << arg); 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); if ( this->GetMatchedArguments(&matches, marg) ) { @@ -288,7 +285,7 @@ int CommandLineArguments::Parse() } break; 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 --; return 0; } @@ -313,7 +310,7 @@ int CommandLineArguments::Parse() } else { - kwsys_ios::cerr << "Got unknown argument: \"" << arg << "\"" << kwsys_ios::endl; + std::cerr << "Got unknown argument: \"" << arg << "\"" << std::endl; this->Internals->LastArgument --; return 0; } @@ -430,13 +427,13 @@ CommandLineArgumentsAddArgumentMacro(BOOL, bool) CommandLineArgumentsAddArgumentMacro(INT, int) CommandLineArgumentsAddArgumentMacro(DOUBLE, double) CommandLineArgumentsAddArgumentMacro(STRING, char*) -CommandLineArgumentsAddArgumentMacro(STL_STRING, kwsys_stl::string) +CommandLineArgumentsAddArgumentMacro(STL_STRING, std::string) -CommandLineArgumentsAddArgumentMacro(VECTOR_BOOL, kwsys_stl::vector) -CommandLineArgumentsAddArgumentMacro(VECTOR_INT, kwsys_stl::vector) -CommandLineArgumentsAddArgumentMacro(VECTOR_DOUBLE, kwsys_stl::vector) -CommandLineArgumentsAddArgumentMacro(VECTOR_STRING, kwsys_stl::vector) -CommandLineArgumentsAddArgumentMacro(VECTOR_STL_STRING, kwsys_stl::vector) +CommandLineArgumentsAddArgumentMacro(VECTOR_BOOL, std::vector) +CommandLineArgumentsAddArgumentMacro(VECTOR_INT, std::vector) +CommandLineArgumentsAddArgumentMacro(VECTOR_DOUBLE, std::vector) +CommandLineArgumentsAddArgumentMacro(VECTOR_STRING, std::vector) +CommandLineArgumentsAddArgumentMacro(VECTOR_STL_STRING, std::vector) //---------------------------------------------------------------------------- #define CommandLineArgumentsAddBooleanArgumentMacro(type, ctype) \ @@ -451,7 +448,7 @@ CommandLineArgumentsAddBooleanArgumentMacro(BOOL, bool) CommandLineArgumentsAddBooleanArgumentMacro(INT, int) CommandLineArgumentsAddBooleanArgumentMacro(DOUBLE, double) CommandLineArgumentsAddBooleanArgumentMacro(STRING, char*) -CommandLineArgumentsAddBooleanArgumentMacro(STL_STRING, kwsys_stl::string) +CommandLineArgumentsAddBooleanArgumentMacro(STL_STRING, std::string) //---------------------------------------------------------------------------- void CommandLineArguments::SetClientData(void* client_data) @@ -518,12 +515,12 @@ unsigned int CommandLineArguments::GetLastArgument() //---------------------------------------------------------------------------- void CommandLineArguments::GenerateHelp() { - kwsys_ios::ostringstream str; + std::ostringstream str; // Collapse all arguments into the map of vectors of all arguments that do // the same thing. CommandLineArguments::Internal::CallbacksMap::iterator it; - typedef kwsys_stl::map MapArgs; MapArgs mp; MapArgs::iterator mpit, smpit; @@ -604,7 +601,7 @@ void CommandLineArguments::GenerateHelp() CommandLineArguments::Internal::SetOfStrings::iterator sit; for ( sit = mpit->second.begin(); sit != mpit->second.end(); sit++ ) { - str << kwsys_ios::endl; + str << std::endl; char argument[100]; sprintf(argument, "%s", sit->c_str()); switch ( this->Internals->Callbacks[*sit].ArgumentType ) @@ -658,8 +655,8 @@ void CommandLineArguments::GenerateHelp() skip = cc; } } - str.write(ptr, static_cast(skip)); - str << kwsys_ios::endl; + str.write(ptr, static_cast(skip)); + str << std::endl; ptr += skip; len -= skip; cnt ++; @@ -680,7 +677,7 @@ void CommandLineArguments::GenerateHelp() //---------------------------------------------------------------------------- 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" || value == "TRUE" || value == "true" || value == "True" || @@ -696,7 +693,7 @@ void CommandLineArguments::PopulateVariable( //---------------------------------------------------------------------------- void CommandLineArguments::PopulateVariable( - int* variable, const kwsys_stl::string& value) + int* variable, const std::string& value) { char* res = 0; *variable = static_cast(strtol(value.c_str(), &res, 10)); @@ -708,7 +705,7 @@ void CommandLineArguments::PopulateVariable( //---------------------------------------------------------------------------- void CommandLineArguments::PopulateVariable( - double* variable, const kwsys_stl::string& value) + double* variable, const std::string& value) { char* res = 0; *variable = strtod(value.c_str(), &res); @@ -720,7 +717,7 @@ void CommandLineArguments::PopulateVariable( //---------------------------------------------------------------------------- void CommandLineArguments::PopulateVariable( - char** variable, const kwsys_stl::string& value) + char** variable, const std::string& value) { if ( *variable ) { @@ -733,14 +730,14 @@ void CommandLineArguments::PopulateVariable( //---------------------------------------------------------------------------- void CommandLineArguments::PopulateVariable( - kwsys_stl::string* variable, const kwsys_stl::string& value) + std::string* variable, const std::string& value) { *variable = value; } //---------------------------------------------------------------------------- void CommandLineArguments::PopulateVariable( - kwsys_stl::vector* variable, const kwsys_stl::string& value) + std::vector* variable, const std::string& value) { bool val = false; if ( value == "1" || value == "ON" || value == "on" || value == "On" || @@ -754,7 +751,7 @@ void CommandLineArguments::PopulateVariable( //---------------------------------------------------------------------------- void CommandLineArguments::PopulateVariable( - kwsys_stl::vector* variable, const kwsys_stl::string& value) + std::vector* variable, const std::string& value) { char* res = 0; variable->push_back(static_cast(strtol(value.c_str(), &res, 10))); @@ -766,7 +763,7 @@ void CommandLineArguments::PopulateVariable( //---------------------------------------------------------------------------- void CommandLineArguments::PopulateVariable( - kwsys_stl::vector* variable, const kwsys_stl::string& value) + std::vector* variable, const std::string& value) { char* res = 0; variable->push_back(strtod(value.c_str(), &res)); @@ -778,7 +775,7 @@ void CommandLineArguments::PopulateVariable( //---------------------------------------------------------------------------- void CommandLineArguments::PopulateVariable( - kwsys_stl::vector* variable, const kwsys_stl::string& value) + std::vector* variable, const std::string& value) { char* var = new char[ value.size() + 1 ]; strcpy(var, value.c_str()); @@ -787,8 +784,8 @@ void CommandLineArguments::PopulateVariable( //---------------------------------------------------------------------------- void CommandLineArguments::PopulateVariable( - kwsys_stl::vector* variable, - const kwsys_stl::string& value) + std::vector* variable, + const std::string& value) { variable->push_back(value); } @@ -809,7 +806,7 @@ bool CommandLineArguments::PopulateVariable(CommandLineArgumentsCallbackStructur CommandLineArguments_DEBUG("Set argument: " << cs->Argument << " to " << value); if ( cs->Variable ) { - kwsys_stl::string var = "1"; + std::string var = "1"; if ( value ) { var = value; @@ -826,28 +823,28 @@ bool CommandLineArguments::PopulateVariable(CommandLineArgumentsCallbackStructur this->PopulateVariable(static_cast(cs->Variable), var); break; case CommandLineArguments::STL_STRING_TYPE: - this->PopulateVariable(static_cast(cs->Variable), var); + this->PopulateVariable(static_cast(cs->Variable), var); break; case CommandLineArguments::BOOL_TYPE: this->PopulateVariable(static_cast(cs->Variable), var); break; case CommandLineArguments::VECTOR_BOOL_TYPE: - this->PopulateVariable(static_cast*>(cs->Variable), var); + this->PopulateVariable(static_cast*>(cs->Variable), var); break; case CommandLineArguments::VECTOR_INT_TYPE: - this->PopulateVariable(static_cast*>(cs->Variable), var); + this->PopulateVariable(static_cast*>(cs->Variable), var); break; case CommandLineArguments::VECTOR_DOUBLE_TYPE: - this->PopulateVariable(static_cast*>(cs->Variable), var); + this->PopulateVariable(static_cast*>(cs->Variable), var); break; case CommandLineArguments::VECTOR_STRING_TYPE: - this->PopulateVariable(static_cast*>(cs->Variable), var); + this->PopulateVariable(static_cast*>(cs->Variable), var); break; case CommandLineArguments::VECTOR_STL_STRING_TYPE: - this->PopulateVariable(static_cast*>(cs->Variable), var); + this->PopulateVariable(static_cast*>(cs->Variable), var); break; 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 --; return 0; } diff --git a/CommandLineArguments.hxx.in b/CommandLineArguments.hxx.in index cbf6ee3..e4f6d02 100644 --- a/CommandLineArguments.hxx.in +++ b/CommandLineArguments.hxx.in @@ -15,13 +15,8 @@ #include <@KWSYS_NAMESPACE@/Configure.h> #include <@KWSYS_NAMESPACE@/Configure.hxx> -#include <@KWSYS_NAMESPACE@/stl/string> -#include <@KWSYS_NAMESPACE@/stl/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 +#include +#include namespace @KWSYS_NAMESPACE@ { @@ -64,7 +59,7 @@ struct CommandLineArgumentsCallbackStructure; * "This is help string for --something"); * if ( !arg.Parse() ) * { - * kwsys_ios::cerr << "Problem parsing arguments" << kwsys_ios::endl; + * std::cerr << "Problem parsing arguments" << std::endl; * res = 1; * } * @@ -155,7 +150,7 @@ public: void AddArgument(const char* argument, ArgumentTypeEnum type, char** variable, const char* help); 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 @@ -163,15 +158,15 @@ public: * appropriate type. This will handle the multi argument values. */ void AddArgument(const char* argument, ArgumentTypeEnum type, - kwsys_stl::vector* variable, const char* help); + std::vector* variable, const char* help); void AddArgument(const char* argument, ArgumentTypeEnum type, - kwsys_stl::vector* variable, const char* help); + std::vector* variable, const char* help); void AddArgument(const char* argument, ArgumentTypeEnum type, - kwsys_stl::vector* variable, const char* help); + std::vector* variable, const char* help); void AddArgument(const char* argument, ArgumentTypeEnum type, - kwsys_stl::vector* variable, const char* help); + std::vector* variable, const char* help); void AddArgument(const char* argument, ArgumentTypeEnum type, - kwsys_stl::vector* variable, const char* help); + std::vector* variable, const char* help); /** * Add handler for boolean argument. The argument does not take any option @@ -187,7 +182,7 @@ public: void AddBooleanArgument(const char* argument, char** variable, const char* help); void AddBooleanArgument(const char* argument, - kwsys_stl::string* variable, const char* help); + std::string* variable, const char* help); /** * Set the callbacks for error handling. @@ -243,28 +238,28 @@ protected: void AddArgument(const char* argument, ArgumentTypeEnum type, VariableTypeEnum vtype, void* variable, const char* help); - bool GetMatchedArguments(kwsys_stl::vector* matches, - const kwsys_stl::string& arg); + bool GetMatchedArguments(std::vector* matches, + const std::string& arg); //! Populate individual variables bool PopulateVariable(CommandLineArgumentsCallbackStructure* cs, const char* value); //! Populate individual variables of type ... - void PopulateVariable(bool* variable, const kwsys_stl::string& value); - void PopulateVariable(int* variable, const kwsys_stl::string& value); - void PopulateVariable(double* variable, const kwsys_stl::string& value); - void PopulateVariable(char** variable, const kwsys_stl::string& value); - void PopulateVariable(kwsys_stl::string* variable, const kwsys_stl::string& value); - void PopulateVariable(kwsys_stl::vector* variable, const kwsys_stl::string& value); - void PopulateVariable(kwsys_stl::vector* variable, const kwsys_stl::string& value); - void PopulateVariable(kwsys_stl::vector* variable, const kwsys_stl::string& value); - void PopulateVariable(kwsys_stl::vector* variable, const kwsys_stl::string& value); - void PopulateVariable(kwsys_stl::vector* variable, const kwsys_stl::string& value); + void PopulateVariable(bool* variable, const std::string& value); + void PopulateVariable(int* variable, const std::string& value); + void PopulateVariable(double* variable, const std::string& value); + void PopulateVariable(char** variable, const std::string& value); + void PopulateVariable(std::string* variable, const std::string& value); + void PopulateVariable(std::vector* variable, const std::string& value); + void PopulateVariable(std::vector* variable, const std::string& value); + void PopulateVariable(std::vector* variable, const std::string& value); + void PopulateVariable(std::vector* variable, const std::string& value); + void PopulateVariable(std::vector* variable, const std::string& value); typedef CommandLineArgumentsInternal Internal; Internal* Internals; - kwsys_stl::string Help; + std::string Help; unsigned int LineLength; @@ -273,11 +268,6 @@ protected: } // namespace @KWSYS_NAMESPACE@ -/* Undefine temporary macro. */ -#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS -# undef kwsys_stl -#endif - #endif diff --git a/Configure.hxx.in b/Configure.hxx.in index 8f5ace2..3faf862 100644 --- a/Configure.hxx.in +++ b/Configure.hxx.in @@ -15,125 +15,9 @@ /* Include C configuration. */ #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++ header is to be used. */ -#define @KWSYS_NAMESPACE@_IOS_USE_SSTREAM @KWSYS_IOS_USE_SSTREAM@ - -/* Whether old C++ header is to be used. */ -#define @KWSYS_NAMESPACE@_IOS_USE_STRSTREAM_H @KWSYS_IOS_USE_STRSTREAM_H@ - -/* Whether old C++ 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. */ #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. */ #define @KWSYS_NAMESPACE@_STAT_HAS_ST_MTIM @KWSYS_STAT_HAS_ST_MTIM@ @@ -141,38 +25,10 @@ access to the macros without a configured namespace. */ #if defined(KWSYS_NAMESPACE) # if !@KWSYS_NAMESPACE@_NAME_IS_KWSYS -# define kwsys_stl @KWSYS_NAMESPACE@_stl -# define kwsys_ios @KWSYS_NAMESPACE@_ios # define kwsys @KWSYS_NAMESPACE@ -# define kwsys_ios_binary @KWSYS_NAMESPACE@_ios_binary # endif # 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_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 #endif diff --git a/Directory.cxx b/Directory.cxx index 58cea63..c549792 100644 --- a/Directory.cxx +++ b/Directory.cxx @@ -16,20 +16,17 @@ #include KWSYS_HEADER(Encoding.hxx) -#include KWSYS_HEADER(stl/string) -#include KWSYS_HEADER(stl/vector) - // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. #if 0 # include "Directory.hxx.in" # include "Configure.hxx.in" # include "Encoding.hxx.in" -# include "kwsys_stl.hxx.in" -# include "kwsys_stl_string.hxx.in" -# include "kwsys_stl_vector.hxx.in" #endif +#include +#include + namespace KWSYS_NAMESPACE { @@ -38,10 +35,10 @@ class DirectoryInternals { public: // Array of Files - kwsys_stl::vector Files; + std::vector Files; // Path to Open'ed directory - kwsys_stl::string Path; + std::string Path; }; //---------------------------------------------------------------------------- @@ -103,7 +100,7 @@ void Directory::Clear() namespace KWSYS_NAMESPACE { -bool Directory::Load(const kwsys_stl::string& name) +bool Directory::Load(const std::string& name) { this->Clear(); #if _MSC_VER < 1300 @@ -153,7 +150,7 @@ bool Directory::Load(const kwsys_stl::string& name) 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 long srchHandle; @@ -220,7 +217,7 @@ unsigned long Directory::GetNumberOfFilesInDirectory(const kwsys_stl::string& na namespace KWSYS_NAMESPACE { -bool Directory::Load(const kwsys_stl::string& name) +bool Directory::Load(const std::string& name) { this->Clear(); @@ -240,7 +237,7 @@ bool Directory::Load(const kwsys_stl::string& name) 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()); diff --git a/Directory.hxx.in b/Directory.hxx.in index 1bcf90e..e68f337 100644 --- a/Directory.hxx.in +++ b/Directory.hxx.in @@ -13,12 +13,7 @@ #define @KWSYS_NAMESPACE@_Directory_hxx #include <@KWSYS_NAMESPACE@/Configure.h> -#include <@KWSYS_NAMESPACE@/stl/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 +#include namespace @KWSYS_NAMESPACE@ { @@ -44,7 +39,7 @@ public: * in that directory. 0 is returned if the directory can not be * 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. @@ -55,7 +50,7 @@ public: * Return the number of files in the specified directory. * 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 @@ -83,9 +78,4 @@ private: } // namespace @KWSYS_NAMESPACE@ -/* Undefine temporary macros. */ -#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS -# undef kwsys_stl -#endif - #endif diff --git a/DynamicLoader.cxx b/DynamicLoader.cxx index a776f97..1941d96 100644 --- a/DynamicLoader.cxx +++ b/DynamicLoader.cxx @@ -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); } @@ -57,7 +57,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib) //---------------------------------------------------------------------------- DynamicLoader::SymbolPointer -DynamicLoader::GetSymbolAddress(DynamicLoader::LibraryHandle lib, const kwsys_stl::string& sym) +DynamicLoader::GetSymbolAddress(DynamicLoader::LibraryHandle lib, const std::string& sym) { void* addr; 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; NSObjectFileImage image = 0; @@ -146,7 +146,7 @@ int DynamicLoader::CloseLibrary( DynamicLoader::LibraryHandle lib) //---------------------------------------------------------------------------- DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( - DynamicLoader::LibraryHandle lib, const kwsys_stl::string& sym) + DynamicLoader::LibraryHandle lib, const std::string& sym) { void *result=0; // 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; 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::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 // 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; //---------------------------------------------------------------------------- -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 // 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::LibraryHandle lib, const kwsys_stl::string& sym) + DynamicLoader::LibraryHandle lib, const std::string& sym) { // Hack to cast pointer-to-data to pointer-to-function. 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; } @@ -411,7 +411,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib) //---------------------------------------------------------------------------- DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress( - DynamicLoader::LibraryHandle lib, const kwsys_stl::string& sym) + DynamicLoader::LibraryHandle lib, const std::string& sym) { 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); dld_init(program_invocation_name); @@ -456,7 +456,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib) //---------------------------------------------------------------------------- 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. 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); } @@ -508,7 +508,7 @@ int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib) //---------------------------------------------------------------------------- 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. union diff --git a/DynamicLoader.hxx.in b/DynamicLoader.hxx.in index 75811ab..1e4a912 100644 --- a/DynamicLoader.hxx.in +++ b/DynamicLoader.hxx.in @@ -12,8 +12,8 @@ #ifndef @KWSYS_NAMESPACE@_DynamicLoader_hxx #define @KWSYS_NAMESPACE@_DynamicLoader_hxx -#include <@KWSYS_NAMESPACE@/Configure.h> -#include <@KWSYS_NAMESPACE@/stl/string> +#include <@KWSYS_NAMESPACE@/Configure.hxx> +#include #if defined(__hpux) #include @@ -28,11 +28,6 @@ #include #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@ { /** \class DynamicLoader @@ -83,14 +78,14 @@ public: /** Load a dynamic library into the current process. * The returned LibraryHandle can be used to access the symbols in the * library. */ - static LibraryHandle OpenLibrary(const kwsys_stl::string&); + static LibraryHandle OpenLibrary(const std::string&); /** Attempt to detach a dynamic library from the * process. A value of true is returned if it is sucessful. */ static int CloseLibrary(LibraryHandle); /** 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. */ static const char* LibPrefix() { return "@KWSYS_DynamicLoader_PREFIX@"; } @@ -104,9 +99,4 @@ public: } // namespace @KWSYS_NAMESPACE@ -/* Undefine temporary macros. */ -#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS -# undef kwsys_stl -#endif - #endif diff --git a/Encoding.hxx.in b/Encoding.hxx.in index aba4175..87b1c21 100644 --- a/Encoding.hxx.in +++ b/Encoding.hxx.in @@ -13,13 +13,8 @@ #define @KWSYS_NAMESPACE@_Encoding_hxx #include <@KWSYS_NAMESPACE@/Configure.hxx> -#include <@KWSYS_NAMESPACE@/stl/string> -#include <@KWSYS_NAMESPACE@/stl/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 +#include +#include namespace @KWSYS_NAMESPACE@ { @@ -65,23 +60,18 @@ public: // Convert a narrow string to a wide string. // On Windows, UTF-8 is assumed, and on other platforms, // the current locale is assumed. - static kwsys_stl::wstring ToWide(const kwsys_stl::string& str); - static kwsys_stl::wstring ToWide(const char* str); + static std::wstring ToWide(const std::string& str); + static std::wstring ToWide(const char* str); // Convert a wide string to a narrow string. // On Windows, UTF-8 is assumed, and on other platforms, // the current locale is assumed. - static kwsys_stl::string ToNarrow(const kwsys_stl::wstring& str); - static kwsys_stl::string ToNarrow(const wchar_t* str); + static std::string ToNarrow(const std::wstring& str); + static std::string ToNarrow(const wchar_t* str); #endif // @KWSYS_NAMESPACE@_STL_HAS_WSTRING }; // class Encoding } // namespace @KWSYS_NAMESPACE@ -/* Undefine temporary macros. */ -#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS -# undef kwsys_stl -#endif - #endif diff --git a/EncodingCXX.cxx b/EncodingCXX.cxx index 251a56d..7d9b3e4 100644 --- a/EncodingCXX.cxx +++ b/EncodingCXX.cxx @@ -19,7 +19,6 @@ #include "kwsysPrivate.h" #include KWSYS_HEADER(Encoding.hxx) #include KWSYS_HEADER(Encoding.h) -#include KWSYS_HEADER(stl/vector) // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. @@ -28,6 +27,7 @@ # include "Encoding.h.in" #endif +#include #include #include @@ -140,23 +140,23 @@ char const* const* Encoding::CommandLineArguments::argv() const #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()); } -kwsys_stl::string Encoding::ToNarrow(const kwsys_stl::wstring& str) +std::string Encoding::ToNarrow(const std::wstring& 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; if(length > 0) { - kwsys_stl::vector wchars(length); + std::vector wchars(length); if(kwsysEncoding_mbstowcs(&wchars[0], cstr, length) > 0) { wstr = &wchars[0]; @@ -165,9 +165,9 @@ kwsys_stl::wstring Encoding::ToWide(const char* cstr) 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; if(length > 0) { diff --git a/FStream.hxx.in b/FStream.hxx.in index 37055d6..681e4d8 100644 --- a/FStream.hxx.in +++ b/FStream.hxx.in @@ -12,8 +12,8 @@ #ifndef @KWSYS_NAMESPACE@_FStream_hxx #define @KWSYS_NAMESPACE@_FStream_hxx -#include <@KWSYS_NAMESPACE@/ios/fstream> #include <@KWSYS_NAMESPACE@/Encoding.hxx> +#include namespace @KWSYS_NAMESPACE@ { @@ -167,8 +167,8 @@ class basic_ofstream : public std::basic_ostream # undef @KWSYS_NAMESPACE@_FStream_NOEXCEPT #else - using @KWSYS_NAMESPACE@_ios_namespace::ofstream; - using @KWSYS_NAMESPACE@_ios_namespace::ifstream; + using std::ofstream; + using std::ifstream; #endif namespace FStream diff --git a/Glob.cxx b/Glob.cxx index 11bfd16..9d63459 100644 --- a/Glob.cxx +++ b/Glob.cxx @@ -17,9 +17,6 @@ #include KWSYS_HEADER(RegularExpression.hxx) #include KWSYS_HEADER(SystemTools.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 // duplicate the above list of headers. @@ -29,12 +26,12 @@ # include "Configure.hxx.in" # include "RegularExpression.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 +#include +#include +#include + #include #include #include @@ -54,8 +51,8 @@ namespace KWSYS_NAMESPACE class GlobInternals { public: - kwsys_stl::vector Files; - kwsys_stl::vector Expressions; + std::vector Files; + std::vector Expressions; }; //---------------------------------------------------------------------------- @@ -82,21 +79,21 @@ Glob::~Glob() } //---------------------------------------------------------------------------- -kwsys_stl::vector& Glob::GetFiles() +std::vector& Glob::GetFiles() { 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 preserve_case) { // Incrementally build the regular expression from the pattern. - kwsys_stl::string regex = require_whole_string? "^" : ""; - kwsys_stl::string::const_iterator pattern_first = pattern.begin(); - kwsys_stl::string::const_iterator pattern_last = pattern.end(); - for(kwsys_stl::string::const_iterator i = pattern_first; + std::string regex = require_whole_string? "^" : ""; + std::string::const_iterator pattern_first = pattern.begin(); + std::string::const_iterator pattern_last = pattern.end(); + for(std::string::const_iterator i = pattern_first; i != pattern_last; ++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 // opening character. - kwsys_stl::string::const_iterator bracket_first = i+1; - kwsys_stl::string::const_iterator bracket_last = bracket_first; + std::string::const_iterator bracket_first = i+1; + std::string::const_iterator bracket_last = bracket_first; // The first character may be complementation '!' or '^'. if(bracket_last != pattern_last && @@ -153,7 +150,7 @@ kwsys_stl::string Glob::PatternToRegex(const kwsys_stl::string& pattern, else { // 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. regex += "["; @@ -221,8 +218,8 @@ kwsys_stl::string Glob::PatternToRegex(const kwsys_stl::string& pattern, } //---------------------------------------------------------------------------- -bool Glob::RecurseDirectory(kwsys_stl::string::size_type start, - const kwsys_stl::string& dir, GlobMessages* messages) +bool Glob::RecurseDirectory(std::string::size_type start, + const std::string& dir, GlobMessages* messages) { kwsys::Directory d; if ( !d.Load(dir) ) @@ -230,8 +227,8 @@ bool Glob::RecurseDirectory(kwsys_stl::string::size_type start, return true; } unsigned long cc; - kwsys_stl::string realname; - kwsys_stl::string fname; + std::string realname; + std::string fname; for ( cc = 0; cc < d.GetNumberOfFiles(); cc ++ ) { fname = d.GetFile(cc); @@ -262,8 +259,8 @@ bool Glob::RecurseDirectory(kwsys_stl::string::size_type start, if (isSymLink) { ++this->FollowedSymlinkCount; - kwsys_stl::string realPathErrorMessage; - kwsys_stl::string canonicalPath(SystemTools::GetRealPath(dir, + std::string realPathErrorMessage; + std::string canonicalPath(SystemTools::GetRealPath(dir, &realPathErrorMessage)); if(!realPathErrorMessage.empty()) @@ -277,7 +274,7 @@ bool Glob::RecurseDirectory(kwsys_stl::string::size_type start, return false; } - if(kwsys_stl::find(this->VisitedSymlinks.begin(), + if(std::find(this->VisitedSymlinks.begin(), 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 if(messages) { - kwsys_stl::string message; - for(kwsys_stl::vector::const_iterator - pathIt = kwsys_stl::find(this->VisitedSymlinks.begin(), + std::string message; + for(std::vector::const_iterator + pathIt = std::find(this->VisitedSymlinks.begin(), this->VisitedSymlinks.end(), canonicalPath); 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, - const kwsys_stl::string& dir, GlobMessages* messages) +void Glob::ProcessDirectory(std::string::size_type start, + 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 ); if ( last && this->Recurse ) { @@ -360,8 +357,8 @@ void Glob::ProcessDirectory(kwsys_stl::string::size_type start, return; } unsigned long cc; - kwsys_stl::string realname; - kwsys_stl::string fname; + std::string realname; + std::string fname; for ( cc = 0; cc < d.GetNumberOfFiles(); cc ++ ) { fname = d.GetFile(cc); @@ -384,10 +381,10 @@ void Glob::ProcessDirectory(kwsys_stl::string::size_type start, fname = kwsys::SystemTools::LowerCase(fname); #endif - //kwsys_ios::cout << "Look at file: " << fname << kwsys_ios::endl; - //kwsys_ios::cout << "Match: " - // << this->Internals->TextExpressions[start].c_str() << kwsys_ios::endl; - //kwsys_ios::cout << "Real name: " << realname << kwsys_ios::endl; + //std::cout << "Look at file: " << fname << std::endl; + //std::cout << "Match: " + // << this->Internals->TextExpressions[start].c_str() << std::endl; + //std::cout << "Real name: " << realname << std::endl; if( (!last && !kwsys::SystemTools::FileIsDirectory(realname)) || (!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; - kwsys_stl::string::size_type cc; - kwsys_stl::string expr = inexpr; + std::string cexpr; + std::string::size_type cc; + std::string expr = inexpr; this->Internals->Expressions.clear(); this->Internals->Files.clear(); @@ -425,10 +422,10 @@ bool Glob::FindFiles(const kwsys_stl::string& inexpr, GlobMessages* messages) expr = kwsys::SystemTools::GetCurrentWorkingDirectory(); expr += "/" + inexpr; } - kwsys_stl::string fexpr = expr; + std::string fexpr = expr; - kwsys_stl::string::size_type skip = 0; - kwsys_stl::string::size_type last_slash = 0; + std::string::size_type skip = 0; + std::string::size_type last_slash = 0; for ( cc = 0; cc < expr.size(); cc ++ ) { 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 ) { - //kwsys_ios::cout << "I can skip: " << fexpr.substr(0, last_slash) - // << kwsys_ios::endl; + //std::cout << "I can skip: " << fexpr.substr(0, last_slash) + // << std::endl; skip = last_slash; } 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( kwsys::RegularExpression( @@ -546,7 +543,7 @@ const char* Glob::GetRelative() } //---------------------------------------------------------------------------- -void Glob::AddFile(kwsys_stl::vector& files, const kwsys_stl::string& file) +void Glob::AddFile(std::vector& files, const std::string& file) { if ( !this->Relative.empty() ) { diff --git a/Glob.hxx.in b/Glob.hxx.in index 5239ccd..ffee9ca 100644 --- a/Glob.hxx.in +++ b/Glob.hxx.in @@ -15,13 +15,8 @@ #include <@KWSYS_NAMESPACE@/Configure.h> #include <@KWSYS_NAMESPACE@/Configure.hxx> -#include <@KWSYS_NAMESPACE@/stl/string> -#include <@KWSYS_NAMESPACE@/stl/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 +#include +#include namespace @KWSYS_NAMESPACE@ { @@ -49,9 +44,9 @@ public: struct Message { 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), content(c) {} @@ -67,18 +62,18 @@ public: } }; - typedef kwsys_stl::vector GlobMessages; - typedef kwsys_stl::vector::iterator GlobMessagesIterator; + typedef std::vector GlobMessages; + typedef std::vector::iterator GlobMessagesIterator; public: Glob(); ~Glob(); //! Find all files that match the pattern. - bool FindFiles(const kwsys_stl::string& inexpr, + bool FindFiles(const std::string& inexpr, GlobMessages* messages = 0); //! Return the list of files that matched. - kwsys_stl::vector& GetFiles(); + std::vector& GetFiles(); //! Set recurse to true to match subdirectories. void RecurseOn() { this->SetRecurse(true); } @@ -107,7 +102,7 @@ public: string. This is on by default because patterns always match whole strings, but may be disabled to support concatenating 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 preserve_case = false); @@ -122,28 +117,28 @@ public: protected: //! Process directory - void ProcessDirectory(kwsys_stl::string::size_type start, - const kwsys_stl::string& dir, + void ProcessDirectory(std::string::size_type start, + const std::string& dir, GlobMessages* messages); //! Process last directory, but only when recurse flags is on. That is // effectively like saying: /path/to/file/**/file - bool RecurseDirectory(kwsys_stl::string::size_type start, - const kwsys_stl::string& dir, + bool RecurseDirectory(std::string::size_type start, + const std::string& dir, GlobMessages* messages); //! Add regular expression - void AddExpression(const kwsys_stl::string& expr); + void AddExpression(const std::string& expr); //! Add a file to the list - void AddFile(kwsys_stl::vector& files, const kwsys_stl::string& file); + void AddFile(std::vector& files, const std::string& file); GlobInternals* Internals; bool Recurse; - kwsys_stl::string Relative; + std::string Relative; bool RecurseThroughSymlinks; unsigned int FollowedSymlinkCount; - kwsys_stl::vector VisitedSymlinks; + std::vector VisitedSymlinks; bool ListDirs; bool RecurseListDirs; @@ -154,9 +149,4 @@ private: } // namespace @KWSYS_NAMESPACE@ -/* Undefine temporary macro. */ -#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS -# undef kwsys_stl -#endif - #endif diff --git a/IOStream.cxx b/IOStream.cxx index a31f8c8..81c6a73 100644 --- a/IOStream.cxx +++ b/IOStream.cxx @@ -12,25 +12,14 @@ #include "kwsysPrivate.h" #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 // Hack access to some private stream methods. -# undef protected -# endif -#endif - // Include the streams library. -#include KWSYS_HEADER(ios/iostream) +#include #include KWSYS_HEADER(IOStream.hxx) // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. #if 0 # include "Configure.hxx.in" -# include "kwsys_ios_iostream.hxx.in" # include "IOStream.hxx.in" #endif @@ -50,7 +39,7 @@ namespace KWSYS_NAMESPACE { // 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. 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 // 0 alone means octal. int base = 0; - int flags = is.flags() & kwsys_ios::ios_base::basefield; - if(flags == kwsys_ios::ios_base::oct) { base = 8; } - else if(flags == kwsys_ios::ios_base::dec) { base = 10; } - else if(flags == kwsys_ios::ios_base::hex) { base = 16; } + int flags = is.flags() & std::ios_base::basefield; + if(flags == std::ios_base::oct) { base = 8; } + else if(flags == std::ios_base::dec) { base = 10; } + else if(flags == std::ios_base::hex) { base = 16; } bool foundDigit = false; bool foundNonZero = false; 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. template -kwsys_ios::istream& -IOStreamScanTemplate(kwsys_ios::istream& is, T& value, char type) +std::istream& +IOStreamScanTemplate(std::istream& is, T& value, char type) { - int state = kwsys_ios::ios_base::goodbit; + int state = std::ios_base::goodbit; // Skip leading whitespace. -# if KWSYS_IOS_USE_ANSI - kwsys_ios::istream::sentry okay(is); -# else - is.eatwhite(); - kwsys_ios::istream& okay = is; -# endif + std::istream::sentry okay(is); if(okay) { -# if KWSYS_IOS_USE_ANSI try { -# endif // Copy the string to a buffer and construct the format string. char buffer[KWSYS_IOS_INT64_MAX_DIG]; # 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; // Set flags for resulting state. - if(is.peek() == EOF) { state |= kwsys_ios::ios_base::eofbit; } - if(!success) { state |= kwsys_ios::ios_base::failbit; } + if(is.peek() == EOF) { state |= std::ios_base::eofbit; } + if(!success) { state |= std::ios_base::failbit; } else { value = result; } -# if KWSYS_IOS_USE_ANSI - } catch(...) { state |= kwsys_ios::ios_base::badbit; } -# endif + } catch(...) { state |= std::ios_base::badbit; } } -# if KWSYS_IOS_USE_ANSI - is.setstate(kwsys_ios::ios_base::iostate(state)); -# else - is.clear(state); -# endif + is.setstate(std::ios_base::iostate(state)); return is; } // Print an integer value to an output stream. template -kwsys_ios::ostream& -IOStreamPrintTemplate(kwsys_ios::ostream& os, T value, char type) +std::ostream& +IOStreamPrintTemplate(std::ostream& os, T value, char type) { -# if KWSYS_IOS_USE_ANSI - kwsys_ios::ostream::sentry okay(os); -# else - kwsys_ios::ostream& okay = os; -# endif + std::ostream::sentry okay(os); if(okay) { -# if KWSYS_IOS_USE_ANSI try { -# endif // Construct the format string. char format[8]; char* f = format; *f++ = '%'; - if(os.flags() & kwsys_ios::ios_base::showpos) { *f++ = '+'; } - if(os.flags() & kwsys_ios::ios_base::showbase) { *f++ = '#'; } + if(os.flags() & std::ios_base::showpos) { *f++ = '+'; } + if(os.flags() & std::ios_base::showbase) { *f++ = '#'; } # if defined(_MSC_VER) *f++ = 'I'; *f++ = '6'; *f++ = '4'; # else *f++ = 'l'; *f++ = 'l'; # endif - long bflags = os.flags() & kwsys_ios::ios_base::basefield; - if(bflags == kwsys_ios::ios_base::oct) { *f++ = 'o'; } - else if(bflags != kwsys_ios::ios_base::hex) { *f++ = type; } - else if(os.flags() & kwsys_ios::ios_base::uppercase) { *f++ = 'X'; } + long bflags = os.flags() & std::ios_base::basefield; + if(bflags == std::ios_base::oct) { *f++ = 'o'; } + else if(bflags != std::ios_base::hex) { *f++ = type; } + else if(os.flags() & std::ios_base::uppercase) { *f++ = 'X'; } else { *f++ = 'x'; } *f = '\0'; @@ -228,22 +198,20 @@ IOStreamPrintTemplate(kwsys_ios::ostream& os, T value, char type) char buffer[2*KWSYS_IOS_INT64_MAX_DIG]; sprintf(buffer, format, value); os << buffer; -# if KWSYS_IOS_USE_ANSI - } catch(...) { os.clear(os.rdstate() | kwsys_ios::ios_base::badbit); } -# endif + } catch(...) { os.clear(os.rdstate() | std::ios_base::badbit); } } return os; } # if !KWSYS_IOS_HAS_ISTREAM_LONG_LONG // 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'); } // 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'); } @@ -251,13 +219,13 @@ kwsys_ios::istream& IOStreamScan(kwsys_ios::istream& is, IOStreamULL& value) # if !KWSYS_IOS_HAS_OSTREAM_LONG_LONG // 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'); } // 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'); } diff --git a/IOStream.hxx.in b/IOStream.hxx.in index 2eeedf2..c101909 100644 --- a/IOStream.hxx.in +++ b/IOStream.hxx.in @@ -12,12 +12,11 @@ #ifndef @KWSYS_NAMESPACE@_IOStream_hxx #define @KWSYS_NAMESPACE@_IOStream_hxx -#include <@KWSYS_NAMESPACE@/ios/iosfwd> +#include /* Define these macros temporarily to keep the code readable. */ #if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS # define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT -# define kwsys_ios @KWSYS_NAMESPACE@_ios #endif /* Whether istream supports long long. */ @@ -56,10 +55,8 @@ /* Input stream operator implementation functions. */ namespace @KWSYS_NAMESPACE@ { -kwsysEXPORT kwsys_ios::istream& IOStreamScan(kwsys_ios::istream&, - IOStreamSLL&); -kwsysEXPORT kwsys_ios::istream& IOStreamScan(kwsys_ios::istream&, - IOStreamULL&); +kwsysEXPORT std::istream& IOStreamScan(std::istream&, IOStreamSLL&); +kwsysEXPORT std::istream& IOStreamScan(std::istream&, IOStreamULL&); } /* 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) # define KWSYS_IOS_ISTREAM_LONG_LONG_DEFINED # define @KWSYS_NAMESPACE@_IOS_ISTREAM_LONG_LONG_DEFINED -inline kwsys_ios::istream& -operator>>(kwsys_ios::istream& is, @KWSYS_NAMESPACE@::IOStreamSLL& value) +inline std::istream& +operator>>(std::istream& is, @KWSYS_NAMESPACE@::IOStreamSLL& 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) # define KWSYS_IOS_ISTREAM_UNSIGNED_LONG_LONG_DEFINED # define @KWSYS_NAMESPACE@_IOS_ISTREAM_UNSIGNED_LONG_LONG_DEFINED -inline kwsys_ios::istream& -operator>>(kwsys_ios::istream& is, @KWSYS_NAMESPACE@::IOStreamULL& value) +inline std::istream& +operator>>(std::istream& is, @KWSYS_NAMESPACE@::IOStreamULL& 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. */ namespace @KWSYS_NAMESPACE@ { -kwsysEXPORT kwsys_ios::ostream& IOStreamPrint(kwsys_ios::ostream&, - IOStreamSLL); -kwsysEXPORT kwsys_ios::ostream& IOStreamPrint(kwsys_ios::ostream&, - IOStreamULL); +kwsysEXPORT std::ostream& IOStreamPrint(std::ostream&, IOStreamSLL); +kwsysEXPORT std::ostream& IOStreamPrint(std::ostream&, IOStreamULL); } /* 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) # define KWSYS_IOS_OSTREAM_LONG_LONG_DEFINED # define @KWSYS_NAMESPACE@_IOS_OSTREAM_LONG_LONG_DEFINED -inline kwsys_ios::ostream& -operator<<(kwsys_ios::ostream& os, @KWSYS_NAMESPACE@::IOStreamSLL value) +inline std::ostream& +operator<<(std::ostream& os, @KWSYS_NAMESPACE@::IOStreamSLL 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) # define KWSYS_IOS_OSTREAM_UNSIGNED_LONG_LONG_DEFINED # define @KWSYS_NAMESPACE@_IOS_OSTREAM_UNSIGNED_LONG_LONG_DEFINED -inline kwsys_ios::ostream& -operator<<(kwsys_ios::ostream& os, @KWSYS_NAMESPACE@::IOStreamULL value) +inline std::ostream& +operator<<(std::ostream& os, @KWSYS_NAMESPACE@::IOStreamULL value) { return @KWSYS_NAMESPACE@::IOStreamPrint(os, value); } @@ -127,7 +122,6 @@ operator<<(kwsys_ios::ostream& os, @KWSYS_NAMESPACE@::IOStreamULL value) /* Undefine temporary macros. */ #if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS # undef kwsysEXPORT -# undef kwsys_ios #endif /* If building a C++ file in kwsys itself, give the source file diff --git a/RegularExpression.hxx.in b/RegularExpression.hxx.in index 502fbe2..d0235d8 100644 --- a/RegularExpression.hxx.in +++ b/RegularExpression.hxx.in @@ -33,12 +33,7 @@ #include <@KWSYS_NAMESPACE@/Configure.h> #include <@KWSYS_NAMESPACE@/Configure.hxx> -#include <@KWSYS_NAMESPACE@/stl/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 +#include /* Disable useless Borland warnings. KWSys tries not to force things on its includers, but there is no choice here. */ @@ -207,7 +202,7 @@ public: /** * Instantiate RegularExpression with compiled string. */ - inline RegularExpression (kwsys_stl::string const&); + inline RegularExpression (std::string const&); /** * Destructor. @@ -224,7 +219,7 @@ public: * Compile a regular expression into internal code * 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. @@ -236,17 +231,17 @@ public: * Matches the regular expression to the given std string. * 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. */ - inline kwsys_stl::string::size_type start() const; + inline std::string::size_type start() const; /** * 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. @@ -285,9 +280,9 @@ public: * Destructor. */ // awf added - kwsys_stl::string::size_type start(int n) const; - kwsys_stl::string::size_type end(int n) const; - kwsys_stl::string match(int n) const; + std::string::size_type start(int n) const; + std::string::size_type end(int n) const; + std::string match(int n) const; enum { NSUBEXP = 10 }; private: @@ -296,7 +291,7 @@ private: char regstart; // Internal use only char reganch; // 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; int progsize; const char* searchstring; @@ -327,7 +322,7 @@ inline RegularExpression::RegularExpression (const char* s) * Creates a regular expression from string s, and * compiles s. */ -inline RegularExpression::RegularExpression (const kwsys_stl::string& s) +inline RegularExpression::RegularExpression (const std::string& s) { this->program = 0; this->compile(s); @@ -347,7 +342,7 @@ inline RegularExpression::~RegularExpression () * Compile a regular expression into internal code * 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()); } @@ -356,7 +351,7 @@ inline bool RegularExpression::compile (kwsys_stl::string const& s) * Matches the regular expression to the given std string. * 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()); } @@ -364,9 +359,9 @@ inline bool RegularExpression::find (kwsys_stl::string const& s) /** * 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( + return static_cast( 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. */ -inline kwsys_stl::string::size_type RegularExpression::end () const +inline std::string::size_type RegularExpression::end () const { - return static_cast( + return static_cast( 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. */ -inline kwsys_stl::string::size_type RegularExpression::start(int n) const +inline std::string::size_type RegularExpression::start(int n) const { - return static_cast( + return static_cast( 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. */ -inline kwsys_stl::string::size_type RegularExpression::end(int n) const +inline std::string::size_type RegularExpression::end(int n) const { - return static_cast( + return static_cast( this->endp[n] - searchstring); } /** * 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) { - return kwsys_stl::string(""); + return std::string(""); } else { - return kwsys_stl::string(this->startp[n], - static_cast( + return std::string(this->startp[n], + static_cast( this->endp[n] - this->startp[n])); } } } // namespace @KWSYS_NAMESPACE@ -/* Undefine temporary macro. */ -#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS -# undef kwsys_stl -#endif - #endif diff --git a/String.hxx.in b/String.hxx.in index 4386c9e..2e9aedb 100644 --- a/String.hxx.in +++ b/String.hxx.in @@ -12,7 +12,7 @@ #ifndef @KWSYS_NAMESPACE@_String_hxx #define @KWSYS_NAMESPACE@_String_hxx -#include <@KWSYS_NAMESPACE@/stl/string> +#include namespace @KWSYS_NAMESPACE@ { @@ -25,10 +25,10 @@ namespace @KWSYS_NAMESPACE@ * simply a subclass of this type with the same interface so that the * 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. */ - typedef @KWSYS_NAMESPACE@_stl::string stl_string; + typedef std::string stl_string; public: @@ -55,8 +55,8 @@ public: #if defined(__WATCOMC__) inline bool operator<(String const& l, String const& r) { - return (static_cast<@KWSYS_NAMESPACE@_stl::string const&>(l) < - static_cast<@KWSYS_NAMESPACE@_stl::string const&>(r)); + return (static_cast(l) < + static_cast(r)); } #endif diff --git a/SystemInformation.cxx b/SystemInformation.cxx index 6e81b0b..cddcc8d 100644 --- a/SystemInformation.cxx +++ b/SystemInformation.cxx @@ -35,14 +35,8 @@ // http://msdn.microsoft.com/en-us/library/ms683219(VS.85).aspx #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(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 // duplicate the above list of headers. @@ -50,14 +44,14 @@ # include "SystemInformation.hxx.in" # include "Process.h.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 +#include +#include +#include +#include +#include + #if defined(_WIN32) # include # if defined(_MSC_VER) && _MSC_VER >= 1800 @@ -325,11 +319,11 @@ public: const char * GetVendorString(); const char * GetVendorID(); - kwsys_stl::string GetTypeID(); - kwsys_stl::string GetFamilyID(); - kwsys_stl::string GetModelID(); - kwsys_stl::string GetModelName(); - kwsys_stl::string GetSteppingCode(); + std::string GetTypeID(); + std::string GetFamilyID(); + std::string GetModelID(); + std::string GetModelName(); + std::string GetSteppingCode(); const char * GetExtendedProcessorName(); const char * GetProcessorSerialNumber(); int GetProcessorCacheSize(); @@ -341,7 +335,7 @@ public: const char * GetOSName(); const char * GetHostname(); - int GetFullyQualifiedDomainName(kwsys_stl::string &fqdn); + int GetFullyQualifiedDomainName(std::string &fqdn); const char * GetOSRelease(); const char * GetOSVersion(); const char * GetOSPlatform(); @@ -379,7 +373,7 @@ public: // get current stack static - kwsys_stl::string GetProgramStack(int firstFrame, int wholePath); + std::string GetProgramStack(int firstFrame, int wholePath); /** Run the different checks */ void RunCPUCheck(); @@ -395,10 +389,10 @@ public: int Revision; int ExtendedFamily; int ExtendedModel; - kwsys_stl::string ProcessorName; - kwsys_stl::string Vendor; - kwsys_stl::string SerialNumber; - kwsys_stl::string ModelName; + std::string ProcessorName; + std::string Vendor; + std::string SerialNumber; + std::string ModelName; } ID; typedef struct tagCPUPowerManagement @@ -480,7 +474,7 @@ protected: // For Linux and Cygwin, /proc/cpuinfo formats are slightly different bool RetreiveInformationFromCpuInfoFile(); - kwsys_stl::string ExtractValueFromCpuInfoFile(kwsys_stl::string buffer, + std::string ExtractValueFromCpuInfoFile(std::string buffer, const char* word, size_t init=0); bool QueryLinuxMemory(); @@ -489,20 +483,20 @@ protected: static void Delay (unsigned int); static void DelayOverhead (unsigned int); - void FindManufacturer(const kwsys_stl::string &family = ""); + void FindManufacturer(const std::string &family = ""); // For Mac bool ParseSysCtl(); - int CallSwVers(const char *arg, kwsys_stl::string &ver); - void TrimNewline(kwsys_stl::string&); - kwsys_stl::string ExtractValueFromSysCtl(const char* word); - kwsys_stl::string SysCtlBuffer; + int CallSwVers(const char *arg, std::string &ver); + void TrimNewline(std::string&); + std::string ExtractValueFromSysCtl(const char* word); + std::string SysCtlBuffer; // For Solaris bool QuerySolarisMemory(); bool QuerySolarisProcessor(); - kwsys_stl::string ParseValueFromKStat(const char* arguments); - kwsys_stl::string RunProcess(kwsys_stl::vector args); + std::string ParseValueFromKStat(const char* arguments); + std::string RunProcess(std::vector args); //For Haiku OS bool QueryHaikuInfo(); @@ -540,11 +534,11 @@ protected: // Operating System information bool QueryOSInformation(); - kwsys_stl::string OSName; - kwsys_stl::string Hostname; - kwsys_stl::string OSRelease; - kwsys_stl::string OSVersion; - kwsys_stl::string OSPlatform; + std::string OSName; + std::string Hostname; + std::string OSRelease; + std::string OSVersion; + std::string OSPlatform; }; @@ -568,27 +562,27 @@ const char * SystemInformation::GetVendorID() return this->Implementation->GetVendorID(); } -kwsys_stl::string SystemInformation::GetTypeID() +std::string SystemInformation::GetTypeID() { return this->Implementation->GetTypeID(); } -kwsys_stl::string SystemInformation::GetFamilyID() +std::string SystemInformation::GetFamilyID() { return this->Implementation->GetFamilyID(); } -kwsys_stl::string SystemInformation::GetModelID() +std::string SystemInformation::GetModelID() { return this->Implementation->GetModelID(); } -kwsys_stl::string SystemInformation::GetModelName() +std::string SystemInformation::GetModelName() { return this->Implementation->GetModelName(); } -kwsys_stl::string SystemInformation::GetSteppingCode() +std::string SystemInformation::GetSteppingCode() { return this->Implementation->GetSteppingCode(); } @@ -633,9 +627,9 @@ bool SystemInformation::DoesCPUSupportFeature(long int i) return this->Implementation->DoesCPUSupportFeature(i); } -kwsys_stl::string SystemInformation::GetCPUDescription() +std::string SystemInformation::GetCPUDescription() { - kwsys_ios::ostringstream oss; + std::ostringstream oss; oss << this->GetNumberOfPhysicalCPU() << " core "; @@ -654,9 +648,9 @@ kwsys_stl::string SystemInformation::GetCPUDescription() } // remove extra spaces - kwsys_stl::string tmp=oss.str(); + std::string tmp=oss.str(); size_t pos; - while( (pos=tmp.find(" "))!=kwsys_stl::string::npos) + while( (pos=tmp.find(" "))!=std::string::npos) { tmp.replace(pos,2," "); } @@ -674,9 +668,9 @@ const char * SystemInformation::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); return fqdn; } @@ -723,9 +717,9 @@ int SystemInformation::GetOSIsApple() #endif } -kwsys_stl::string SystemInformation::GetOSDescription() +std::string SystemInformation::GetOSDescription() { - kwsys_ios::ostringstream oss; + std::ostringstream oss; oss << this->GetOSName() << " " @@ -777,11 +771,11 @@ size_t SystemInformation::GetAvailablePhysicalMemory() return this->Implementation->GetAvailablePhysicalMemory(); } -kwsys_stl::string SystemInformation::GetMemoryDescription( +std::string SystemInformation::GetMemoryDescription( const char *hostLimitEnvVarName, const char *procLimitEnvVarName) { - kwsys_ios::ostringstream oss; + std::ostringstream oss; oss << "Host Total: " << iostreamLongLong(this->GetHostMemoryTotal()) @@ -842,7 +836,7 @@ void SystemInformation::SetStackTraceOnError(int 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); } @@ -926,7 +920,7 @@ namespace { #if defined(__linux) || defined(__APPLE__) int LoadLines( FILE *file, - kwsys_stl::vector &lines) + std::vector &lines) { // Load each line in the given file into a the vector. int nRead=0; @@ -963,7 +957,7 @@ int LoadLines( // ***************************************************************************** int LoadLines( const char *fileName, - kwsys_stl::vector &lines) + std::vector &lines) { FILE *file=fopen(fileName,"r"); if (file==0) @@ -979,18 +973,18 @@ int LoadLines( // **************************************************************************** template int NameValue( - kwsys_stl::vector &lines, - kwsys_stl::string name, T &value) + std::vector &lines, + std::string name, T &value) { size_t nLines=lines.size(); for (size_t i=0; i> value; return 0; } @@ -1006,7 +1000,7 @@ int GetFieldsFromFile( const char **fieldNames, T *values) { - kwsys_stl::vector fields; + std::vector fields; if (!LoadLines(fileName,fields)) { return -1; @@ -1056,7 +1050,7 @@ int GetFieldsFromCommand( { return -1; } - kwsys_stl::vector fields; + std::vector fields; int nl=LoadLines(file,fields); pclose(file); if (nl==0) @@ -1085,10 +1079,10 @@ void StacktraceSignalHandler( void * /*sigContext*/) { #if defined(__linux) || defined(__APPLE__) - kwsys_ios::ostringstream oss; + std::ostringstream oss; oss - << kwsys_ios::endl - << "=========================================================" << kwsys_ios::endl + << std::endl + << "=========================================================" << std::endl << "Process id " << getpid() << " "; switch (sigNo) { @@ -1281,11 +1275,11 @@ void StacktraceSignalHandler( break; } oss - << kwsys_ios::endl - << "Program Stack:" << kwsys_ios::endl + << std::endl + << "Program Stack:" << std::endl << SystemInformationImplementation::GetProgramStack(2,0) - << "=========================================================" << kwsys_ios::endl; - kwsys_ios::cerr << oss.str() << kwsys_ios::endl; + << "=========================================================" << std::endl; + std::cerr << oss.str() << std::endl; // restore the previously registered handlers // and abort @@ -1330,7 +1324,7 @@ public: void SetBinary(const char *binary) { this->Binary=safes(binary); } - kwsys_stl::string GetBinary() const; + std::string GetBinary() const; // Description: // Set the name of the function that the symbol is found in. @@ -1338,7 +1332,7 @@ public: void SetFunction(const char *function) { this->Function=this->Demangle(function); } - kwsys_stl::string GetFunction() const + std::string GetFunction() const { return this->Function; } // Description: @@ -1347,7 +1341,7 @@ public: void SetSourceFile(const char *sourcefile) { this->SourceFile=safes(sourcefile); } - kwsys_stl::string GetSourceFile() const + std::string GetSourceFile() const { return this->GetFileName(this->SourceFile); } // Description: @@ -1365,31 +1359,31 @@ private: void *GetRealAddress() const { return (void*)((char*)this->Address-(char*)this->BinaryBaseAddress); } - kwsys_stl::string GetFileName(const kwsys_stl::string &path) const; - kwsys_stl::string Demangle(const char *symbol) const; + std::string GetFileName(const std::string &path) const; + std::string Demangle(const char *symbol) const; private: - kwsys_stl::string Binary; + std::string Binary; void *BinaryBaseAddress; void *Address; - kwsys_stl::string SourceFile; - kwsys_stl::string Function; + std::string SourceFile; + std::string Function; long LineNumber; int ReportPath; }; // -------------------------------------------------------------------------- -kwsys_ios::ostream &operator<<( - kwsys_ios::ostream &os, +std::ostream &operator<<( + std::ostream &os, const SymbolProperties &sp) { #if defined(KWSYS_SYSTEMINFORMATION_HAS_SYMBOL_LOOKUP) os - << kwsys_ios::hex << sp.GetAddress() << " : " + << std::hex << sp.GetAddress() << " : " << sp.GetFunction() << " [(" << sp.GetBinary() << ") " << sp.GetSourceFile() << ":" - << kwsys_ios::dec << sp.GetLineNumber() << "]"; + << std::dec << sp.GetLineNumber() << "]"; #elif defined(KWSYS_SYSTEMINFORMATION_HAS_BACKTRACE) void *addr = sp.GetAddress(); 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) { 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; } // -------------------------------------------------------------------------- -kwsys_stl::string SymbolProperties::GetBinary() const +std::string SymbolProperties::GetBinary() const { // only linux has proc fs #if defined(__linux__) if (this->Binary=="/proc/self/exe") { - kwsys_stl::string binary; + std::string binary; char buf[1024]={'\0'}; ssize_t ll=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) int status = 0; size_t bufferLen = 1024; @@ -1729,7 +1723,7 @@ const char* SystemInformationImplementation::GetHostname() /** Get the FQDN */ int SystemInformationImplementation::GetFullyQualifiedDomainName( - kwsys_stl::string &fqdn) + std::string &fqdn) { // in the event of absolute failure return localhost. fqdn="localhost"; @@ -1820,8 +1814,8 @@ int SystemInformationImplementation::GetFullyQualifiedDomainName( continue; } - kwsys_stl::string candidate=host; - if ((candidate.find(base)!=kwsys_stl::string::npos) && baseSizeChipID.Type; return str.str(); } /** 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; return str.str(); } // 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; return str.str(); } // Return the model name of CPU present */ -kwsys_stl::string SystemInformationImplementation::GetModelName() +std::string SystemInformationImplementation::GetModelName() { return this->ChipID.ModelName; } /** 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; return str.str(); } @@ -2180,7 +2174,7 @@ bool SystemInformationImplementation::RetrieveCPUFeatures() /** 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. else if (this->ChipID.Vendor == "UMC UMC UMC ") this->ChipManufacturer = UMC; // United Microelectronics Corp. @@ -2799,11 +2793,11 @@ bool SystemInformationImplementation::RetrieveCPUPowerManagement() #if USE_CPUID // 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. - kwsys_stl::string::size_type pos = str.find_first_not_of(" "); - if(pos != kwsys_stl::string::npos) + std::string::size_type pos = str.find_first_not_of(" "); + if(pos != std::string::npos) { str = str.substr(pos); } @@ -3148,7 +3142,7 @@ bool SystemInformationImplementation::RetrieveClassicalCPUIdentity() /** 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); if(pos != buffer.npos) @@ -3180,12 +3174,12 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile() { this->NumberOfLogicalCPU = 0; this->NumberOfPhysicalCPU = 0; - kwsys_stl::string buffer; + std::string buffer; FILE *fd = fopen("/proc/cpuinfo", "r" ); if ( !fd ) { - kwsys_ios::cout << "Problem opening /proc/cpuinfo" << kwsys_ios::endl; + std::cout << "Problem opening /proc/cpuinfo" << std::endl; return false; } @@ -3209,7 +3203,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile() #ifdef __linux // Find the largest physical id. int maxId = -1; - kwsys_stl::string idc = + std::string idc = this->ExtractValueFromCpuInfoFile(buffer,"physical id"); while(this->CurrentPositionInFile != buffer.npos) { @@ -3224,7 +3218,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile() // Physical ids returned by Linux don't distinguish cores. // We want to record the total number of cores in this->NumberOfPhysicalCPU // (checking only the first proc) - kwsys_stl::string cores = + std::string cores = this->ExtractValueFromCpuInfoFile(buffer,"cpu cores"); int numberOfCoresPerCPU=atoi(cores.c_str()); if (maxId > 0) @@ -3242,7 +3236,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile() #else // __CYGWIN__ // does not have "physical id" entries, neither "cpu cores" // this has to be fixed for hyper-threading. - kwsys_stl::string cpucount = + std::string cpucount = this->ExtractValueFromCpuInfoFile(buffer,"cpu count"); this->NumberOfPhysicalCPU= this->NumberOfLogicalCPU = atoi(cpucount.c_str()); @@ -3258,7 +3252,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile() this->NumberOfLogicalCPU/this->NumberOfPhysicalCPU; // 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()) { this->CPUSpeedInMHz = static_cast(atof(CPUSpeed.c_str())); @@ -3274,7 +3268,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile() #endif // Chip family - kwsys_stl::string familyStr = + std::string familyStr = this->ExtractValueFromCpuInfoFile(buffer,"cpu family"); if(familyStr.empty()) { @@ -3304,7 +3298,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile() { // Some platforms (e.g. PA-RISC) tell us their CPU name here. // Note: x86 does not. - kwsys_stl::string cpuname = this->ExtractValueFromCpuInfoFile(buffer,"cpu"); + std::string cpuname = this->ExtractValueFromCpuInfoFile(buffer,"cpu"); if(!cpuname.empty()) { this->ChipID.ProcessorName = cpuname; @@ -3312,7 +3306,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile() } // Chip revision - kwsys_stl::string cpurev = this->ExtractValueFromCpuInfoFile(buffer,"stepping"); + std::string cpurev = this->ExtractValueFromCpuInfoFile(buffer,"stepping"); if(cpurev.empty()) { cpurev = this->ExtractValueFromCpuInfoFile(buffer,"CPU revision"); @@ -3325,7 +3319,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile() // L1 Cache size // Different architectures may show different names for the caches. // Sum up everything we find. - kwsys_stl::vector cachename; + std::vector cachename; cachename.clear(); cachename.push_back("cache size"); // e.g. x86 @@ -3335,7 +3329,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile() this->Features.L1CacheSize = 0; 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()) { pos = cacheSize.find(" KB"); @@ -3348,48 +3342,48 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile() } // processor feature flags (probably x86 specific) - kwsys_stl::string cpuflags = this->ExtractValueFromCpuInfoFile(buffer,"flags"); + std::string cpuflags = this->ExtractValueFromCpuInfoFile(buffer,"flags"); if(!cpurev.empty()) { // now we can match every flags as space + flag + space cpuflags = " " + cpuflags + " "; - if ((cpuflags.find(" fpu ")!=kwsys_stl::string::npos)) + if ((cpuflags.find(" fpu ")!=std::string::npos)) { this->Features.HasFPU = true; } - if ((cpuflags.find(" tsc ")!=kwsys_stl::string::npos)) + if ((cpuflags.find(" tsc ")!=std::string::npos)) { this->Features.HasTSC = true; } - if ((cpuflags.find(" mmx ")!=kwsys_stl::string::npos)) + if ((cpuflags.find(" mmx ")!=std::string::npos)) { this->Features.HasMMX = true; } - if ((cpuflags.find(" sse ")!=kwsys_stl::string::npos)) + if ((cpuflags.find(" sse ")!=std::string::npos)) { this->Features.HasSSE = true; } - if ((cpuflags.find(" sse2 ")!=kwsys_stl::string::npos)) + if ((cpuflags.find(" sse2 ")!=std::string::npos)) { this->Features.HasSSE2 = true; } - if ((cpuflags.find(" apic ")!=kwsys_stl::string::npos)) + if ((cpuflags.find(" apic ")!=std::string::npos)) { this->Features.HasAPIC = true; } - if ((cpuflags.find(" cmov ")!=kwsys_stl::string::npos)) + if ((cpuflags.find(" cmov ")!=std::string::npos)) { this->Features.HasCMOV = true; } - if ((cpuflags.find(" mtrr ")!=kwsys_stl::string::npos)) + if ((cpuflags.find(" mtrr ")!=std::string::npos)) { this->Features.HasMTRR = true; } - if ((cpuflags.find(" acpi ")!=kwsys_stl::string::npos)) + if ((cpuflags.find(" acpi ")!=std::string::npos)) { this->Features.HasACPI = true; } - if ((cpuflags.find(" 3dnow ")!=kwsys_stl::string::npos)) + if ((cpuflags.find(" 3dnow ")!=std::string::npos)) { this->Features.ExtendedFeatures.Has3DNow = true; } @@ -3645,7 +3639,7 @@ SystemInformationImplementation::GetProcMemoryUsed() #elif defined(__APPLE__) SystemInformation::LongLong memUsed=0; pid_t pid=getpid(); - kwsys_ios::ostringstream oss; + std::ostringstream oss; oss << "ps -o rss= -p " << pid; FILE *file=popen(oss.str().c_str(),"r"); if (file==0) @@ -3670,7 +3664,7 @@ SystemInformationImplementation::GetProcMemoryUsed() { return -2; } - kwsys_ios::istringstream iss(oss.str()); + std::istringstream iss(oss.str()); iss >> memUsed; return memUsed; #else @@ -3729,11 +3723,11 @@ SystemInformationImplementation::GetProcessId() return current program stack in a string demangle cxx symbols if possible. */ -kwsys_stl::string SystemInformationImplementation::GetProgramStack( +std::string SystemInformationImplementation::GetProgramStack( int firstFrame, int wholePath) { - kwsys_stl::string programStack = "" + std::string programStack = "" #if !defined(KWSYS_SYSTEMINFORMATION_HAS_BACKTRACE) "WARNING: The stack could not be examined " "because backtrace is not supported.\n" @@ -3752,7 +3746,7 @@ kwsys_stl::string SystemInformationImplementation::GetProgramStack( #endif ; - kwsys_ios::ostringstream oss; + std::ostringstream oss; #if defined(KWSYS_SYSTEMINFORMATION_HAS_BACKTRACE) void *stackSymbols[256]; int nFrames=backtrace(stackSymbols,256); @@ -3761,7 +3755,7 @@ kwsys_stl::string SystemInformationImplementation::GetProgramStack( SymbolProperties symProps; symProps.SetReportPath(wholePath); symProps.Initialize(stackSymbols[i]); - oss << symProps << kwsys_ios::endl; + oss << symProps << std::endl; } #else (void)firstFrame; @@ -3892,7 +3886,7 @@ bool SystemInformationImplementation::QueryLinuxMemory() int errorFlag = uname(&unameInfo); 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; } @@ -3916,7 +3910,7 @@ bool SystemInformationImplementation::QueryLinuxMemory() FILE *fd = fopen("/proc/meminfo", "r" ); if ( !fd ) { - kwsys_ios::cout << "Problem opening /proc/meminfo" << kwsys_ios::endl; + std::cout << "Problem opening /proc/meminfo" << std::endl; return false; } @@ -3954,7 +3948,7 @@ bool SystemInformationImplementation::QueryLinuxMemory() } else { - kwsys_ios::cout << "Problem parsing /proc/meminfo" << kwsys_ios::endl; + std::cout << "Problem parsing /proc/meminfo" << std::endl; fclose(fd); return false; } @@ -3987,7 +3981,7 @@ bool SystemInformationImplementation::QueryLinuxMemory() } else { - kwsys_ios::cout << "Problem parsing /proc/meminfo" << kwsys_ios::endl; + std::cout << "Problem parsing /proc/meminfo" << std::endl; fclose(fd); return false; } @@ -4464,8 +4458,8 @@ bool SystemInformationImplementation::ParseSysCtl() ::memset(retBuf, 0, 128); len = 32; err = sysctlbyname("hw.machine", &retBuf, &len, NULL, 0); - kwsys_stl::string machineBuf(retBuf); - if (machineBuf.find_first_of("Power") != kwsys_stl::string::npos) + std::string machineBuf(retBuf); + if (machineBuf.find_first_of("Power") != std::string::npos) { this->ChipID.Vendor = "IBM"; len = sizeof(this->ChipID.Family); @@ -4527,41 +4521,41 @@ bool SystemInformationImplementation::ParseSysCtl() { // now we can match every flags as space + flag + space 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; } - if ((cpuflags.find(" TSC ")!=kwsys_stl::string::npos)) + if ((cpuflags.find(" TSC ")!=std::string::npos)) { this->Features.HasTSC = true; } - if ((cpuflags.find(" MMX ")!=kwsys_stl::string::npos)) + if ((cpuflags.find(" MMX ")!=std::string::npos)) { this->Features.HasMMX = true; } - if ((cpuflags.find(" SSE ")!=kwsys_stl::string::npos)) + if ((cpuflags.find(" SSE ")!=std::string::npos)) { this->Features.HasSSE = true; } - if ((cpuflags.find(" SSE2 ")!=kwsys_stl::string::npos)) + if ((cpuflags.find(" SSE2 ")!=std::string::npos)) { this->Features.HasSSE2 = true; } - if ((cpuflags.find(" APIC ")!=kwsys_stl::string::npos)) + if ((cpuflags.find(" APIC ")!=std::string::npos)) { this->Features.HasAPIC = true; } - if ((cpuflags.find(" CMOV ")!=kwsys_stl::string::npos)) + if ((cpuflags.find(" CMOV ")!=std::string::npos)) { this->Features.HasCMOV = true; } - if ((cpuflags.find(" MTRR ")!=kwsys_stl::string::npos)) + if ((cpuflags.find(" MTRR ")!=std::string::npos)) { this->Features.HasMTRR = true; } - if ((cpuflags.find(" ACPI ")!=kwsys_stl::string::npos)) + if ((cpuflags.find(" ACPI ")!=std::string::npos)) { this->Features.HasACPI = true; } @@ -4595,7 +4589,7 @@ bool SystemInformationImplementation::ParseSysCtl() /** 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); if(pos != this->SysCtlBuffer.npos) @@ -4612,9 +4606,9 @@ kwsys_stl::string SystemInformationImplementation::ExtractValueFromSysCtl(const /** Run a given process */ -kwsys_stl::string SystemInformationImplementation::RunProcess(kwsys_stl::vector args) +std::string SystemInformationImplementation::RunProcess(std::vector args) { - kwsys_stl::string buffer = ""; + std::string buffer = ""; // Run the application kwsysProcess* gp = kwsysProcess_New(); @@ -4644,12 +4638,12 @@ kwsys_stl::string SystemInformationImplementation::RunProcess(kwsys_stl::vector< } break; case kwsysProcess_State_Error: { - kwsys_ios::cerr << "Error: Could not run " << args[0] << ":\n"; - kwsys_ios::cerr << kwsysProcess_GetErrorString(gp) << "\n"; + std::cerr << "Error: Could not run " << args[0] << ":\n"; + std::cerr << kwsysProcess_GetErrorString(gp) << "\n"; } break; case kwsysProcess_State_Exception: { - kwsys_ios::cerr << "Error: " << args[0] + std::cerr << "Error: " << args[0] << " terminated with an exception: " << kwsysProcess_GetExceptionString(gp) << "\n"; } break; @@ -4659,27 +4653,27 @@ kwsys_stl::string SystemInformationImplementation::RunProcess(kwsys_stl::vector< case kwsysProcess_State_Killed: { // Should not get here. - kwsys_ios::cerr << "Unexpected ending state after running " << args[0] - << kwsys_ios::endl; + std::cerr << "Unexpected ending state after running " << args[0] + << std::endl; } break; } kwsysProcess_Delete(gp); if(result) { - kwsys_ios::cerr << "Error " << args[0] << " returned :" << result << "\n"; + std::cerr << "Error " << args[0] << " returned :" << result << "\n"; } return buffer; } -kwsys_stl::string SystemInformationImplementation::ParseValueFromKStat(const char* arguments) +std::string SystemInformationImplementation::ParseValueFromKStat(const char* arguments) { - kwsys_stl::vector args; + std::vector args; args.clear(); args.push_back("kstat"); args.push_back("-p"); - kwsys_stl::string command = arguments; + std::string command = arguments; size_t start = command.npos; size_t pos = command.find(' ',0); while(pos!=command.npos) @@ -4701,7 +4695,7 @@ kwsys_stl::string SystemInformationImplementation::ParseValueFromKStat(const cha 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 size_t quotes = arg.find('"'); @@ -4715,14 +4709,14 @@ kwsys_stl::string SystemInformationImplementation::ParseValueFromKStat(const cha } 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(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--) { if(buffer[i] == ' ' || buffer[i] == '\t') @@ -4731,7 +4725,7 @@ kwsys_stl::string SystemInformationImplementation::ParseValueFromKStat(const cha } if(buffer[i] != '\n' && buffer[i] != '\r') { - kwsys_stl::string val = value; + std::string val = value; value = buffer[i]; value += val; } @@ -4885,8 +4879,8 @@ bool SystemInformationImplementation::QueryHaikuInfo() bool SystemInformationImplementation::QueryQNXMemory() { #if defined(__QNX__) - kwsys_stl::string buffer; - kwsys_stl::vector args; + std::string buffer; + std::vector args; args.clear(); args.push_back("showmem"); @@ -4943,8 +4937,8 @@ bool SystemInformationImplementation::QueryQNXProcessor() #if defined(__QNX__) // the output on my QNX 6.4.1 looks like this: // Processor1: 686 Pentium II Stepping 3 2175MHz FPU - kwsys_stl::string buffer; - kwsys_stl::vector args; + std::string buffer; + std::vector args; args.clear(); args.push_back("pidin"); @@ -5440,10 +5434,10 @@ bool SystemInformationImplementation::QueryOSInformation() int SystemInformationImplementation::CallSwVers( const char *arg, - kwsys_stl::string &ver) + std::string &ver) { #ifdef __APPLE__ - kwsys_stl::vector args; + std::vector args; args.push_back("sw_vers"); args.push_back(arg); args.push_back(0); @@ -5457,18 +5451,18 @@ int SystemInformationImplementation::CallSwVers( return 0; } -void SystemInformationImplementation::TrimNewline(kwsys_stl::string& output) +void SystemInformationImplementation::TrimNewline(std::string& output) { // remove \r - kwsys_stl::string::size_type pos=0; - while((pos = output.find("\r", pos)) != kwsys_stl::string::npos) + std::string::size_type pos=0; + while((pos = output.find("\r", pos)) != std::string::npos) { output.erase(pos); } // remove \n pos = 0; - while((pos = output.find("\n", pos)) != kwsys_stl::string::npos) + while((pos = output.find("\n", pos)) != std::string::npos) { output.erase(pos); } diff --git a/SystemInformation.hxx.in b/SystemInformation.hxx.in index 4acdc4f..7c45388 100644 --- a/SystemInformation.hxx.in +++ b/SystemInformation.hxx.in @@ -12,14 +12,9 @@ #ifndef @KWSYS_NAMESPACE@_SystemInformation_h #define @KWSYS_NAMESPACE@_SystemInformation_h - -/* 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 <@KWSYS_NAMESPACE@/Configure.hxx> #include /* size_t */ +#include namespace @KWSYS_NAMESPACE@ { @@ -45,11 +40,11 @@ public: const char * GetVendorString(); const char * GetVendorID(); - kwsys_stl::string GetTypeID(); - kwsys_stl::string GetFamilyID(); - kwsys_stl::string GetModelID(); - kwsys_stl::string GetModelName(); - kwsys_stl::string GetSteppingCode(); + std::string GetTypeID(); + std::string GetFamilyID(); + std::string GetModelID(); + std::string GetModelName(); + std::string GetSteppingCode(); const char * GetExtendedProcessorName(); const char * GetProcessorSerialNumber(); int GetProcessorCacheSize(); @@ -61,10 +56,10 @@ public: // returns an informative general description of the cpu // on this system. - kwsys_stl::string GetCPUDescription(); + std::string GetCPUDescription(); const char * GetHostname(); - kwsys_stl::string GetFullyQualifiedDomainName(); + std::string GetFullyQualifiedDomainName(); const char * GetOSName(); const char * GetOSRelease(); @@ -77,7 +72,7 @@ public: // returns an informative general description of the os // on this system. - kwsys_stl::string GetOSDescription(); + std::string GetOSDescription(); bool Is64Bits(); @@ -98,7 +93,7 @@ public: // returns an informative general description if the installed and // available ram on this system. See the GetHostMmeoryTotal, and // Get{Host,Proc}MemoryAvailable methods for more information. - kwsys_stl::string GetMemoryDescription( + std::string GetMemoryDescription( const char *hostLimitEnvVarName=NULL, const char *procLimitEnvVarName=NULL); @@ -144,7 +139,7 @@ public: // order to produce an informative stack trace the application // should be dynamically linked and compiled with debug symbols. static - kwsys_stl::string GetProgramStack(int firstFrame, int wholePath); + std::string GetProgramStack(int firstFrame, int wholePath); /** Run the different checks */ void RunCPUCheck(); @@ -154,10 +149,4 @@ public: } // namespace @KWSYS_NAMESPACE@ -/* Undefine temporary macros. */ -#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS -# undef kwsys_stl -# undef kwsys_ios -#endif - #endif diff --git a/SystemTools.cxx b/SystemTools.cxx index f12a06c..97a1df8 100644 --- a/SystemTools.cxx +++ b/SystemTools.cxx @@ -31,11 +31,10 @@ #include KWSYS_HEADER(FStream.hxx) #include KWSYS_HEADER(Encoding.hxx) -#include KWSYS_HEADER(ios/iostream) -#include KWSYS_HEADER(ios/fstream) -#include KWSYS_HEADER(ios/sstream) - -#include KWSYS_HEADER(stl/set) +#include +#include +#include +#include // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. @@ -44,9 +43,6 @@ # include "Directory.hxx.in" # include "FStream.hxx.in" # include "Encoding.hxx.in" -# include "kwsys_ios_iostream.h.in" -# include "kwsys_ios_fstream.h.in" -# include "kwsys_ios_sstream.h.in" #endif #ifdef _MSC_VER @@ -220,12 +216,12 @@ static time_t windows_filetime_to_posix_time(const FILETIME& ft) #ifdef KWSYS_WINDOWS_DIRS #include -inline int Mkdir(const kwsys_stl::string& dir) +inline int Mkdir(const std::string& dir) { return _wmkdir( KWSYS_NAMESPACE::SystemTools::ConvertToWindowsExtendedPath(dir).c_str()); } -inline int Rmdir(const kwsys_stl::string& dir) +inline int Rmdir(const std::string& dir) { return _wrmdir( KWSYS_NAMESPACE::SystemTools::ConvertToWindowsExtendedPath(dir).c_str()); @@ -246,7 +242,7 @@ inline const char* Getcwd(char* buf, unsigned int len) } return 0; } -inline int Chdir(const kwsys_stl::string& dir) +inline int Chdir(const std::string& dir) { #if defined(__BORLANDC__) return chdir(dir.c_str()); @@ -254,11 +250,11 @@ inline int Chdir(const kwsys_stl::string& dir) return _wchdir(KWSYS_NAMESPACE::Encoding::ToWide(dir).c_str()); #endif } -inline void Realpath(const kwsys_stl::string& path, - kwsys_stl::string& resolved_path, - kwsys_stl::string* errorMessage = 0) +inline void Realpath(const std::string& path, + std::string& resolved_path, + std::string* errorMessage = 0) { - kwsys_stl::wstring tmp = KWSYS_NAMESPACE::Encoding::ToWide(path); + std::wstring tmp = KWSYS_NAMESPACE::Encoding::ToWide(path); wchar_t *ptemp; wchar_t fullpath[MAX_PATH]; DWORD bufferLen = GetFullPathNameW(tmp.c_str(), @@ -303,11 +299,11 @@ inline void Realpath(const kwsys_stl::string& path, #include #include #include -inline int Mkdir(const kwsys_stl::string& dir) +inline int Mkdir(const std::string& dir) { return mkdir(dir.c_str(), 00777); } -inline int Rmdir(const kwsys_stl::string& dir) +inline int Rmdir(const std::string& dir) { return rmdir(dir.c_str()); } @@ -316,13 +312,13 @@ inline const char* Getcwd(char* buf, unsigned int len) return getcwd(buf, len); } -inline int Chdir(const kwsys_stl::string& dir) +inline int Chdir(const std::string& dir) { return chdir(dir.c_str()); } -inline void Realpath(const kwsys_stl::string& path, - kwsys_stl::string& resolved_path, - kwsys_stl::string* errorMessage = 0) +inline void Realpath(const std::string& path, + std::string& resolved_path, + std::string* errorMessage = 0) { char resolved_name[KWSYS_SYSTEMTOOLS_MAXPATH]; @@ -385,14 +381,14 @@ double SystemTools::GetTime(void) } class SystemToolsTranslationMap : - public kwsys_stl::map + public std::map { }; #ifdef _WIN32 struct SystemToolsPathCaseCmp { - bool operator()(kwsys_stl::string const& l, kwsys_stl::string const& r) const + bool operator()(std::string const& l, std::string const& r) const { # ifdef _MSC_VER return _stricmp(l.c_str(), r.c_str()) < 0; @@ -405,12 +401,12 @@ struct SystemToolsPathCaseCmp }; class SystemToolsPathCaseMap: - public kwsys_stl::map {}; #endif // adds the elements of the env variable path to the arg passed in -void SystemTools::GetPath(kwsys_stl::vector& path, const char* env) +void SystemTools::GetPath(std::vector& path, const char* env) { #if defined(_WIN32) && !defined(__CYGWIN__) const char pathSep = ';'; @@ -427,19 +423,19 @@ void SystemTools::GetPath(kwsys_stl::vector& path, const char return; } - kwsys_stl::string pathEnv = cpathEnv; + std::string pathEnv = cpathEnv; // A hack to make the below algorithm work. if(!pathEnv.empty() && *pathEnv.rbegin() != pathSep) { pathEnv += pathSep; } - kwsys_stl::string::size_type start =0; + std::string::size_type start =0; bool done = false; while(!done) { - kwsys_stl::string::size_type endpos = pathEnv.find(pathSep, start); - if(endpos != kwsys_stl::string::npos) + std::string::size_type endpos = pathEnv.find(pathSep, start); + if(endpos != std::string::npos) { path.push_back(pathEnv.substr(start, endpos-start)); start = endpos+1; @@ -449,7 +445,7 @@ void SystemTools::GetPath(kwsys_stl::vector& path, const char done = true; } } - for(kwsys_stl::vector::iterator i = path.begin(); + for(std::vector::iterator i = path.begin(); i != path.end(); ++i) { SystemTools::ConvertToUnixSlashes(*i); @@ -461,12 +457,12 @@ const char* SystemTools::GetEnv(const char* key) return getenv(key); } -const char* SystemTools::GetEnv(const kwsys_stl::string& key) +const char* SystemTools::GetEnv(const std::string& key) { return SystemTools::GetEnv(key.c_str()); } -bool SystemTools::GetEnv(const char* key, kwsys_stl::string& result) +bool SystemTools::GetEnv(const char* key, std::string& result) { const char* v = getenv(key); if(v) @@ -480,7 +476,7 @@ bool SystemTools::GetEnv(const char* key, kwsys_stl::string& result) } } -bool SystemTools::GetEnv(const kwsys_stl::string& key, kwsys_stl::string& result) +bool SystemTools::GetEnv(const std::string& key, std::string& result) { return SystemTools::GetEnv(key.c_str(), result); } @@ -496,7 +492,7 @@ bool SystemTools::GetEnv(const kwsys_stl::string& key, kwsys_stl::string& result #if KWSYS_CXX_HAS_UNSETENV /* unsetenv("A") removes A from the environment. On older platforms it returns void instead of int. */ -static int kwsysUnPutEnv(const kwsys_stl::string& env) +static int kwsysUnPutEnv(const std::string& env) { size_t pos = env.find('='); if(pos != env.npos) @@ -513,7 +509,7 @@ static int kwsysUnPutEnv(const kwsys_stl::string& env) #elif defined(KWSYS_PUTENV_EMPTY) || defined(KWSYS_PUTENV_NAME) /* putenv("A=") or putenv("A") removes A from the environment. */ -static int kwsysUnPutEnv(const kwsys_stl::string& env) +static int kwsysUnPutEnv(const std::string& env) { int err = 0; size_t pos = env.find('='); @@ -558,7 +554,7 @@ static int kwsysUnPutEnv(const kwsys_stl::string& env) #else /* Manipulate the "environ" global directly. */ -static int kwsysUnPutEnv(const kwsys_stl::string& env) +static int kwsysUnPutEnv(const std::string& env) { size_t pos = env.find('='); size_t const len = pos == env.npos ? env.size() : pos; @@ -591,7 +587,7 @@ static int kwsysUnPutEnv(const kwsys_stl::string& env) /* setenv("A", "B", 1) will set A=B in the environment and makes its own copies of the strings. */ -bool SystemTools::PutEnv(const kwsys_stl::string& env) +bool SystemTools::PutEnv(const std::string& env) { size_t pos = env.find('='); if(pos != env.npos) @@ -605,7 +601,7 @@ bool SystemTools::PutEnv(const kwsys_stl::string& env) } } -bool SystemTools::UnPutEnv(const kwsys_stl::string& env) +bool SystemTools::UnPutEnv(const std::string& env) { return kwsysUnPutEnv(env) == 0; } @@ -643,7 +639,7 @@ struct kwsysEnvCompare } }; -class kwsysEnv: public kwsys_stl::set +class kwsysEnv: public std::set { class Free { @@ -653,7 +649,7 @@ class kwsysEnv: public kwsys_stl::set ~Free() { free(const_cast(this->Env)); } }; public: - typedef kwsys_stl::set derived; + typedef std::set derived; ~kwsysEnv() { for(derived::iterator i = this->begin(); i != this->end(); ++i) @@ -691,12 +687,12 @@ public: static kwsysEnv kwsysEnvInstance; -bool SystemTools::PutEnv(const kwsys_stl::string& env) +bool SystemTools::PutEnv(const std::string& env) { return kwsysEnvInstance.Put(env.c_str()); } -bool SystemTools::UnPutEnv(const kwsys_stl::string& env) +bool SystemTools::UnPutEnv(const std::string& env) { return kwsysEnvInstance.UnPut(env.c_str()); } @@ -714,7 +710,7 @@ const char* SystemTools::GetExecutableExtension() #endif } -FILE* SystemTools::Fopen(const kwsys_stl::string& file, const char* mode) +FILE* SystemTools::Fopen(const std::string& file, const char* mode) { #ifdef _WIN32 return _wfopen(SystemTools::ConvertToWindowsExtendedPath(file).c_str(), @@ -730,10 +726,10 @@ bool SystemTools::MakeDirectory(const char* path) { return false; } - return SystemTools::MakeDirectory(kwsys_stl::string(path)); + return SystemTools::MakeDirectory(std::string(path)); } -bool SystemTools::MakeDirectory(const kwsys_stl::string& path) +bool SystemTools::MakeDirectory(const std::string& path) { if(SystemTools::FileExists(path)) { @@ -743,12 +739,12 @@ bool SystemTools::MakeDirectory(const kwsys_stl::string& path) { return false; } - kwsys_stl::string dir = path; + std::string dir = path; SystemTools::ConvertToUnixSlashes(dir); - kwsys_stl::string::size_type pos = 0; - kwsys_stl::string topdir; - while((pos = dir.find('/', pos)) != kwsys_stl::string::npos) + std::string::size_type pos = 0; + std::string topdir; + while((pos = dir.find('/', pos)) != std::string::npos) { topdir = dir.substr(0, pos); Mkdir(topdir); @@ -776,9 +772,9 @@ bool SystemTools::MakeDirectory(const kwsys_stl::string& path) // replace replace with with as many times as it shows up in source. // write the result into source. -void SystemTools::ReplaceString(kwsys_stl::string& source, - const kwsys_stl::string& replace, - const kwsys_stl::string& with) +void SystemTools::ReplaceString(std::string& source, + const std::string& replace, + const std::string& with) { // do while hangs if replaceSize is 0 if (replace.empty()) @@ -789,7 +785,7 @@ void SystemTools::ReplaceString(kwsys_stl::string& source, SystemTools::ReplaceString(source, replace.c_str(), replace.size(), with); } -void SystemTools::ReplaceString(kwsys_stl::string& source, +void SystemTools::ReplaceString(std::string& source, const char* replace, const char* with) { @@ -802,10 +798,10 @@ void SystemTools::ReplaceString(kwsys_stl::string& source, SystemTools::ReplaceString(source, replace, strlen(replace), with ? with : ""); } -void SystemTools::ReplaceString(kwsys_stl::string& source, +void SystemTools::ReplaceString(std::string& source, const char* replace, size_t replaceSize, - const kwsys_stl::string& with) + const std::string& with) { const char *src = source.c_str(); char *searchPos = const_cast(strstr(src,replace)); @@ -848,21 +844,21 @@ void SystemTools::ReplaceString(kwsys_stl::string& source, #endif #if defined(_WIN32) && !defined(__CYGWIN__) -static bool SystemToolsParseRegistryKey(const kwsys_stl::string& key, +static bool SystemToolsParseRegistryKey(const std::string& key, HKEY& primaryKey, - kwsys_stl::string& second, - kwsys_stl::string& valuename) + std::string& second, + std::string& valuename) { - kwsys_stl::string primary = key; + std::string primary = key; size_t start = primary.find('\\'); - if (start == kwsys_stl::string::npos) + if (start == std::string::npos) { return false; } size_t valuenamepos = primary.find(';'); - if (valuenamepos != kwsys_stl::string::npos) + if (valuenamepos != std::string::npos) { valuename = primary.substr(valuenamepos+1); } @@ -919,13 +915,13 @@ static DWORD SystemToolsMakeRegistryMode(DWORD mode, #if defined(_WIN32) && !defined(__CYGWIN__) bool -SystemTools::GetRegistrySubKeys(const kwsys_stl::string& key, - kwsys_stl::vector& subkeys, +SystemTools::GetRegistrySubKeys(const std::string& key, + std::vector& subkeys, KeyWOW64 view) { HKEY primaryKey = HKEY_CURRENT_USER; - kwsys_stl::string second; - kwsys_stl::string valuename; + std::string second; + std::string valuename; if (!SystemToolsParseRegistryKey(key, primaryKey, second, valuename)) { return false; @@ -958,8 +954,8 @@ SystemTools::GetRegistrySubKeys(const kwsys_stl::string& key, return true; } #else -bool SystemTools::GetRegistrySubKeys(const kwsys_stl::string&, - kwsys_stl::vector&, +bool SystemTools::GetRegistrySubKeys(const std::string&, + std::vector&, KeyWOW64) { return false; @@ -974,13 +970,13 @@ bool SystemTools::GetRegistrySubKeys(const kwsys_stl::string&, // => will return the data of the "Root" value of the key #if defined(_WIN32) && !defined(__CYGWIN__) -bool SystemTools::ReadRegistryValue(const kwsys_stl::string& key, kwsys_stl::string &value, +bool SystemTools::ReadRegistryValue(const std::string& key, std::string &value, KeyWOW64 view) { bool valueset = false; HKEY primaryKey = HKEY_CURRENT_USER; - kwsys_stl::string second; - kwsys_stl::string valuename; + std::string second; + std::string valuename; if (!SystemToolsParseRegistryKey(key, primaryKey, second, valuename)) { return false; @@ -1031,7 +1027,7 @@ bool SystemTools::ReadRegistryValue(const kwsys_stl::string& key, kwsys_stl::str return valueset; } #else -bool SystemTools::ReadRegistryValue(const kwsys_stl::string&, kwsys_stl::string &, +bool SystemTools::ReadRegistryValue(const std::string&, std::string &, KeyWOW64) { return false; @@ -1047,13 +1043,13 @@ bool SystemTools::ReadRegistryValue(const kwsys_stl::string&, kwsys_stl::string // => will set the data of the "Root" value of the key #if defined(_WIN32) && !defined(__CYGWIN__) -bool SystemTools::WriteRegistryValue(const kwsys_stl::string& key, - const kwsys_stl::string& value, +bool SystemTools::WriteRegistryValue(const std::string& key, + const std::string& value, KeyWOW64 view) { HKEY primaryKey = HKEY_CURRENT_USER; - kwsys_stl::string second; - kwsys_stl::string valuename; + std::string second; + std::string valuename; if (!SystemToolsParseRegistryKey(key, primaryKey, second, valuename)) { return false; @@ -1088,7 +1084,7 @@ bool SystemTools::WriteRegistryValue(const kwsys_stl::string& key, return false; } #else -bool SystemTools::WriteRegistryValue(const kwsys_stl::string&, const kwsys_stl::string&, KeyWOW64) +bool SystemTools::WriteRegistryValue(const std::string&, const std::string&, KeyWOW64) { return false; } @@ -1102,11 +1098,11 @@ bool SystemTools::WriteRegistryValue(const kwsys_stl::string&, const kwsys_stl:: // => will delete the data of the "Root" value of the key #if defined(_WIN32) && !defined(__CYGWIN__) -bool SystemTools::DeleteRegistryValue(const kwsys_stl::string& key, KeyWOW64 view) +bool SystemTools::DeleteRegistryValue(const std::string& key, KeyWOW64 view) { HKEY primaryKey = HKEY_CURRENT_USER; - kwsys_stl::string second; - kwsys_stl::string valuename; + std::string second; + std::string valuename; if (!SystemToolsParseRegistryKey(key, primaryKey, second, valuename)) { return false; @@ -1133,13 +1129,13 @@ bool SystemTools::DeleteRegistryValue(const kwsys_stl::string& key, KeyWOW64 vie return false; } #else -bool SystemTools::DeleteRegistryValue(const kwsys_stl::string&, KeyWOW64) +bool SystemTools::DeleteRegistryValue(const std::string&, KeyWOW64) { return false; } #endif -bool SystemTools::SameFile(const kwsys_stl::string& file1, const kwsys_stl::string& file2) +bool SystemTools::SameFile(const std::string& file1, const std::string& file2) { #ifdef _WIN32 HANDLE hFile1, hFile2; @@ -1207,11 +1203,11 @@ bool SystemTools::FileExists(const char* filename) { return false; } - return SystemTools::FileExists(kwsys_stl::string(filename)); + return SystemTools::FileExists(std::string(filename)); } //---------------------------------------------------------------------------- -bool SystemTools::FileExists(const kwsys_stl::string& filename) +bool SystemTools::FileExists(const std::string& filename) { if(filename.empty()) { @@ -1241,11 +1237,11 @@ bool SystemTools::FileExists(const char* filename, bool isFile) { return false; } - return SystemTools::FileExists(kwsys_stl::string(filename), isFile); + return SystemTools::FileExists(std::string(filename), isFile); } //---------------------------------------------------------------------------- -bool SystemTools::FileExists(const kwsys_stl::string& filename, bool isFile) +bool SystemTools::FileExists(const std::string& filename, bool isFile) { if(SystemTools::FileExists(filename)) { @@ -1264,12 +1260,12 @@ bool SystemTools::TestFileAccess(const char* filename, { return false; } - return SystemTools::TestFileAccess(kwsys_stl::string(filename), + return SystemTools::TestFileAccess(std::string(filename), permissions); } //---------------------------------------------------------------------------- -bool SystemTools::TestFileAccess(const kwsys_stl::string& filename, +bool SystemTools::TestFileAccess(const std::string& filename, TestFilePermissions permissions) { if(filename.empty()) @@ -1317,7 +1313,7 @@ bool SystemTools::PathCygwinToWin32(const char *path, char *win32_path) } #endif -bool SystemTools::Touch(const kwsys_stl::string& filename, bool create) +bool SystemTools::Touch(const std::string& filename, bool create) { if (!SystemTools::FileExists(filename)) { @@ -1393,8 +1389,8 @@ bool SystemTools::Touch(const kwsys_stl::string& filename, bool create) return true; } -bool SystemTools::FileTimeCompare(const kwsys_stl::string& f1, - const kwsys_stl::string& f2, +bool SystemTools::FileTimeCompare(const std::string& f1, + const std::string& f2, int* result) { // Default to same time. @@ -1466,26 +1462,26 @@ bool SystemTools::FileTimeCompare(const kwsys_stl::string& f1, // Return a capitalized string (i.e the first letter is uppercased, all other // are lowercased) -kwsys_stl::string SystemTools::Capitalized(const kwsys_stl::string& s) +std::string SystemTools::Capitalized(const std::string& s) { - kwsys_stl::string n; + std::string n; if(s.empty()) { return n; } n.resize(s.size()); - n[0] = static_cast(toupper(s[0])); + n[0] = static_cast(toupper(s[0])); for (size_t i = 1; i < s.size(); i++) { - n[i] = static_cast(tolower(s[i])); + n[i] = static_cast(tolower(s[i])); } return n; } // Return capitalized words -kwsys_stl::string SystemTools::CapitalizedWords(const kwsys_stl::string& s) +std::string SystemTools::CapitalizedWords(const std::string& s) { - kwsys_stl::string n(s); + std::string n(s); for (size_t i = 0; i < s.size(); i++) { #if defined(_MSC_VER) && defined (_MT) && defined (_DEBUG) @@ -1497,16 +1493,16 @@ kwsys_stl::string SystemTools::CapitalizedWords(const kwsys_stl::string& s) if (isalpha(s[i]) && (i == 0 || isspace(s[i - 1]))) #endif { - n[i] = static_cast(toupper(s[i])); + n[i] = static_cast(toupper(s[i])); } } return n; } // Return uncapitalized words -kwsys_stl::string SystemTools::UnCapitalizedWords(const kwsys_stl::string& s) +std::string SystemTools::UnCapitalizedWords(const std::string& s) { - kwsys_stl::string n(s); + std::string n(s); for (size_t i = 0; i < s.size(); i++) { #if defined(_MSC_VER) && defined (_MT) && defined (_DEBUG) @@ -1518,17 +1514,17 @@ kwsys_stl::string SystemTools::UnCapitalizedWords(const kwsys_stl::string& s) if (isalpha(s[i]) && (i == 0 || isspace(s[i - 1]))) #endif { - n[i] = static_cast(tolower(s[i])); + n[i] = static_cast(tolower(s[i])); } } return n; } // only works for words with at least two letters -kwsys_stl::string SystemTools::AddSpaceBetweenCapitalizedWords( - const kwsys_stl::string& s) +std::string SystemTools::AddSpaceBetweenCapitalizedWords( + const std::string& s) { - kwsys_stl::string n; + std::string n; if (!s.empty()) { n.reserve(s.size()); @@ -1595,25 +1591,25 @@ char* SystemTools::AppendStrings( } // Return a lower case string -kwsys_stl::string SystemTools::LowerCase(const kwsys_stl::string& s) +std::string SystemTools::LowerCase(const std::string& s) { - kwsys_stl::string n; + std::string n; n.resize(s.size()); for (size_t i = 0; i < s.size(); i++) { - n[i] = static_cast(tolower(s[i])); + n[i] = static_cast(tolower(s[i])); } return n; } // Return a lower case string -kwsys_stl::string SystemTools::UpperCase(const kwsys_stl::string& s) +std::string SystemTools::UpperCase(const std::string& s) { - kwsys_stl::string n; + std::string n; n.resize(s.size()); for (size_t i = 0; i < s.size(); i++) { - n[i] = static_cast(toupper(s[i])); + n[i] = static_cast(toupper(s[i])); } return n; } @@ -1719,7 +1715,7 @@ bool SystemTools::StringStartsWith(const char* str1, const char* str2) } // Returns if string starts with another string -bool SystemTools::StringStartsWith(const kwsys_stl::string& str1, const char* str2) +bool SystemTools::StringStartsWith(const std::string& str1, const char* str2) { if (!str2) { @@ -1741,7 +1737,7 @@ bool SystemTools::StringEndsWith(const char* str1, const char* str2) } // Returns if string ends with another string -bool SystemTools::StringEndsWith(const kwsys_stl::string& str1, const char* str2) +bool SystemTools::StringEndsWith(const std::string& str1, const char* str2) { if (!str2) { @@ -1787,7 +1783,7 @@ char* SystemTools::DuplicateString(const char* str) } // Return a cropped string -kwsys_stl::string SystemTools::CropString(const kwsys_stl::string& s, +std::string SystemTools::CropString(const std::string& s, size_t max_len) { if (!s.size() || max_len == 0 || max_len >= s.size()) @@ -1795,13 +1791,13 @@ kwsys_stl::string SystemTools::CropString(const kwsys_stl::string& s, return s; } - kwsys_stl::string n; + std::string n; n.reserve(max_len); size_t middle = max_len / 2; n += s.substr(0, middle); - n += s.substr(s.size() - (max_len - middle), kwsys_stl::string::npos); + n += s.substr(s.size() - (max_len - middle), std::string::npos); if (max_len > 2) { @@ -1820,10 +1816,10 @@ kwsys_stl::string SystemTools::CropString(const kwsys_stl::string& s, } //---------------------------------------------------------------------------- -kwsys_stl::vector SystemTools::SplitString(const kwsys_stl::string& p, char sep, bool isPath) +std::vector SystemTools::SplitString(const std::string& p, char sep, bool isPath) { - kwsys_stl::string path = p; - kwsys_stl::vector paths; + std::string path = p; + std::vector paths; if(path.empty()) { return paths; @@ -1833,9 +1829,9 @@ kwsys_stl::vector SystemTools::SplitString(const kwsys_stl::strin path.erase(path.begin()); paths.push_back("/"); } - kwsys_stl::string::size_type pos1 = 0; - kwsys_stl::string::size_type pos2 = path.find(sep, pos1+1); - while(pos2 != kwsys_stl::string::npos) + std::string::size_type pos1 = 0; + std::string::size_type pos2 = path.find(sep, pos1+1); + while(pos2 != std::string::npos) { paths.push_back(path.substr(pos1, pos2-pos1)); pos1 = pos2+1; @@ -1915,12 +1911,12 @@ int SystemTools::EstimateFormatLength(const char *format, va_list ap) return static_cast(length); } -kwsys_stl::string SystemTools::EscapeChars( +std::string SystemTools::EscapeChars( const char *str, const char *chars_to_escape, char escape_char) { - kwsys_stl::string n; + std::string n; if (str) { if (!chars_to_escape || !*chars_to_escape) @@ -1951,17 +1947,17 @@ kwsys_stl::string SystemTools::EscapeChars( } #ifdef __VMS -static void ConvertVMSToUnix(kwsys_stl::string& path) +static void ConvertVMSToUnix(std::string& path) { - kwsys_stl::string::size_type rootEnd = path.find(":["); - kwsys_stl::string::size_type pathEnd = path.find("]"); + std::string::size_type rootEnd = path.find(":["); + std::string::size_type pathEnd = path.find("]"); if(rootEnd != path.npos) { - kwsys_stl::string root = path.substr(0, rootEnd); - kwsys_stl::string pathPart = path.substr(rootEnd+2, pathEnd - rootEnd-2); + std::string root = path.substr(0, rootEnd); + std::string pathPart = path.substr(rootEnd+2, pathEnd - rootEnd-2); const char* pathCString = pathPart.c_str(); const char* pos0 = pathCString; - for (kwsys_stl::string::size_type pos = 0; *pos0; ++ pos ) + for (std::string::size_type pos = 0; *pos0; ++ pos ) { if ( *pos0 == '.' ) { @@ -1975,7 +1971,7 @@ static void ConvertVMSToUnix(kwsys_stl::string& path) #endif // convert windows slashes to unix slashes -void SystemTools::ConvertToUnixSlashes(kwsys_stl::string& path) +void SystemTools::ConvertToUnixSlashes(std::string& path) { const char* pathCString = path.c_str(); bool hasDoubleSlash = false; @@ -1984,7 +1980,7 @@ void SystemTools::ConvertToUnixSlashes(kwsys_stl::string& path) #else const char* pos0 = pathCString; const char* pos1 = pathCString+1; - for (kwsys_stl::string::size_type pos = 0; *pos0; ++ pos ) + for (std::string::size_type pos = 0; *pos0; ++ pos ) { // make sure we don't convert an escaped space to a unix slash if ( *pos0 == '\\' && *pos1 != ' ' ) @@ -2032,8 +2028,8 @@ void SystemTools::ConvertToUnixSlashes(kwsys_stl::string& path) #ifdef HAVE_GETPWNAM else if(pathCString[0] == '~') { - kwsys_stl::string::size_type idx = path.find_first_of("/\0"); - kwsys_stl::string user = path.substr(1, idx-1); + std::string::size_type idx = path.find_first_of("/\0"); + std::string user = path.substr(1, idx-1); passwd* pw = getpwnam(user.c_str()); if(pw) { @@ -2058,10 +2054,10 @@ void SystemTools::ConvertToUnixSlashes(kwsys_stl::string& path) #ifdef _WIN32 // Convert local paths to UNC style paths -kwsys_stl::wstring -SystemTools::ConvertToWindowsExtendedPath(const kwsys_stl::string &source) +std::wstring +SystemTools::ConvertToWindowsExtendedPath(const std::string &source) { - kwsys_stl::wstring wsource = Encoding::ToWide(source); + std::wstring wsource = Encoding::ToWide(source); // Resolve any relative paths DWORD wfull_len; @@ -2069,7 +2065,7 @@ SystemTools::ConvertToWindowsExtendedPath(const kwsys_stl::string &source) /* The +3 is a workaround for a bug in some versions of GetFullPathNameW that * won't return a large enough buffer size if the input is too small */ wfull_len = GetFullPathNameW(wsource.c_str(), 0, NULL, NULL) + 3; - kwsys_stl::vector wfull(wfull_len); + std::vector wfull(wfull_len); GetFullPathNameW(wsource.c_str(), wfull_len, &wfull[0], NULL); /* This should get the correct size without any extra padding from the @@ -2078,7 +2074,7 @@ SystemTools::ConvertToWindowsExtendedPath(const kwsys_stl::string &source) if(wfull_len >= 2 && isalpha(wfull[0]) && wfull[1] == L':') { /* C:\Foo\bar\FooBar.txt */ - return L"\\\\?\\" + kwsys_stl::wstring(&wfull[0]); + return L"\\\\?\\" + std::wstring(&wfull[0]); } else if(wfull_len >= 2 && wfull[0] == L'\\' && wfull[1] == L'\\') { /* Starts with \\ */ @@ -2087,31 +2083,31 @@ SystemTools::ConvertToWindowsExtendedPath(const kwsys_stl::string &source) if(wfull_len >= 8 && wfull[4] == L'U' && wfull[5] == L'N' && wfull[6] == L'C' && wfull[7] == L'\\') { /* \\?\UNC\Foo\bar\FooBar.txt */ - return kwsys_stl::wstring(&wfull[0]); + return std::wstring(&wfull[0]); } else if(wfull_len >= 6 && isalpha(wfull[4]) && wfull[5] == L':') { /* \\?\C:\Foo\bar\FooBar.txt */ - return kwsys_stl::wstring(&wfull[0]); + return std::wstring(&wfull[0]); } else if(wfull_len >= 5) { /* \\?\Foo\bar\FooBar.txt */ - return L"\\\\?\\UNC\\" + kwsys_stl::wstring(&wfull[4]); + return L"\\\\?\\UNC\\" + std::wstring(&wfull[4]); } } else if(wfull_len >= 4 && wfull[2] == L'.' && wfull[3] == L'\\') { /* Starts with \\.\ a device name */ if(wfull_len >= 6 && isalpha(wfull[4]) && wfull[5] == L':') { /* \\.\C:\Foo\bar\FooBar.txt */ - return L"\\\\?\\" + kwsys_stl::wstring(&wfull[4]); + return L"\\\\?\\" + std::wstring(&wfull[4]); } else if(wfull_len >= 5) { /* \\.\Foo\bar\ Device name is left unchanged */ - return kwsys_stl::wstring(&wfull[0]); + return std::wstring(&wfull[0]); } } else if(wfull_len >= 3) { /* \\Foo\bar\FooBar.txt */ - return L"\\\\?\\UNC\\" + kwsys_stl::wstring(&wfull[2]); + return L"\\\\?\\UNC\\" + std::wstring(&wfull[2]); } } @@ -2122,20 +2118,20 @@ SystemTools::ConvertToWindowsExtendedPath(const kwsys_stl::string &source) #endif // change // to /, and escape any spaces in the path -kwsys_stl::string SystemTools::ConvertToUnixOutputPath(const kwsys_stl::string& path) +std::string SystemTools::ConvertToUnixOutputPath(const std::string& path) { - kwsys_stl::string ret = path; + std::string ret = path; // remove // except at the beginning might be a cygwin drive - kwsys_stl::string::size_type pos=1; - while((pos = ret.find("//", pos)) != kwsys_stl::string::npos) + std::string::size_type pos=1; + while((pos = ret.find("//", pos)) != std::string::npos) { ret.erase(pos, 1); } // escape spaces and () in the path - if(ret.find_first_of(" ") != kwsys_stl::string::npos) + if(ret.find_first_of(" ") != std::string::npos) { - kwsys_stl::string result = ""; + std::string result = ""; char lastch = 1; for(const char* ch = ret.c_str(); *ch != '\0'; ++ch) { @@ -2152,7 +2148,7 @@ kwsys_stl::string SystemTools::ConvertToUnixOutputPath(const kwsys_stl::string& return ret; } -kwsys_stl::string SystemTools::ConvertToOutputPath(const kwsys_stl::string& path) +std::string SystemTools::ConvertToOutputPath(const std::string& path) { #if defined(_WIN32) && !defined(__CYGWIN__) return SystemTools::ConvertToWindowsOutputPath(path); @@ -2162,16 +2158,16 @@ kwsys_stl::string SystemTools::ConvertToOutputPath(const kwsys_stl::string& path } // remove double slashes not at the start -kwsys_stl::string SystemTools::ConvertToWindowsOutputPath(const kwsys_stl::string& path) +std::string SystemTools::ConvertToWindowsOutputPath(const std::string& path) { - kwsys_stl::string ret; + std::string ret; // make it big enough for all of path and double quotes ret.reserve(path.size()+3); // put path into the string ret = path; - kwsys_stl::string::size_type pos = 0; + std::string::size_type pos = 0; // first convert all of the slashes - while((pos = ret.find('/', pos)) != kwsys_stl::string::npos) + while((pos = ret.find('/', pos)) != std::string::npos) { ret[pos] = '\\'; pos++; @@ -2193,33 +2189,33 @@ kwsys_stl::string SystemTools::ConvertToWindowsOutputPath(const kwsys_stl::strin return ret; } } - while((pos = ret.find("\\\\", pos)) != kwsys_stl::string::npos) + while((pos = ret.find("\\\\", pos)) != std::string::npos) { ret.erase(pos, 1); } // now double quote the path if it has spaces in it // and is not already double quoted - if(ret.find(' ') != kwsys_stl::string::npos + if(ret.find(' ') != std::string::npos && ret[0] != '\"') { - ret.insert(static_cast(0), - static_cast(1), '\"'); + ret.insert(static_cast(0), + static_cast(1), '\"'); ret.append(1, '\"'); } return ret; } -bool SystemTools::CopyFileIfDifferent(const kwsys_stl::string& source, - const kwsys_stl::string& destination) +bool SystemTools::CopyFileIfDifferent(const std::string& source, + const std::string& destination) { // special check for a destination that is a directory // FilesDiffer does not handle file to directory compare if(SystemTools::FileIsDirectory(destination)) { - kwsys_stl::string new_destination = destination; + std::string new_destination = destination; SystemTools::ConvertToUnixSlashes(new_destination); new_destination += '/'; - kwsys_stl::string source_name = source; + std::string source_name = source; new_destination += SystemTools::GetFilenameName(source_name); if(SystemTools::FilesDiffer(source, new_destination)) { @@ -2244,8 +2240,8 @@ bool SystemTools::CopyFileIfDifferent(const kwsys_stl::string& source, #define KWSYS_ST_BUFFER 4096 -bool SystemTools::FilesDiffer(const kwsys_stl::string& source, - const kwsys_stl::string& destination) +bool SystemTools::FilesDiffer(const std::string& source, + const std::string& destination) { #if defined(_WIN32) @@ -2308,11 +2304,11 @@ bool SystemTools::FilesDiffer(const kwsys_stl::string& source, #if defined(_WIN32) kwsys::ifstream finSource(source.c_str(), - (kwsys_ios::ios::binary | - kwsys_ios::ios::in)); + (std::ios::binary | + std::ios::in)); kwsys::ifstream finDestination(destination.c_str(), - (kwsys_ios::ios::binary | - kwsys_ios::ios::in)); + (std::ios::binary | + std::ios::in)); #else kwsys::ifstream finSource(source.c_str()); kwsys::ifstream finDestination(destination.c_str()); @@ -2328,13 +2324,13 @@ bool SystemTools::FilesDiffer(const kwsys_stl::string& source, while(nleft > 0) { // Read a block from each file. - kwsys_ios::streamsize nnext = (nleft > KWSYS_ST_BUFFER)? KWSYS_ST_BUFFER : static_cast(nleft); + std::streamsize nnext = (nleft > KWSYS_ST_BUFFER)? KWSYS_ST_BUFFER : static_cast(nleft); finSource.read(source_buf, nnext); finDestination.read(dest_buf, nnext); // If either failed to read assume they are different. - if(static_cast(finSource.gcount()) != nnext || - static_cast(finDestination.gcount()) != nnext) + if(static_cast(finSource.gcount()) != nnext || + static_cast(finDestination.gcount()) != nnext) { return true; } @@ -2360,7 +2356,7 @@ bool SystemTools::FilesDiffer(const kwsys_stl::string& source, /** * Copy a file named by "source" to the file named by "destination". */ -bool SystemTools::CopyFileAlways(const kwsys_stl::string& source, const kwsys_stl::string& destination) +bool SystemTools::CopyFileAlways(const std::string& source, const std::string& destination) { // If files are the same do not copy if ( SystemTools::SameFile(source, destination) ) @@ -2376,15 +2372,15 @@ bool SystemTools::CopyFileAlways(const kwsys_stl::string& source, const kwsys_st // If destination is a directory, try to create a file with the same // name as the source in that directory. - kwsys_stl::string real_destination = destination; - kwsys_stl::string destination_dir; + std::string real_destination = destination; + std::string destination_dir; if(SystemTools::FileExists(destination) && SystemTools::FileIsDirectory(destination)) { destination_dir = real_destination; SystemTools::ConvertToUnixSlashes(real_destination); real_destination += '/'; - kwsys_stl::string source_name = source; + std::string source_name = source; real_destination += SystemTools::GetFilenameName(source_name); } else @@ -2400,10 +2396,10 @@ bool SystemTools::CopyFileAlways(const kwsys_stl::string& source, const kwsys_st #if defined(_WIN32) kwsys::ifstream fin(Encoding::ToNarrow( SystemTools::ConvertToWindowsExtendedPath(source)).c_str(), - kwsys_ios::ios::in | kwsys_ios_binary); + std::ios::in | std::ios::binary); #else kwsys::ifstream fin(source.c_str(), - kwsys_ios::ios::in | kwsys_ios_binary); + std::ios::in | std::ios::binary); #endif if(!fin) { @@ -2419,10 +2415,10 @@ bool SystemTools::CopyFileAlways(const kwsys_stl::string& source, const kwsys_st #if defined(_WIN32) kwsys::ofstream fout(Encoding::ToNarrow( SystemTools::ConvertToWindowsExtendedPath(real_destination)).c_str(), - kwsys_ios::ios::out | kwsys_ios::ios::trunc | kwsys_ios_binary); + std::ios::out | std::ios::trunc | std::ios::binary); #else kwsys::ofstream fout(real_destination.c_str(), - kwsys_ios::ios::out | kwsys_ios::ios::trunc | kwsys_ios_binary); + std::ios::out | std::ios::trunc | std::ios::binary); #endif if(!fout) { @@ -2470,7 +2466,7 @@ bool SystemTools::CopyFileAlways(const kwsys_stl::string& source, const kwsys_st } //---------------------------------------------------------------------------- -bool SystemTools::CopyAFile(const kwsys_stl::string& source, const kwsys_stl::string& destination, +bool SystemTools::CopyAFile(const std::string& source, const std::string& destination, bool always) { if(always) @@ -2487,7 +2483,7 @@ bool SystemTools::CopyAFile(const kwsys_stl::string& source, const kwsys_stl::st * Copy a directory content from "source" directory to the directory named by * "destination". */ -bool SystemTools::CopyADirectory(const kwsys_stl::string& source, const kwsys_stl::string& destination, +bool SystemTools::CopyADirectory(const std::string& source, const std::string& destination, bool always) { Directory dir; @@ -2507,12 +2503,12 @@ bool SystemTools::CopyADirectory(const kwsys_stl::string& source, const kwsys_st if (strcmp(dir.GetFile(static_cast(fileNum)),".") && strcmp(dir.GetFile(static_cast(fileNum)),"..")) { - kwsys_stl::string fullPath = source; + std::string fullPath = source; fullPath += "/"; fullPath += dir.GetFile(static_cast(fileNum)); if(SystemTools::FileIsDirectory(fullPath)) { - kwsys_stl::string fullDestPath = destination; + std::string fullDestPath = destination; fullDestPath += "/"; fullDestPath += dir.GetFile(static_cast(fileNum)); if (!SystemTools::CopyADirectory(fullPath, @@ -2537,7 +2533,7 @@ bool SystemTools::CopyADirectory(const kwsys_stl::string& source, const kwsys_st // return size of file; also returns zero if no file exists -unsigned long SystemTools::FileLength(const kwsys_stl::string& filename) +unsigned long SystemTools::FileLength(const std::string& filename) { unsigned long length = 0; #ifdef _WIN32 @@ -2577,7 +2573,7 @@ int SystemTools::Strucmp(const char *s1, const char *s2) } // return file's modified time -long int SystemTools::ModifiedTime(const kwsys_stl::string& filename) +long int SystemTools::ModifiedTime(const std::string& filename) { long int mt = 0; #ifdef _WIN32 @@ -2600,7 +2596,7 @@ long int SystemTools::ModifiedTime(const kwsys_stl::string& filename) } // return file's creation time -long int SystemTools::CreationTime(const kwsys_stl::string& filename) +long int SystemTools::CreationTime(const std::string& filename) { long int ct = 0; #ifdef _WIN32 @@ -2724,16 +2720,16 @@ bool SystemTools::ConvertTimeStampMacroString(const char *str, time_t *tmt) return true; } -kwsys_stl::string SystemTools::GetLastSystemError() +std::string SystemTools::GetLastSystemError() { int e = errno; return strerror(e); } -bool SystemTools::RemoveFile(const kwsys_stl::string& source) +bool SystemTools::RemoveFile(const std::string& source) { #ifdef _WIN32 - kwsys_stl::wstring const& ws = + std::wstring const& ws = SystemTools::ConvertToWindowsExtendedPath(source); if (DeleteFileW(ws.c_str())) { @@ -2772,7 +2768,7 @@ bool SystemTools::RemoveFile(const kwsys_stl::string& source) #endif } -bool SystemTools::RemoveADirectory(const kwsys_stl::string& source) +bool SystemTools::RemoveADirectory(const std::string& source) { // Add write permission to the directory so we can modify its // content to remove files and directories from it. @@ -2800,7 +2796,7 @@ bool SystemTools::RemoveADirectory(const kwsys_stl::string& source) if (strcmp(dir.GetFile(static_cast(fileNum)),".") && strcmp(dir.GetFile(static_cast(fileNum)),"..")) { - kwsys_stl::string fullPath = source; + std::string fullPath = source; fullPath += "/"; fullPath += dir.GetFile(static_cast(fileNum)); if(SystemTools::FileIsDirectory(fullPath) && @@ -2836,13 +2832,13 @@ size_t SystemTools::GetMaximumFilePathLength() * the system search path. Returns the full path to the file if it is * found. Otherwise, the empty string is returned. */ -kwsys_stl::string SystemTools -::FindName(const kwsys_stl::string& name, - const kwsys_stl::vector& userPaths, +std::string SystemTools +::FindName(const std::string& name, + const std::vector& userPaths, bool no_system_path) { // Add the system search path to our path first - kwsys_stl::vector path; + std::vector path; if (!no_system_path) { SystemTools::GetPath(path, "CMAKE_FILE_PATH"); @@ -2850,7 +2846,7 @@ kwsys_stl::string SystemTools } // now add the additional paths { - for(kwsys_stl::vector::const_iterator i = userPaths.begin(); + for(std::vector::const_iterator i = userPaths.begin(); i != userPaths.end(); ++i) { path.push_back(*i); @@ -2858,10 +2854,10 @@ kwsys_stl::string SystemTools } // Add a trailing slash to all paths to aid the search process. { - for(kwsys_stl::vector::iterator i = path.begin(); + for(std::vector::iterator i = path.begin(); i != path.end(); ++i) { - kwsys_stl::string& p = *i; + std::string& p = *i; if(p.empty() || *p.rbegin() != '/') { p += "/"; @@ -2869,8 +2865,8 @@ kwsys_stl::string SystemTools } } // now look for the file - kwsys_stl::string tryPath; - for(kwsys_stl::vector::const_iterator p = path.begin(); + std::string tryPath; + for(std::vector::const_iterator p = path.begin(); p != path.end(); ++p) { tryPath = *p; @@ -2889,12 +2885,12 @@ kwsys_stl::string SystemTools * the system search path. Returns the full path to the file if it is * found. Otherwise, the empty string is returned. */ -kwsys_stl::string SystemTools -::FindFile(const kwsys_stl::string& name, - const kwsys_stl::vector& userPaths, +std::string SystemTools +::FindFile(const std::string& name, + const std::vector& userPaths, bool no_system_path) { - kwsys_stl::string tryPath = SystemTools::FindName(name, userPaths, no_system_path); + std::string tryPath = SystemTools::FindName(name, userPaths, no_system_path); if(!tryPath.empty() && !SystemTools::FileIsDirectory(tryPath)) { return SystemTools::CollapseFullPath(tryPath); @@ -2908,12 +2904,12 @@ kwsys_stl::string SystemTools * the system search path. Returns the full path to the directory if it is * found. Otherwise, the empty string is returned. */ -kwsys_stl::string SystemTools -::FindDirectory(const kwsys_stl::string& name, - const kwsys_stl::vector& userPaths, +std::string SystemTools +::FindDirectory(const std::string& name, + const std::vector& userPaths, bool no_system_path) { - kwsys_stl::string tryPath = SystemTools::FindName(name, userPaths, no_system_path); + std::string tryPath = SystemTools::FindName(name, userPaths, no_system_path); if(!tryPath.empty() && SystemTools::FileIsDirectory(tryPath)) { return SystemTools::CollapseFullPath(tryPath); @@ -2927,24 +2923,24 @@ kwsys_stl::string SystemTools * the system search path. Returns the full path to the executable if it is * found. Otherwise, the empty string is returned. */ -kwsys_stl::string SystemTools::FindProgram( +std::string SystemTools::FindProgram( const char* nameIn, - const kwsys_stl::vector& userPaths, + const std::vector& userPaths, bool no_system_path) { if(!nameIn || !*nameIn) { return ""; } - return SystemTools::FindProgram(kwsys_stl::string(nameIn), userPaths, no_system_path); + return SystemTools::FindProgram(std::string(nameIn), userPaths, no_system_path); } -kwsys_stl::string SystemTools::FindProgram( - const kwsys_stl::string& name, - const kwsys_stl::vector& userPaths, +std::string SystemTools::FindProgram( + const std::string& name, + const std::vector& userPaths, bool no_system_path) { - kwsys_stl::vector extensions; + std::vector extensions; #if defined (_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) bool hasExtension = false; // check to see if the name already has a .xxx at @@ -2960,10 +2956,10 @@ kwsys_stl::string SystemTools::FindProgram( extensions.push_back(".exe"); } #endif - kwsys_stl::string tryPath; + std::string tryPath; // first try with extensions if the os supports them - for(kwsys_stl::vector::iterator i = + for(std::vector::iterator i = extensions.begin(); i != extensions.end(); ++i) { tryPath = name; @@ -2982,7 +2978,7 @@ kwsys_stl::string SystemTools::FindProgram( return SystemTools::CollapseFullPath(tryPath); } // now construct the path - kwsys_stl::vector path; + std::vector path; // Add the system search path to our path. if (!no_system_path) { @@ -2990,7 +2986,7 @@ kwsys_stl::string SystemTools::FindProgram( } // now add the additional paths { - for(kwsys_stl::vector::const_iterator i = + for(std::vector::const_iterator i = userPaths.begin(); i != userPaths.end(); ++i) { path.push_back(*i); @@ -2998,10 +2994,10 @@ kwsys_stl::string SystemTools::FindProgram( } // Add a trailing slash to all paths to aid the search process. { - for(kwsys_stl::vector::iterator i = path.begin(); + for(std::vector::iterator i = path.begin(); i != path.end(); ++i) { - kwsys_stl::string& p = *i; + std::string& p = *i; if(p.empty() || *p.rbegin() != '/') { p += "/"; @@ -3009,7 +3005,7 @@ kwsys_stl::string SystemTools::FindProgram( } } // Try each path - for(kwsys_stl::vector::iterator p = path.begin(); + for(std::vector::iterator p = path.begin(); p != path.end(); ++p) { #ifdef _WIN32 @@ -3017,7 +3013,7 @@ kwsys_stl::string SystemTools::FindProgram( SystemTools::ReplaceString(*p, "\"", ""); #endif // first try with extensions - for(kwsys_stl::vector::iterator ext + for(std::vector::iterator ext = extensions.begin(); ext != extensions.end(); ++ext) { tryPath = *p; @@ -3042,16 +3038,16 @@ kwsys_stl::string SystemTools::FindProgram( return ""; } -kwsys_stl::string SystemTools::FindProgram( - const kwsys_stl::vector& names, - const kwsys_stl::vector& path, +std::string SystemTools::FindProgram( + const std::vector& names, + const std::vector& path, bool noSystemPath) { - for(kwsys_stl::vector::const_iterator it = names.begin(); + for(std::vector::const_iterator it = names.begin(); it != names.end() ; ++it) { // Try to find the program. - kwsys_stl::string result = SystemTools::FindProgram(*it, + std::string result = SystemTools::FindProgram(*it, path, noSystemPath); if ( !result.empty() ) @@ -3067,9 +3063,9 @@ kwsys_stl::string SystemTools::FindProgram( * the system search path. Returns the full path to the library if it is * found. Otherwise, the empty string is returned. */ -kwsys_stl::string SystemTools -::FindLibrary(const kwsys_stl::string& name, - const kwsys_stl::vector& userPaths) +std::string SystemTools +::FindLibrary(const std::string& name, + const std::vector& userPaths) { // See if the executable exists as written. if(SystemTools::FileExists(name) && @@ -3079,11 +3075,11 @@ kwsys_stl::string SystemTools } // Add the system search path to our path. - kwsys_stl::vector path; + std::vector path; SystemTools::GetPath(path); // now add the additional paths { - for(kwsys_stl::vector::const_iterator i = userPaths.begin(); + for(std::vector::const_iterator i = userPaths.begin(); i != userPaths.end(); ++i) { path.push_back(*i); @@ -3091,18 +3087,18 @@ kwsys_stl::string SystemTools } // Add a trailing slash to all paths to aid the search process. { - for(kwsys_stl::vector::iterator i = path.begin(); + for(std::vector::iterator i = path.begin(); i != path.end(); ++i) { - kwsys_stl::string& p = *i; + std::string& p = *i; if(p.empty() || *p.rbegin() != '/') { p += "/"; } } } - kwsys_stl::string tryPath; - for(kwsys_stl::vector::const_iterator p = path.begin(); + std::string tryPath; + for(std::vector::const_iterator p = path.begin(); p != path.end(); ++p) { #if defined(__APPLE__) @@ -3177,15 +3173,15 @@ kwsys_stl::string SystemTools return ""; } -kwsys_stl::string SystemTools::GetRealPath(const kwsys_stl::string& path, - kwsys_stl::string* errorMessage) +std::string SystemTools::GetRealPath(const std::string& path, + std::string* errorMessage) { - kwsys_stl::string ret; + std::string ret; Realpath(path, ret, errorMessage); return ret; } -bool SystemTools::FileIsDirectory(const kwsys_stl::string& inName) +bool SystemTools::FileIsDirectory(const std::string& inName) { if (inName.empty()) { @@ -3234,7 +3230,7 @@ bool SystemTools::FileIsDirectory(const kwsys_stl::string& inName) } } -bool SystemTools::FileIsSymlink(const kwsys_stl::string& name) +bool SystemTools::FileIsSymlink(const std::string& name) { #if defined( _WIN32 ) DWORD attr = GetFileAttributesW( @@ -3261,25 +3257,25 @@ bool SystemTools::FileIsSymlink(const kwsys_stl::string& name) } #if defined(_WIN32) && !defined(__CYGWIN__) -bool SystemTools::CreateSymlink(const kwsys_stl::string&, const kwsys_stl::string&) +bool SystemTools::CreateSymlink(const std::string&, const std::string&) { return false; } #else -bool SystemTools::CreateSymlink(const kwsys_stl::string& origName, const kwsys_stl::string& newName) +bool SystemTools::CreateSymlink(const std::string& origName, const std::string& newName) { return symlink(origName.c_str(), newName.c_str()) >= 0; } #endif #if defined(_WIN32) && !defined(__CYGWIN__) -bool SystemTools::ReadSymlink(const kwsys_stl::string&, kwsys_stl::string&) +bool SystemTools::ReadSymlink(const std::string&, std::string&) { return false; } #else -bool SystemTools::ReadSymlink(const kwsys_stl::string& newName, - kwsys_stl::string& origName) +bool SystemTools::ReadSymlink(const std::string& newName, + std::string& origName) { char buf[KWSYS_SYSTEMTOOLS_MAXPATH+1]; int count = @@ -3298,16 +3294,16 @@ bool SystemTools::ReadSymlink(const kwsys_stl::string& newName, } #endif -int SystemTools::ChangeDirectory(const kwsys_stl::string& dir) +int SystemTools::ChangeDirectory(const std::string& dir) { return Chdir(dir); } -kwsys_stl::string SystemTools::GetCurrentWorkingDirectory(bool collapse) +std::string SystemTools::GetCurrentWorkingDirectory(bool collapse) { char buf[2048]; const char* cwd = Getcwd(buf, 2048); - kwsys_stl::string path; + std::string path; if ( cwd ) { path = cwd; @@ -3319,16 +3315,16 @@ kwsys_stl::string SystemTools::GetCurrentWorkingDirectory(bool collapse) return path; } -kwsys_stl::string SystemTools::GetProgramPath(const kwsys_stl::string& in_name) +std::string SystemTools::GetProgramPath(const std::string& in_name) { - kwsys_stl::string dir, file; + std::string dir, file; SystemTools::SplitProgramPath(in_name, dir, file); return dir; } -bool SystemTools::SplitProgramPath(const kwsys_stl::string& in_name, - kwsys_stl::string& dir, - kwsys_stl::string& file, +bool SystemTools::SplitProgramPath(const std::string& in_name, + std::string& dir, + std::string& file, bool) { dir = in_name; @@ -3337,8 +3333,8 @@ bool SystemTools::SplitProgramPath(const kwsys_stl::string& in_name, if(!SystemTools::FileIsDirectory(dir)) { - kwsys_stl::string::size_type slashPos = dir.rfind("/"); - if(slashPos != kwsys_stl::string::npos) + std::string::size_type slashPos = dir.rfind("/"); + if(slashPos != std::string::npos) { file = dir.substr(slashPos+1); dir = dir.substr(0, slashPos); @@ -3351,7 +3347,7 @@ bool SystemTools::SplitProgramPath(const kwsys_stl::string& in_name, } if(!(dir.empty()) && !SystemTools::FileIsDirectory(dir)) { - kwsys_stl::string oldDir = in_name; + std::string oldDir = in_name; SystemTools::ConvertToUnixSlashes(oldDir); dir = in_name; return false; @@ -3360,14 +3356,14 @@ bool SystemTools::SplitProgramPath(const kwsys_stl::string& in_name, } bool SystemTools::FindProgramPath(const char* argv0, - kwsys_stl::string& pathOut, - kwsys_stl::string& errorMsg, + std::string& pathOut, + std::string& errorMsg, const char* exeName, const char* buildDir, const char* installPrefix ) { - kwsys_stl::vector failures; - kwsys_stl::string self = argv0 ? argv0 : ""; + std::vector failures; + std::string self = argv0 ? argv0 : ""; failures.push_back(self); SystemTools::ConvertToUnixSlashes(self); self = SystemTools::FindProgram(self); @@ -3375,7 +3371,7 @@ bool SystemTools::FindProgramPath(const char* argv0, { if(buildDir) { - kwsys_stl::string intdir = "."; + std::string intdir = "."; #ifdef CMAKE_INTDIR intdir = CMAKE_INTDIR; #endif @@ -3400,7 +3396,7 @@ bool SystemTools::FindProgramPath(const char* argv0, if(!SystemTools::FileExists(self)) { failures.push_back(self); - kwsys_ios::ostringstream msg; + std::ostringstream msg; msg << "Can not find the command line program "; if (exeName) { @@ -3412,7 +3408,7 @@ bool SystemTools::FindProgramPath(const char* argv0, msg << " argv[0] = \"" << argv0 << "\"\n"; } msg << " Attempted paths:\n"; - kwsys_stl::vector::iterator i; + std::vector::iterator i; for(i=failures.begin(); i != failures.end(); ++i) { msg << " \"" << *i << "\"\n"; @@ -3425,15 +3421,15 @@ bool SystemTools::FindProgramPath(const char* argv0, } -kwsys_stl::string SystemTools::CollapseFullPath(const kwsys_stl::string& in_relative) +std::string SystemTools::CollapseFullPath(const std::string& in_relative) { return SystemTools::CollapseFullPath(in_relative, 0); } -void SystemTools::AddTranslationPath(const kwsys_stl::string& a, const kwsys_stl::string& b) +void SystemTools::AddTranslationPath(const std::string& a, const std::string& b) { - kwsys_stl::string path_a = a; - kwsys_stl::string path_b = b; + std::string path_a = a; + std::string path_b = b; SystemTools::ConvertToUnixSlashes(path_a); SystemTools::ConvertToUnixSlashes(path_b); // First check this is a directory path, since we don't want the table to @@ -3444,7 +3440,7 @@ void SystemTools::AddTranslationPath(const kwsys_stl::string& a, const kwsys_stl // Ken--the following code is incorrect. .. can be in a valid path // for example /home/martink/MyHubba...Hubba/Src if( SystemTools::FileIsFullPath(path_b) && path_b.find("..") - == kwsys_stl::string::npos ) + == std::string::npos ) { // Before inserting make sure path ends with '/' if(!path_a.empty() && *path_a.rbegin() != '/') @@ -3464,14 +3460,14 @@ void SystemTools::AddTranslationPath(const kwsys_stl::string& a, const kwsys_stl } } -void SystemTools::AddKeepPath(const kwsys_stl::string& dir) +void SystemTools::AddKeepPath(const std::string& dir) { - kwsys_stl::string cdir; + std::string cdir; Realpath(SystemTools::CollapseFullPath(dir).c_str(), cdir); SystemTools::AddTranslationPath(cdir, dir); } -void SystemTools::CheckTranslationPath(kwsys_stl::string & path) +void SystemTools::CheckTranslationPath(std::string & path) { // Do not translate paths that are too short to have meaningful // translations. @@ -3487,7 +3483,7 @@ void SystemTools::CheckTranslationPath(kwsys_stl::string & path) // In case a file was specified we still have to go through this: // Now convert any path found in the table back to the one desired: - kwsys_stl::map::const_iterator it; + std::map::const_iterator it; for(it = SystemTools::TranslationMap->begin(); it != SystemTools::TranslationMap->end(); ++it ) @@ -3505,13 +3501,13 @@ void SystemTools::CheckTranslationPath(kwsys_stl::string & path) static void SystemToolsAppendComponents( - kwsys_stl::vector& out_components, - kwsys_stl::vector::const_iterator first, - kwsys_stl::vector::const_iterator last) + std::vector& out_components, + std::vector::const_iterator first, + std::vector::const_iterator last) { - static const kwsys_stl::string up = ".."; - static const kwsys_stl::string cur = "."; - for(kwsys_stl::vector::const_iterator i = first; + static const std::string up = ".."; + static const std::string cur = "."; + for(std::vector::const_iterator i = first; i != last; ++i) { if(*i == up) @@ -3528,20 +3524,20 @@ SystemToolsAppendComponents( } } -kwsys_stl::string SystemTools::CollapseFullPath(const kwsys_stl::string& in_path, +std::string SystemTools::CollapseFullPath(const std::string& in_path, const char* in_base) { // Collect the output path components. - kwsys_stl::vector out_components; + std::vector out_components; // Split the input path components. - kwsys_stl::vector path_components; + std::vector path_components; SystemTools::SplitPath(in_path, path_components); // If the input path is relative, start with a base path. if(path_components[0].length() == 0) { - kwsys_stl::vector base_components; + std::vector base_components; if(in_base) { // Use the given base path. @@ -3574,7 +3570,7 @@ kwsys_stl::string SystemTools::CollapseFullPath(const kwsys_stl::string& in_path path_components.end()); // Transform the path back to a string. - kwsys_stl::string newPath = SystemTools::JoinPath(out_components); + std::string newPath = SystemTools::JoinPath(out_components); // Update the translation table with this potentially new path. I am not // sure why this line is here, it seems really questionable, but yet I @@ -3599,20 +3595,20 @@ kwsys_stl::string SystemTools::CollapseFullPath(const kwsys_stl::string& in_path return newPath; } -kwsys_stl::string SystemTools::CollapseFullPath(const kwsys_stl::string& in_path, - const kwsys_stl::string& in_base) +std::string SystemTools::CollapseFullPath(const std::string& in_path, + const std::string& in_base) { // Collect the output path components. - kwsys_stl::vector out_components; + std::vector out_components; // Split the input path components. - kwsys_stl::vector path_components; + std::vector path_components; SystemTools::SplitPath(in_path, path_components); // If the input path is relative, start with a base path. if(path_components[0].length() == 0) { - kwsys_stl::vector base_components; + std::vector base_components; // Use the given base path. SystemTools::SplitPath(in_base, base_components); @@ -3629,7 +3625,7 @@ kwsys_stl::string SystemTools::CollapseFullPath(const kwsys_stl::string& in_path path_components.end()); // Transform the path back to a string. - kwsys_stl::string newPath = SystemTools::JoinPath(out_components); + std::string newPath = SystemTools::JoinPath(out_components); // Update the translation table with this potentially new path. I am not // sure why this line is here, it seems really questionable, but yet I @@ -3655,7 +3651,7 @@ kwsys_stl::string SystemTools::CollapseFullPath(const kwsys_stl::string& in_path } // compute the relative path from here to there -kwsys_stl::string SystemTools::RelativePath(const kwsys_stl::string& local, const kwsys_stl::string& remote) +std::string SystemTools::RelativePath(const std::string& local, const std::string& remote) { if(!SystemTools::FileIsFullPath(local)) { @@ -3666,14 +3662,14 @@ kwsys_stl::string SystemTools::RelativePath(const kwsys_stl::string& local, cons return ""; } - kwsys_stl::string l = SystemTools::CollapseFullPath(local); - kwsys_stl::string r = SystemTools::CollapseFullPath(remote); + std::string l = SystemTools::CollapseFullPath(local); + std::string r = SystemTools::CollapseFullPath(remote); // split up both paths into arrays of strings using / as a separator - kwsys_stl::vector localSplit = SystemTools::SplitString(l, '/', true); - kwsys_stl::vector remoteSplit = SystemTools::SplitString(r, '/', true); - kwsys_stl::vector commonPath; // store shared parts of path in this array - kwsys_stl::vector finalPath; // store the final relative path here + std::vector localSplit = SystemTools::SplitString(l, '/', true); + std::vector remoteSplit = SystemTools::SplitString(r, '/', true); + std::vector commonPath; // store shared parts of path in this array + std::vector finalPath; // store the final relative path here // count up how many matching directory names there are from the start unsigned int sameCount = 0; while( @@ -3718,7 +3714,7 @@ kwsys_stl::string SystemTools::RelativePath(const kwsys_stl::string& local, cons } // for each entry that is not common in the remote path add it // to the final path. - for(kwsys_stl::vector::iterator vit = remoteSplit.begin(); + for(std::vector::iterator vit = remoteSplit.begin(); vit != remoteSplit.end(); ++vit) { if(!vit->empty()) @@ -3726,10 +3722,10 @@ kwsys_stl::string SystemTools::RelativePath(const kwsys_stl::string& local, cons finalPath.push_back(*vit); } } - kwsys_stl::string relativePath; // result string + std::string relativePath; // result string // now turn the array of directories into a unix path by puttint / // between each entry that does not already have one - for(kwsys_stl::vector::iterator vit1 = finalPath.begin(); + for(std::vector::iterator vit1 = finalPath.begin(); vit1 != finalPath.end(); ++vit1) { if(!relativePath.empty() && *relativePath.rbegin() != '/') @@ -3742,10 +3738,10 @@ kwsys_stl::string SystemTools::RelativePath(const kwsys_stl::string& local, cons } #ifdef _WIN32 -static int GetCasePathName(const kwsys_stl::string & pathIn, - kwsys_stl::string & casePath) +static int GetCasePathName(const std::string & pathIn, + std::string & casePath) { - kwsys_stl::vector path_components; + std::vector path_components; SystemTools::SplitPath(pathIn, path_components); if(path_components[0].empty()) // First component always exists. { @@ -3755,7 +3751,7 @@ static int GetCasePathName(const kwsys_stl::string & pathIn, } // Start with root component. - kwsys_stl::vector::size_type idx = 0; + std::vector::size_type idx = 0; casePath = path_components[idx++]; // make sure drive letter is always upper case if(casePath.size() > 1 && casePath[1] == ':') @@ -3779,14 +3775,14 @@ static int GetCasePathName(const kwsys_stl::string & pathIn, { casePath += sep; sep = "/"; - kwsys_stl::string test_str = casePath; + std::string test_str = casePath; test_str += path_components[idx]; // If path component contains wildcards, we skip matching // because these filenames are not allowed on windows, // and we do not want to match a different file. - if(path_components[idx].find('*') != kwsys_stl::string::npos || - path_components[idx].find('?') != kwsys_stl::string::npos) + if(path_components[idx].find('*') != std::string::npos || + path_components[idx].find('?') != std::string::npos) { casePath = ""; return 0; @@ -3812,7 +3808,7 @@ static int GetCasePathName(const kwsys_stl::string & pathIn, //---------------------------------------------------------------------------- -kwsys_stl::string SystemTools::GetActualCaseForPath(const kwsys_stl::string& p) +std::string SystemTools::GetActualCaseForPath(const std::string& p) { #ifndef _WIN32 return p; @@ -3825,7 +3821,7 @@ kwsys_stl::string SystemTools::GetActualCaseForPath(const kwsys_stl::string& p) { return i->second; } - kwsys_stl::string casePath; + std::string casePath; int len = GetCasePathName(p, casePath); if(len == 0 || len > MAX_PATH+1) { @@ -3838,7 +3834,7 @@ kwsys_stl::string SystemTools::GetActualCaseForPath(const kwsys_stl::string& p) //---------------------------------------------------------------------------- const char* SystemTools::SplitPathRootComponent(const std::string& p, - kwsys_stl::string* root) + std::string* root) { // Identify the root component. const char* c = p.c_str(); @@ -3924,7 +3920,7 @@ const char* SystemTools::SplitPathRootComponent(const std::string& p, //---------------------------------------------------------------------------- void SystemTools::SplitPath(const std::string& p, - kwsys_stl::vector& components, + std::vector& components, bool expand_home_dir) { const char* c; @@ -3932,13 +3928,13 @@ void SystemTools::SplitPath(const std::string& p, // Identify the root component. { - kwsys_stl::string root; + std::string root; c = SystemTools::SplitPathRootComponent(p, &root); // Expand home directory references if requested. if(expand_home_dir && !root.empty() && root[0] == '~') { - kwsys_stl::string homedir; + std::string homedir; root = root.substr(0, root.size()-1); if(root.size() == 1) { @@ -3984,7 +3980,7 @@ void SystemTools::SplitPath(const std::string& p, if(*last == '/' || *last == '\\') { // End of a component. Save it. - components.push_back(kwsys_stl::string(first, last)); + components.push_back(std::string(first, last)); first = last+1; } } @@ -3992,27 +3988,27 @@ void SystemTools::SplitPath(const std::string& p, // Save the last component unless there were no components. if(last != c) { - components.push_back(kwsys_stl::string(first, last)); + components.push_back(std::string(first, last)); } } //---------------------------------------------------------------------------- -kwsys_stl::string -SystemTools::JoinPath(const kwsys_stl::vector& components) +std::string +SystemTools::JoinPath(const std::vector& components) { return SystemTools::JoinPath(components.begin(), components.end()); } //---------------------------------------------------------------------------- -kwsys_stl::string +std::string SystemTools -::JoinPath(kwsys_stl::vector::const_iterator first, - kwsys_stl::vector::const_iterator last) +::JoinPath(std::vector::const_iterator first, + std::vector::const_iterator last) { // Construct result in a single string. - kwsys_stl::string result; + std::string result; size_t len = 0; - kwsys_stl::vector::const_iterator i; + std::vector::const_iterator i; for(i = first; i != last; ++i) { len += 1 + i->size(); @@ -4041,7 +4037,7 @@ SystemTools } //---------------------------------------------------------------------------- -bool SystemTools::ComparePath(const kwsys_stl::string& c1, const kwsys_stl::string& c2) +bool SystemTools::ComparePath(const std::string& c1, const std::string& c2) { #if defined(_WIN32) || defined(__APPLE__) # ifdef _MSC_VER @@ -4057,14 +4053,14 @@ bool SystemTools::ComparePath(const kwsys_stl::string& c1, const kwsys_stl::stri } //---------------------------------------------------------------------------- -bool SystemTools::Split(const kwsys_stl::string& str, kwsys_stl::vector& lines, char separator) +bool SystemTools::Split(const std::string& str, std::vector& lines, char separator) { - kwsys_stl::string data(str); - kwsys_stl::string::size_type lpos = 0; + std::string data(str); + std::string::size_type lpos = 0; while(lpos < data.length()) { - kwsys_stl::string::size_type rpos = data.find_first_of(separator, lpos); - if(rpos == kwsys_stl::string::npos) + std::string::size_type rpos = data.find_first_of(separator, lpos); + if(rpos == std::string::npos) { // Line ends at end of string without a newline. lines.push_back(data.substr(lpos)); @@ -4081,14 +4077,14 @@ bool SystemTools::Split(const kwsys_stl::string& str, kwsys_stl::vector& lines) +bool SystemTools::Split(const std::string& str, std::vector& lines) { - kwsys_stl::string data(str); - kwsys_stl::string::size_type lpos = 0; + std::string data(str); + std::string::size_type lpos = 0; while(lpos < data.length()) { - kwsys_stl::string::size_type rpos = data.find_first_of("\n", lpos); - if(rpos == kwsys_stl::string::npos) + std::string::size_type rpos = data.find_first_of("\n", lpos); + if(rpos == std::string::npos) { // Line ends at end of string without a newline. lines.push_back(data.substr(lpos)); @@ -4113,15 +4109,15 @@ bool SystemTools::Split(const kwsys_stl::string& str, kwsys_stl::vector buffer(wtempPath.size()+1); + std::wstring wtempPath = Encoding::ToWide(tempPath); + std::vector buffer(wtempPath.size()+1); buffer[0] = 0; ret = GetShortPathNameW(wtempPath.c_str(), &buffer[0], static_cast(wtempPath.size())); @@ -4519,8 +4515,8 @@ bool SystemTools::GetShortPath(const kwsys_stl::string& path, kwsys_stl::string& #endif } -void SystemTools::SplitProgramFromArgs(const kwsys_stl::string& path, - kwsys_stl::string& program, kwsys_stl::string& args) +void SystemTools::SplitProgramFromArgs(const std::string& path, + std::string& program, std::string& args) { // see if this is a full path to a program // if so then set program to path and args to nothing @@ -4532,8 +4528,8 @@ void SystemTools::SplitProgramFromArgs(const kwsys_stl::string& path, } // Try to find the program in the path, note the program // may have spaces in its name so we have to look for it - kwsys_stl::vector e; - kwsys_stl::string findProg = SystemTools::FindProgram(path, e); + std::vector e; + std::string findProg = SystemTools::FindProgram(path, e); if(!findProg.empty()) { program = findProg; @@ -4543,17 +4539,17 @@ void SystemTools::SplitProgramFromArgs(const kwsys_stl::string& path, // Now try and peel off space separated chunks from the end of the string // so the largest path possible is found allowing for spaces in the path - kwsys_stl::string dir = path; - kwsys_stl::string::size_type spacePos = dir.rfind(' '); - while(spacePos != kwsys_stl::string::npos) + std::string dir = path; + std::string::size_type spacePos = dir.rfind(' '); + while(spacePos != std::string::npos) { - kwsys_stl::string tryProg = dir.substr(0, spacePos); + std::string tryProg = dir.substr(0, spacePos); // See if the file exists if(SystemTools::FileExists(tryProg)) { program = tryProg; // remove trailing spaces from program - kwsys_stl::string::size_type pos = program.size()-1; + std::string::size_type pos = program.size()-1; while(program[pos] == ' ') { program.erase(pos); @@ -4568,7 +4564,7 @@ void SystemTools::SplitProgramFromArgs(const kwsys_stl::string& path, { program = findProg; // remove trailing spaces from program - kwsys_stl::string::size_type pos = program.size()-1; + std::string::size_type pos = program.size()-1; while(program[pos] == ' ') { program.erase(pos); @@ -4586,29 +4582,29 @@ void SystemTools::SplitProgramFromArgs(const kwsys_stl::string& path, args = ""; } -kwsys_stl::string SystemTools::GetCurrentDateTime(const char* format) +std::string SystemTools::GetCurrentDateTime(const char* format) { char buf[1024]; time_t t; time(&t); strftime(buf, sizeof(buf), format, localtime(&t)); - return kwsys_stl::string(buf); + return std::string(buf); } -kwsys_stl::string SystemTools::MakeCidentifier(const kwsys_stl::string& s) +std::string SystemTools::MakeCidentifier(const std::string& s) { - kwsys_stl::string str(s); + std::string str(s); if (str.find_first_of("0123456789") == 0) { str = "_" + str; } - kwsys_stl::string permited_chars("_" + std::string permited_chars("_" "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "0123456789"); - kwsys_stl::string::size_type pos = 0; - while ((pos = str.find_first_not_of(permited_chars, pos)) != kwsys_stl::string::npos) + std::string::size_type pos = 0; + while ((pos = str.find_first_not_of(permited_chars, pos)) != std::string::npos) { str[pos] = '_'; } @@ -4618,8 +4614,8 @@ kwsys_stl::string SystemTools::MakeCidentifier(const kwsys_stl::string& s) // Due to a buggy stream library on the HP and another on Mac OS X, we // need this very carefully written version of getline. Returns true // if any data were read before the end-of-file was reached. -bool SystemTools::GetLineFromStream(kwsys_ios::istream& is, - kwsys_stl::string& line, +bool SystemTools::GetLineFromStream(std::istream& is, + std::string& line, bool* has_newline /* = 0 */, long sizeLimit /* = -1 */) { @@ -4650,7 +4646,7 @@ bool SystemTools::GetLineFromStream(kwsys_ios::istream& is, // been reached. Clear the fail bit just before reading. while(!haveNewline && leftToRead != 0 && - (is.clear(is.rdstate() & ~kwsys_ios::ios::failbit), + (is.clear(is.rdstate() & ~std::ios::failbit), is.getline(buffer, bufferSize), is.gcount() > 0)) { // We have read at least one byte. @@ -4735,10 +4731,10 @@ bool SystemTools::GetPermissions(const char* file, mode_t& mode) { return false; } - return SystemTools::GetPermissions(kwsys_stl::string(file), mode); + return SystemTools::GetPermissions(std::string(file), mode); } -bool SystemTools::GetPermissions(const kwsys_stl::string& file, mode_t& mode) +bool SystemTools::GetPermissions(const std::string& file, mode_t& mode) { #if defined(_WIN32) DWORD attr = GetFileAttributesW( @@ -4793,10 +4789,10 @@ bool SystemTools::SetPermissions(const char* file, return false; } return SystemTools::SetPermissions( - kwsys_stl::string(file), mode, honor_umask); + std::string(file), mode, honor_umask); } -bool SystemTools::SetPermissions(const kwsys_stl::string& file, +bool SystemTools::SetPermissions(const std::string& file, mode_t mode, bool honor_umask) { @@ -4826,19 +4822,19 @@ bool SystemTools::SetPermissions(const kwsys_stl::string& file, return true; } -kwsys_stl::string SystemTools::GetParentDirectory(const kwsys_stl::string& fileOrDir) +std::string SystemTools::GetParentDirectory(const std::string& fileOrDir) { return SystemTools::GetFilenamePath(fileOrDir); } -bool SystemTools::IsSubDirectory(const kwsys_stl::string& cSubdir, const kwsys_stl::string& cDir) +bool SystemTools::IsSubDirectory(const std::string& cSubdir, const std::string& cDir) { if(cDir.empty()) { return false; } - kwsys_stl::string subdir = cSubdir; - kwsys_stl::string dir = cDir; + std::string subdir = cSubdir; + std::string dir = cDir; SystemTools::ConvertToUnixSlashes(subdir); SystemTools::ConvertToUnixSlashes(dir); if(subdir.size() > dir.size() && subdir[dir.size()] == '/') @@ -4873,9 +4869,9 @@ void SystemTools::Delay(unsigned int msec) #endif } -kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion() +std::string SystemTools::GetOperatingSystemNameAndVersion() { - kwsys_stl::string res; + std::string res; #ifdef _WIN32 char buffer[256]; @@ -5170,9 +5166,9 @@ kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion() } // ---------------------------------------------------------------------- -bool SystemTools::ParseURLProtocol( const kwsys_stl::string& URL, - kwsys_stl::string& protocol, - kwsys_stl::string& dataglom ) +bool SystemTools::ParseURLProtocol( const std::string& URL, + std::string& protocol, + std::string& dataglom ) { // match 0 entire url // match 1 protocol @@ -5188,13 +5184,13 @@ bool SystemTools::ParseURLProtocol( const kwsys_stl::string& URL, } // ---------------------------------------------------------------------- -bool SystemTools::ParseURL( const kwsys_stl::string& URL, - kwsys_stl::string& protocol, - kwsys_stl::string& username, - kwsys_stl::string& password, - kwsys_stl::string& hostname, - kwsys_stl::string& dataport, - kwsys_stl::string& database ) +bool SystemTools::ParseURL( const std::string& URL, + std::string& protocol, + std::string& username, + std::string& password, + std::string& hostname, + std::string& dataport, + std::string& database ) { kwsys::RegularExpression urlRe( VTK_URL_REGEX ); if ( ! urlRe.find( URL ) ) return false; @@ -5299,13 +5295,13 @@ void SystemTools::ClassInitialize() // The current working directory may be a logical path. Find // the shortest logical path that still produces the correct // physical path. - kwsys_stl::string cwd_changed; - kwsys_stl::string pwd_changed; + std::string cwd_changed; + std::string pwd_changed; // Test progressively shorter logical-to-physical mappings. - kwsys_stl::string pwd_str = pwd; - kwsys_stl::string cwd_str = cwd; - kwsys_stl::string pwd_path; + std::string pwd_str = pwd; + std::string cwd_str = cwd; + std::string pwd_path; Realpath(pwd, pwd_path); while(cwd_str == pwd_path && cwd_str != pwd_str) { diff --git a/SystemTools.hxx.in b/SystemTools.hxx.in index 164c5e0..d2d1d40 100644 --- a/SystemTools.hxx.in +++ b/SystemTools.hxx.in @@ -12,12 +12,13 @@ #ifndef @KWSYS_NAMESPACE@_SystemTools_hxx #define @KWSYS_NAMESPACE@_SystemTools_hxx -#include <@KWSYS_NAMESPACE@/ios/iosfwd> -#include <@KWSYS_NAMESPACE@/stl/string> -#include <@KWSYS_NAMESPACE@/stl/vector> -#include <@KWSYS_NAMESPACE@/stl/map> +#include <@KWSYS_NAMESPACE@/Configure.hxx> + +#include +#include +#include +#include -#include <@KWSYS_NAMESPACE@/Configure.h> #include <@KWSYS_NAMESPACE@/String.hxx> #include @@ -29,7 +30,7 @@ #include // Required for FILE* #include -#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 // 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 @@ -47,12 +48,6 @@ namespace @KWSYS_NAMESPACE@ } #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@ { @@ -112,9 +107,9 @@ public: * then an underscore is prepended. Note that this can produce * 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); } @@ -122,40 +117,40 @@ public: /** * 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* with); - static void ReplaceString(kwsys_stl::string& source, - const kwsys_stl::string& replace, - const kwsys_stl::string& with); + static void ReplaceString(std::string& source, + const std::string& replace, + const std::string& with); /** * Return a capitalized string (i.e the first letter is uppercased, * 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 * 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 * 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 */ - static kwsys_stl::string LowerCase(const kwsys_stl::string&); + static std::string LowerCase(const std::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 @@ -184,9 +179,9 @@ public: * Returns true if str1 starts (respectively ends) with 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 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 @@ -204,14 +199,14 @@ public: * Return the string cropped to a given length by removing chars in the * 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 /. 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 be /, so /foo/bar will be [/, foo, bar] */ - static kwsys_stl::vector SplitString(const kwsys_stl::string& s, char separator = '/', + static std::vector SplitString(const std::string& s, char separator = '/', bool isPath = false); /** * Perform a case-independent string comparison @@ -229,16 +224,16 @@ public: * Split a string on its newlines into multiple lines * Return false only if the last line stored had no newline */ - static bool Split(const kwsys_stl::string& s, kwsys_stl::vector& l); - static bool Split(const kwsys_stl::string& s, kwsys_stl::vector& l, char separator); + static bool Split(const std::string& s, std::vector& l); + static bool Split(const std::string& s, std::vector& l, char separator); /** * Return string with space added between capitalized words * (i.e. EatMyShorts becomes Eat My Shorts ) * (note that IEatShorts becomes IEat Shorts) */ - static kwsys_stl::string AddSpaceBetweenCapitalizedWords( - const kwsys_stl::string&); + static std::string AddSpaceBetweenCapitalizedWords( + const std::string&); /** * Append two or more strings and produce new one. @@ -265,7 +260,7 @@ public: /** * 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 = '\\'); /** ----------------------------------------------------------------- @@ -276,7 +271,7 @@ public: /** * Replace Windows file system slashes with Unix-style slashes. */ - static void ConvertToUnixSlashes(kwsys_stl::string& path); + static void ConvertToUnixSlashes(std::string& path); #ifdef _WIN32 /** @@ -286,20 +281,20 @@ public: * will be prefixed with \\?\UNC\. All output will also be converted to * absolute paths with Windows-style backslashes. **/ - static kwsys_stl::wstring ConvertToWindowsExtendedPath(const kwsys_stl::string&); + static std::wstring ConvertToWindowsExtendedPath(const std::string&); #endif /** * For windows this calls ConvertToWindowsOutputPath and for unix * 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. * 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 @@ -307,7 +302,7 @@ public: * the string, the slashes are converted to windows style backslashes, and * 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. @@ -318,9 +313,9 @@ public: * for read access is only done on POSIX systems.) */ 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 kwsys_stl::string& filename); + static bool FileExists(const std::string& filename); /** * Test if a file exists and can be accessed with the requested @@ -334,7 +329,7 @@ public: */ static bool TestFileAccess(const char* filename, TestFilePermissions permissions); - static bool TestFileAccess(const kwsys_stl::string& filename, + static bool TestFileAccess(const std::string& filename, TestFilePermissions permissions); /** @@ -349,12 +344,12 @@ public: /** * 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 */ - static bool Touch(const kwsys_stl::string& filename, bool create); + static bool Touch(const std::string& filename, bool create); /** * Compare file modification times. @@ -362,8 +357,8 @@ public: * When true is returned, result has -1, 0, +1 for * f1 older, same, or newer than f2. */ - static bool FileTimeCompare(const kwsys_stl::string& f1, - const kwsys_stl::string& f2, + static bool FileTimeCompare(const std::string& f1, + const std::string& f2, int* result); /** @@ -378,17 +373,17 @@ public: * does not exist path is returned unchanged. This does nothing * 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 * the path with the file stripped off. If there is no directory * part, the empty string is returned. */ - static kwsys_stl::string GetProgramPath(const kwsys_stl::string&); - static bool SplitProgramPath(const kwsys_stl::string& in_name, - kwsys_stl::string& dir, - kwsys_stl::string& file, + static std::string GetProgramPath(const std::string&); + static bool SplitProgramPath(const std::string& in_name, + std::string& dir, + std::string& file, bool errorReport = true); /** @@ -404,8 +399,8 @@ public: * installPrefix is a possibly null pointer to the install directory. */ static bool FindProgramPath(const char* argv0, - kwsys_stl::string& pathOut, - kwsys_stl::string& errorMsg, + std::string& pathOut, + std::string& errorMsg, const char* exeName = 0, const char* buildDir = 0, const char* installPrefix = 0); @@ -416,11 +411,11 @@ public: * (which defaults to the current working directory). The full path * is returned. */ - static kwsys_stl::string CollapseFullPath(const kwsys_stl::string& in_relative); - static kwsys_stl::string CollapseFullPath(const kwsys_stl::string& in_relative, + static std::string CollapseFullPath(const std::string& in_relative); + static std::string CollapseFullPath(const std::string& in_relative, const char* in_base); - static kwsys_stl::string CollapseFullPath(const kwsys_stl::string& in_relative, - const kwsys_stl::string& in_base); + static std::string CollapseFullPath(const std::string& in_relative, + const std::string& in_base); /** * 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 * contains error description. */ - static kwsys_stl::string GetRealPath(const kwsys_stl::string& path, - kwsys_stl::string* errorMessage = 0); + static std::string GetRealPath(const std::string& path, + std::string* errorMessage = 0); /** * Split a path name into its root component and the rest of the @@ -448,7 +443,7 @@ public: * given. */ 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 @@ -461,76 +456,76 @@ public: * platform supports them. */ static void SplitPath(const std::string& p, - kwsys_stl::vector& components, + std::vector& components, bool expand_home_dir = true); /** * Join components of a path name into a single string. See * SplitPath for the format of the components. */ - static kwsys_stl::string JoinPath( - const kwsys_stl::vector& components); - static kwsys_stl::string JoinPath( - kwsys_stl::vector::const_iterator first, - kwsys_stl::vector::const_iterator last); + static std::string JoinPath( + const std::vector& components); + static std::string JoinPath( + std::vector::const_iterator first, + std::vector::const_iterator last); /** * 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) */ - 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) */ - 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 */ static void SplitProgramFromArgs( - const kwsys_stl::string& path, - kwsys_stl::string& program, kwsys_stl::string& args); + const std::string& path, + std::string& program, std::string& args); /** * 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) */ - static kwsys_stl::string GetFilenameLastExtension( - const kwsys_stl::string& filename); + static std::string GetFilenameLastExtension( + const std::string& filename); /** * Return file name without extension of a full filename */ - static kwsys_stl::string GetFilenameWithoutExtension( - const kwsys_stl::string&); + static std::string GetFilenameWithoutExtension( + const std::string&); /** * Return file name without its last (shortest) extension */ - static kwsys_stl::string GetFilenameWithoutLastExtension( - const kwsys_stl::string&); + static std::string GetFilenameWithoutLastExtension( + const std::string&); /** * 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*); /** * For windows return the short path for the given path, * 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 @@ -539,20 +534,20 @@ public: * end-of-file was reached. If the has_newline argument is specified, it will * be true when the line read had a newline character. */ - static bool GetLineFromStream(kwsys_ios::istream& istr, - kwsys_stl::string& line, + static bool GetLineFromStream(std::istream& istr, + std::string& line, bool* has_newline=0, long sizeLimit=-1); /** * 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 */ - 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 @@ -562,7 +557,7 @@ public: /** * 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 @@ -570,36 +565,36 @@ public: * prior to calling this function. */ 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 * if the two files differ. */ - static bool CopyFileIfDifferent(const kwsys_stl::string& source, - const kwsys_stl::string& destination); + static bool CopyFileIfDifferent(const std::string& source, + const std::string& destination); /** * 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 */ - 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. */ - 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 * copied. If it is false, the file is copied only if it is new or * 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); /** @@ -608,18 +603,18 @@ public: * always copied. If it is false, only files that have changed or * 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); /** * Remove a file */ - static bool RemoveFile(const kwsys_stl::string& source); + static bool RemoveFile(const std::string& source); /** * 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 @@ -629,56 +624,56 @@ public: /** * Find a file in the system PATH, with optional extra paths */ - static kwsys_stl::string FindFile( - const kwsys_stl::string& name, - const kwsys_stl::vector& path = - kwsys_stl::vector(), + static std::string FindFile( + const std::string& name, + const std::vector& path = + std::vector(), bool no_system_path = false); /** * Find a directory in the system PATH, with optional extra paths */ - static kwsys_stl::string FindDirectory( - const kwsys_stl::string& name, - const kwsys_stl::vector& path = - kwsys_stl::vector(), + static std::string FindDirectory( + const std::string& name, + const std::vector& path = + std::vector(), bool no_system_path = false); /** * Find an executable in the system PATH, with optional extra paths */ - static kwsys_stl::string FindProgram( + static std::string FindProgram( const char* name, - const kwsys_stl::vector& path = - kwsys_stl::vector(), + const std::vector& path = + std::vector(), bool no_system_path = false); - static kwsys_stl::string FindProgram( - const kwsys_stl::string& name, - const kwsys_stl::vector& path = - kwsys_stl::vector(), + static std::string FindProgram( + const std::string& name, + const std::vector& path = + std::vector(), bool no_system_path = false); - static kwsys_stl::string FindProgram( - const kwsys_stl::vector& names, - const kwsys_stl::vector& path = - kwsys_stl::vector(), + static std::string FindProgram( + const std::vector& names, + const std::vector& path = + std::vector(), bool no_system_path = false); /** * Find a library in the system PATH, with optional extra paths */ - static kwsys_stl::string FindLibrary( - const kwsys_stl::string& name, - const kwsys_stl::vector& path); + static std::string FindLibrary( + const std::string& name, + const std::vector& path); /** * 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 */ - 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) @@ -710,13 +705,13 @@ public: * Create a symbolic link if the platform supports it. Returns whether * 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 * 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'. @@ -735,7 +730,7 @@ public: */ static bool LocateFileInDir(const char *filename, const char *dir, - kwsys_stl::string& filename_found, + std::string& filename_found, int try_filename_dirs = 0); /** 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 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 */ - 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) */ - 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). @@ -774,11 +769,9 @@ public: * if a honor_umask parameter is set to true. */ static bool GetPermissions(const char* file, mode_t& mode); - static bool GetPermissions(const kwsys_stl::string& file, mode_t& mode); - static bool SetPermissions( - const char* file, mode_t mode, bool honor_umask = false); - static bool SetPermissions( - const kwsys_stl::string& file, mode_t mode, bool honor_umask = false); + static bool GetPermissions(const std::string& file, mode_t& mode); + static bool SetPermissions(const char* file, mode_t mode, bool honor_umask = false); + static bool SetPermissions(const std::string& file, mode_t mode, bool honor_umask = false); /** ----------------------------------------------------------------- * Time Manipulation Routines @@ -791,7 +784,7 @@ public: /** * Get current date/time */ - static kwsys_stl::string GetCurrentDateTime(const char* format); + static std::string GetCurrentDateTime(const char* format); /** ----------------------------------------------------------------- * Registry Manipulation Routines @@ -808,26 +801,26 @@ public: /** * Get a list of subkeys. */ - static bool GetRegistrySubKeys(const kwsys_stl::string& key, - kwsys_stl::vector& subkeys, + static bool GetRegistrySubKeys(const std::string& key, + std::vector& subkeys, KeyWOW64 view = KeyWOW64_Default); /** * 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); /** * 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); /** * Delete a registry value */ - static bool DeleteRegistryValue(const kwsys_stl::string& key, + static bool DeleteRegistryValue(const std::string& key, KeyWOW64 view = KeyWOW64_Default); /** ----------------------------------------------------------------- @@ -840,39 +833,39 @@ public: * string vector passed in. If env is set then the value * of env will be used instead of PATH. */ - static void GetPath(kwsys_stl::vector& path, + static void GetPath(std::vector& path, const char* env=0); /** * Read an environment variable */ static const char* GetEnv(const char* key); - static const char* GetEnv(const kwsys_stl::string& key); - static bool GetEnv(const char* key, kwsys_stl::string& result); - static bool GetEnv(const kwsys_stl::string& key, kwsys_stl::string& result); + static const char* GetEnv(const std::string& key); + static bool GetEnv(const char* key, std::string& result); + static bool GetEnv(const std::string& key, std::string& result); /** Put a string into the environment 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. 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 */ - static kwsys_stl::string GetCurrentWorkingDirectory(bool collapse =true); + static std::string GetCurrentWorkingDirectory(bool collapse =true); /** * 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) */ - static kwsys_stl::string GetLastSystemError(); + static std::string GetLastSystemError(); /** * When building DEBUG with MSVC, this enables a hook that prevents @@ -891,18 +884,18 @@ public: /** * 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, * 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; */ - static void CheckTranslationPath(kwsys_stl::string & path); + static void CheckTranslationPath(std::string & path); /** * Delay the execution for a specified amount of time specified @@ -914,7 +907,7 @@ public: * Get the operating system name and version * This is implemented for Win32 only for the moment */ - static kwsys_stl::string GetOperatingSystemNameAndVersion(); + static std::string GetOperatingSystemNameAndVersion(); /** ----------------------------------------------------------------- * URL Manipulation Routines @@ -927,9 +920,9 @@ public: * and fill protocol as appropriate. * Return false if the URL does not have the required form, true otherwise. */ - static bool ParseURLProtocol( const kwsys_stl::string& URL, - kwsys_stl::string& protocol, - kwsys_stl::string& dataglom ); + static bool ParseURLProtocol( const std::string& URL, + std::string& protocol, + std::string& dataglom ); /** * Parse a string (a URL without protocol prefix) with the form: @@ -938,13 +931,13 @@ public: * when values are found. * Return true if the string matches the format; false otherwise. */ - static bool ParseURL( const kwsys_stl::string& URL, - kwsys_stl::string& protocol, - kwsys_stl::string& username, - kwsys_stl::string& password, - kwsys_stl::string& hostname, - kwsys_stl::string& dataport, - kwsys_stl::string& datapath ); + static bool ParseURL( const std::string& URL, + std::string& protocol, + std::string& username, + std::string& password, + std::string& hostname, + std::string& dataport, + std::string& datapath ); private: /** @@ -968,10 +961,10 @@ private: /** * Actual implementation of ReplaceString. */ - static void ReplaceString(kwsys_stl::string& source, + static void ReplaceString(std::string& source, const char* replace, size_t replaceSize, - const kwsys_stl::string& with); + const std::string& with); /** * Actual implementation of FileIsFullPath. @@ -982,10 +975,10 @@ private: * Find a filename (file or directory) in the system PATH, with * optional extra paths. */ - static kwsys_stl::string FindName( - const kwsys_stl::string& name, - const kwsys_stl::vector& path = - kwsys_stl::vector(), + static std::string FindName( + const std::string& name, + const std::vector& path = + std::vector(), bool no_system_path = false); @@ -1005,10 +998,4 @@ private: } // namespace @KWSYS_NAMESPACE@ -/* Undefine temporary macros. */ -#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS -# undef kwsys_stl -# undef kwsys_ios -#endif - #endif diff --git a/hash_fun.hxx.in b/hash_fun.hxx.in index 6f787dd..4872b51 100644 --- a/hash_fun.hxx.in +++ b/hash_fun.hxx.in @@ -38,8 +38,8 @@ #define @KWSYS_NAMESPACE@_hash_fun_hxx #include <@KWSYS_NAMESPACE@/Configure.hxx> -#include <@KWSYS_NAMESPACE@/cstddef> // size_t -#include <@KWSYS_NAMESPACE@/stl/string> // string +#include // size_t +#include namespace @KWSYS_NAMESPACE@ { @@ -55,90 +55,90 @@ inline size_t _stl_hash_string(const char* __s) return size_t(__h); } -@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION +template <> struct hash { size_t operator()(const char* __s) const { return _stl_hash_string(__s); } }; -@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION +template <> struct hash { size_t operator()(const char* __s) const { return _stl_hash_string(__s); } }; -@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION - struct hash<@KWSYS_NAMESPACE@_stl::string> { - size_t operator()(const @KWSYS_NAMESPACE@_stl::string & __s) const { return _stl_hash_string(__s.c_str()); } +template <> + struct hash { + size_t operator()(const std::string & __s) const { return _stl_hash_string(__s.c_str()); } }; #if !defined(__BORLANDC__) -@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION - struct hash { - size_t operator()(const @KWSYS_NAMESPACE@_stl::string & __s) const { return _stl_hash_string(__s.c_str()); } +template <> + struct hash { + size_t operator()(const std::string & __s) const { return _stl_hash_string(__s.c_str()); } }; #endif -@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION +template <> struct hash { size_t operator()(char __x) const { return __x; } }; -@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION +template <> struct hash { size_t operator()(unsigned char __x) const { return __x; } }; -@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION +template <> struct hash { size_t operator()(unsigned char __x) const { return __x; } }; -@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION +template <> struct hash { size_t operator()(short __x) const { return __x; } }; -@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION +template <> struct hash { size_t operator()(unsigned short __x) const { return __x; } }; -@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION +template <> struct hash { size_t operator()(int __x) const { return __x; } }; -@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION +template <> struct hash { size_t operator()(unsigned int __x) const { return __x; } }; -@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION +template <> struct hash { size_t operator()(long __x) const { return __x; } }; -@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION +template <> struct hash { size_t operator()(unsigned long __x) const { return __x; } }; // use long long or __int64 #if @KWSYS_USE_LONG_LONG@ -@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION +template <> struct hash { size_t operator()(long long __x) const { return __x; } }; -@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION +template <> struct hash { size_t operator()(unsigned long long __x) const { return __x; } }; #elif @KWSYS_USE___INT64@ -@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION +template <> struct hash<__int64> { size_t operator()(__int64 __x) const { return __x; } }; -@KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION +template <> struct hash { size_t operator()(unsigned __int64 __x) const { return __x; } }; diff --git a/hash_map.hxx.in b/hash_map.hxx.in index 6d4379d..60c7086 100644 --- a/hash_map.hxx.in +++ b/hash_map.hxx.in @@ -39,7 +39,7 @@ #include <@KWSYS_NAMESPACE@/hashtable.hxx> #include <@KWSYS_NAMESPACE@/hash_fun.hxx> -#include <@KWSYS_NAMESPACE@/stl/functional> // equal_to +#include // equal_to #if defined(_MSC_VER) # pragma warning (push) @@ -58,9 +58,9 @@ namespace @KWSYS_NAMESPACE@ // select1st is an extension: it is not part of the standard. template struct hash_select1st: - public @KWSYS_NAMESPACE@_stl::unary_function<@KWSYS_NAMESPACE@_stl::pair, T1> + public std::unary_function, T1> { - const T1& operator()(const @KWSYS_NAMESPACE@_stl::pair& __x) const + const T1& operator()(const std::pair& __x) const { return __x.first; } }; @@ -68,8 +68,8 @@ struct hash_select1st: template , - class _EqualKey = @KWSYS_NAMESPACE@_stl::equal_to<_Key>, - class _Alloc = @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(char) > + class _EqualKey = std::equal_to<_Key>, + class _Alloc = std::allocator > class hash_map; template @@ -81,7 +81,7 @@ template ,_Key,_HashFcn, + typedef hashtable,_Key,_HashFcn, hash_select1st,_EqualKey,_Alloc> _Ht; _Ht _M_ht; @@ -119,7 +119,6 @@ public: const allocator_type& __a = allocator_type()) : _M_ht(__n, __hf, __eql, __a) {} -#if @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES template hash_map(_InputIterator __f, _InputIterator __l) : _M_ht(100, hasher(), key_equal(), allocator_type()) @@ -140,48 +139,14 @@ public: : _M_ht(__n, __hf, __eql, __a) { _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: size_type size() const { return _M_ht.size(); } size_type max_size() const { return _M_ht.max_size(); } bool empty() const { return _M_ht.empty(); } void swap(hash_map& __hs) { _M_ht.swap(__hs._M_ht); } - friend bool operator==@KWSYS_NAMESPACE@_CXX_NULL_TEMPLATE_ARGS(const hash_map&, - const hash_map&); + friend bool operator==<>(const hash_map&, + const hash_map&); iterator begin() { return _M_ht.begin(); } iterator end() { return _M_ht.end(); } @@ -189,20 +154,12 @@ public: const_iterator end() const { return _M_ht.end(); } public: - @KWSYS_NAMESPACE@_stl::pair insert(const value_type& __obj) + std::pair insert(const value_type& __obj) { return _M_ht.insert_unique(__obj); } -#if @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES template void insert(_InputIterator __f, _InputIterator __l) { _M_ht.insert_unique(__f,__l); } -#else - 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 insert_noresize(const value_type& __obj) + std::pair insert_noresize(const value_type& __obj) { return _M_ht.insert_unique_noresize(__obj); } 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); } - @KWSYS_NAMESPACE@_stl::pair equal_range(const key_type& __key) + std::pair equal_range(const key_type& __key) { return _M_ht.equal_range(__key); } - @KWSYS_NAMESPACE@_stl::pair + std::pair equal_range(const key_type& __key) const { return _M_ht.equal_range(__key); } @@ -260,8 +217,8 @@ swap(hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1, template , - class _EqualKey = @KWSYS_NAMESPACE@_stl::equal_to<_Key>, - class _Alloc = @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(char) > + class _EqualKey = std::equal_to<_Key>, + class _Alloc = std::allocator > class hash_multimap; template @@ -274,7 +231,7 @@ template , _Key, _HashFcn, + typedef hashtable, _Key, _HashFcn, hash_select1st, _EqualKey, _Alloc> _Ht; _Ht _M_ht; @@ -313,7 +270,6 @@ public: const allocator_type& __a = allocator_type()) : _M_ht(__n, __hf, __eql, __a) {} -#if @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES template hash_multimap(_InputIterator __f, _InputIterator __l) : _M_ht(100, hasher(), key_equal(), allocator_type()) @@ -334,48 +290,14 @@ public: : _M_ht(__n, __hf, __eql, __a) { _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: size_type size() const { return _M_ht.size(); } size_type max_size() const { return _M_ht.max_size(); } bool empty() const { return _M_ht.empty(); } void swap(hash_multimap& __hs) { _M_ht.swap(__hs._M_ht); } - friend bool operator==@KWSYS_NAMESPACE@_CXX_NULL_TEMPLATE_ARGS(const hash_multimap&, - const hash_multimap&); + friend bool operator==<>(const hash_multimap&, + const hash_multimap&); iterator begin() { return _M_ht.begin(); } iterator end() { return _M_ht.end(); } @@ -385,17 +307,9 @@ public: public: iterator insert(const value_type& __obj) { return _M_ht.insert_equal(__obj); } -#if @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES template void insert(_InputIterator __f, _InputIterator __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) { 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); } - @KWSYS_NAMESPACE@_stl::pair equal_range(const key_type& __key) + std::pair equal_range(const key_type& __key) { return _M_ht.equal_range(__key); } - @KWSYS_NAMESPACE@_stl::pair + std::pair equal_range(const key_type& __key) const { return _M_ht.equal_range(__key); } diff --git a/hash_set.hxx.in b/hash_set.hxx.in index 5ee01a5..c314979 100644 --- a/hash_set.hxx.in +++ b/hash_set.hxx.in @@ -39,7 +39,7 @@ #include <@KWSYS_NAMESPACE@/hashtable.hxx> #include <@KWSYS_NAMESPACE@/hash_fun.hxx> -#include <@KWSYS_NAMESPACE@/stl/functional> // equal_to +#include // equal_to #if defined(_MSC_VER) # pragma warning (push) @@ -57,7 +57,7 @@ namespace @KWSYS_NAMESPACE@ // identity is an extension: it is not part of the standard. template -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; } }; @@ -66,8 +66,8 @@ struct _Identity : public @KWSYS_NAMESPACE@_stl::unary_function<_Tp,_Tp> template , - class _EqualKey = @KWSYS_NAMESPACE@_stl::equal_to<_Value>, - class _Alloc = @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(char) > + class _EqualKey = std::equal_to<_Value>, + class _Alloc = std::allocator > class hash_set; template @@ -116,7 +116,6 @@ public: const allocator_type& __a = allocator_type()) : _M_ht(__n, __hf, __eql, __a) {} -#if @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES template hash_set(_InputIterator __f, _InputIterator __l) : _M_ht(100, hasher(), key_equal(), allocator_type()) @@ -136,40 +135,6 @@ public: const allocator_type& __a = allocator_type()) : _M_ht(__n, __hf, __eql, __a) { _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: size_type size() const { return _M_ht.size(); } @@ -177,43 +142,35 @@ public: bool empty() const { return _M_ht.empty(); } void swap(hash_set& __hs) { _M_ht.swap(__hs._M_ht); } - friend bool operator==@KWSYS_NAMESPACE@_CXX_NULL_TEMPLATE_ARGS(const hash_set&, - const hash_set&); + friend bool operator==<>(const hash_set&, + const hash_set&); iterator begin() const { return _M_ht.begin(); } iterator end() const { return _M_ht.end(); } public: - @KWSYS_NAMESPACE@_stl::pair insert(const value_type& __obj) + std::pair insert(const value_type& __obj) { typedef typename _Ht::iterator _Ht_iterator; - @KWSYS_NAMESPACE@_stl::pair<_Ht_iterator, bool> __p = _M_ht.insert_unique(__obj); - return @KWSYS_NAMESPACE@_stl::pair(__p.first, __p.second); + std::pair<_Ht_iterator, bool> __p = _M_ht.insert_unique(__obj); + return std::pair(__p.first, __p.second); } -#if @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES template void insert(_InputIterator __f, _InputIterator __l) { _M_ht.insert_unique(__f,__l); } -#else - 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 insert_noresize(const value_type& __obj) + std::pair insert_noresize(const value_type& __obj) { 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); - return @KWSYS_NAMESPACE@_stl::pair(__p.first, __p.second); + return std::pair(__p.first, __p.second); } 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); } - @KWSYS_NAMESPACE@_stl::pair equal_range(const key_type& __key) const + std::pair equal_range(const key_type& __key) const { return _M_ht.equal_range(__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 _EqualKey = @KWSYS_NAMESPACE@_stl::equal_to<_Value>, - class _Alloc = @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(char) > + class _EqualKey = std::equal_to<_Value>, + class _Alloc = std::allocator > class hash_multiset; template @@ -305,7 +262,6 @@ public: const allocator_type& __a = allocator_type()) : _M_ht(__n, __hf, __eql, __a) {} -#if @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES template hash_multiset(_InputIterator __f, _InputIterator __l) : _M_ht(100, hasher(), key_equal(), allocator_type()) @@ -325,40 +281,6 @@ public: const allocator_type& __a = allocator_type()) : _M_ht(__n, __hf, __eql, __a) { _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: size_type size() const { return _M_ht.size(); } @@ -366,8 +288,8 @@ public: bool empty() const { return _M_ht.empty(); } void swap(hash_multiset& hs) { _M_ht.swap(hs._M_ht); } - friend bool operator==@KWSYS_NAMESPACE@_CXX_NULL_TEMPLATE_ARGS(const hash_multiset&, - const hash_multiset&); + friend bool operator==<>(const hash_multiset&, + const hash_multiset&); iterator begin() const { return _M_ht.begin(); } iterator end() const { return _M_ht.end(); } @@ -375,17 +297,9 @@ public: public: iterator insert(const value_type& __obj) { return _M_ht.insert_equal(__obj); } -#if @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES template void insert(_InputIterator __f, _InputIterator __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) { 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); } - @KWSYS_NAMESPACE@_stl::pair equal_range(const key_type& __key) const + std::pair equal_range(const key_type& __key) const { return _M_ht.equal_range(__key); } size_type erase(const key_type& __key) {return _M_ht.erase(__key); } diff --git a/hashtable.hxx.in b/hashtable.hxx.in index 7e7dc42..9a20226 100644 --- a/hashtable.hxx.in +++ b/hashtable.hxx.in @@ -44,13 +44,13 @@ #include <@KWSYS_NAMESPACE@/Configure.hxx> -#include <@KWSYS_NAMESPACE@/cstddef> // size_t -#include <@KWSYS_NAMESPACE@/stl/algorithm> // lower_bound -#include <@KWSYS_NAMESPACE@/stl/functional> // unary_function -#include <@KWSYS_NAMESPACE@/stl/iterator> // iterator_traits -#include <@KWSYS_NAMESPACE@/stl/memory> // allocator -#include <@KWSYS_NAMESPACE@/stl/utility> // pair -#include <@KWSYS_NAMESPACE@/stl/vector> // vector +#include // size_t +#include // lower_bound +#include // unary_function +#include // iterator_traits +#include // allocator +#include // pair +#include // vector #if defined(_MSC_VER) # pragma warning (push) @@ -73,238 +73,9 @@ # 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@ { -//---------------------------------------------------------------------------- -// 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 inline size_t hash_sizeof(TPtr p) -{ - static_cast(p); - return sizeof(*p); -} -template -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 -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(hint)); - out = static_cast(vout); -} - -template -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(vout); -} - -template -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(hint)); - out = static_cast(vout); -} - -template -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(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 -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(vout), n_in); -} - -template -inline void hash_deallocate(TAlloc* a, void (TAlloc::*deallocate)(PIn), - PInReal, POut p, TSize, int, int, long) -{ - void* vout = p; - (a->*deallocate)(static_cast(vout)); -} - -template -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(vout), n_in); -} - -template -inline void hash_deallocate(void*, void (*deallocate)(PIn), - PInReal, POut p, TSize, long, long, long) -{ - void* vout = p; - deallocate(static_cast(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 -inline PIn hash_allocate_type(PIn (TAlloc::*)(TSize, THint), - int, int, int) { return 0; } -template -inline PIn hash_allocate_type(PIn (TAlloc::*)(TSize), - int, int, long) { return 0; } -template -inline PIn hash_allocate_type(PIn (*)(TSize, THint), - int, long, long) { return 0; } -template -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 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 - struct rebind { typedef hash_allocator 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 struct _Hashtable_node { @@ -317,7 +88,7 @@ private: template + class _Alloc = std::allocator > class hashtable; template _Node; - typedef @KWSYS_NAMESPACE@_stl::forward_iterator_tag iterator_category; + typedef std::forward_iterator_tag iterator_category; typedef _Val value_type; typedef ptrdiff_t difference_type; typedef size_t size_type; @@ -378,7 +149,7 @@ struct _Hashtable_const_iterator { const_iterator; 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 ptrdiff_t difference_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* __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; } @@ -470,27 +241,13 @@ public: private: typedef _Hashtable_node<_Val> _Node; -#if @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_REBIND public: typedef typename _Alloc::template rebind<_Val>::other allocator_type; allocator_type get_allocator() const { return _M_node_allocator; } private: typedef typename _Alloc::template rebind<_Node>::other _M_node_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; -#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 + typedef std::vector<_Node*,_M_node_ptr_allocator_type> _M_buckets_type; private: _M_node_allocator_type _M_node_allocator; @@ -525,7 +282,7 @@ public: _M_hash(__hf), _M_equals(__eql), _M_get_key(__ext), - @KWSYS_NAMESPACE@_HASH_BUCKETS_INIT(__a), + _M_buckets(__a), _M_num_elements(0) { _M_initialize_buckets(__n); @@ -539,7 +296,7 @@ public: _M_hash(__hf), _M_equals(__eql), _M_get_key(_ExtractKey()), - @KWSYS_NAMESPACE@_HASH_BUCKETS_INIT(__a), + _M_buckets(__a), _M_num_elements(0) { _M_initialize_buckets(__n); @@ -550,7 +307,7 @@ public: _M_hash(__ht._M_hash), _M_equals(__ht._M_equals), _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_copy_from(__ht); @@ -576,11 +333,11 @@ public: void swap(hashtable& __ht) { - @KWSYS_NAMESPACE@_stl::swap(_M_hash, __ht._M_hash); - @KWSYS_NAMESPACE@_stl::swap(_M_equals, __ht._M_equals); - @KWSYS_NAMESPACE@_stl::swap(_M_get_key, __ht._M_get_key); + std::swap(_M_hash, __ht._M_hash); + std::swap(_M_equals, __ht._M_equals); + std::swap(_M_get_key, __ht._M_get_key); _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() @@ -603,8 +360,8 @@ public: const_iterator end() const { return const_iterator(0, this); } - friend bool operator==@KWSYS_NAMESPACE@_CXX_NULL_TEMPLATE_ARGS(const hashtable&, - const hashtable&); + friend bool operator==<>(const hashtable&, + const hashtable&); public: @@ -621,7 +378,7 @@ public: return __result; } - @KWSYS_NAMESPACE@_stl::pair insert_unique(const value_type& __obj) + std::pair insert_unique(const value_type& __obj) { resize(_M_num_elements + 1); return insert_unique_noresize(__obj); @@ -633,38 +390,26 @@ public: return insert_equal_noresize(__obj); } - @KWSYS_NAMESPACE@_stl::pair insert_unique_noresize(const value_type& __obj); + std::pair insert_unique_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 void insert_unique(_InputIterator __f, _InputIterator __l) { insert_unique(__f, __l, - @KWSYS_NAMESPACE@_HASH_ITERATOR_CATEGORY(_InputIterator, __f)); + typename std::iterator_traits<_InputIterator>::iterator_category()); } template void insert_equal(_InputIterator __f, _InputIterator __l) { insert_equal(__f, __l, - @KWSYS_NAMESPACE@_HASH_ITERATOR_CATEGORY(_InputIterator, __f)); + typename std::iterator_traits<_InputIterator>::iterator_category()); } template void insert_unique(_InputIterator __f, _InputIterator __l, - @KWSYS_NAMESPACE@_stl::input_iterator_tag) + std::input_iterator_tag) { for ( ; __f != __l; ++__f) insert_unique(*__f); @@ -672,7 +417,7 @@ public: template void insert_equal(_InputIterator __f, _InputIterator __l, - @KWSYS_NAMESPACE@_stl::input_iterator_tag) + std::input_iterator_tag) { for ( ; __f != __l; ++__f) insert_equal(*__f); @@ -680,10 +425,10 @@ public: template void insert_unique(_ForwardIterator __f, _ForwardIterator __l, - @KWSYS_NAMESPACE@_stl::forward_iterator_tag) + std::forward_iterator_tag) { size_type __n = 0; - @KWSYS_NAMESPACE@_stl::distance(__f, __l, __n); + std::distance(__f, __l, __n); resize(_M_num_elements + __n); for ( ; __n > 0; --__n, ++__f) insert_unique_noresize(*__f); @@ -691,51 +436,15 @@ public: template void insert_equal(_ForwardIterator __f, _ForwardIterator __l, - @KWSYS_NAMESPACE@_stl::forward_iterator_tag) + std::forward_iterator_tag) { size_type __n = 0; - @KWSYS_NAMESPACE@_stl::distance(__f, __l, __n); + std::distance(__f, __l, __n); resize(_M_num_elements + __n); for ( ; __n > 0; --__n, ++__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); iterator find(const key_type& __key) @@ -771,10 +480,10 @@ public: return __result; } - @KWSYS_NAMESPACE@_stl::pair + std::pair equal_range(const key_type& __key); - @KWSYS_NAMESPACE@_stl::pair + std::pair equal_range(const key_type& __key) const; size_type erase(const key_type& __key); @@ -936,7 +645,7 @@ inline void swap(hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht1, } template -@KWSYS_NAMESPACE@_stl::pair<@KWSYS_NAMESPACE@_CXX_DECL_TYPENAME hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator, bool> +std::pair::iterator, bool> hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> ::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) if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj))) - return @KWSYS_NAMESPACE@_stl::pair(iterator(__cur, this), false); + return std::pair(iterator(__cur, this), false); _Node* __tmp = _M_new_node(__obj); __tmp->_M_next = __first; _M_buckets[__n] = __tmp; ++_M_num_elements; - return @KWSYS_NAMESPACE@_stl::pair(iterator(__tmp, this), true); + return std::pair(iterator(__tmp, this), true); } template @@ -999,11 +708,11 @@ hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::find_or_insert(const value_type& __obj) } template -@KWSYS_NAMESPACE@_stl::pair<@KWSYS_NAMESPACE@_CXX_DECL_TYPENAME hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator, - @KWSYS_NAMESPACE@_CXX_DECL_TYPENAME hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator> +std::pair::iterator, + typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator> hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::equal_range(const key_type& __key) { - typedef @KWSYS_NAMESPACE@_stl::pair _Pii; + typedef std::pair _Pii; const size_type __n = _M_bkt_num_key(__key); 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 -@KWSYS_NAMESPACE@_stl::pair<@KWSYS_NAMESPACE@_CXX_DECL_TYPENAME hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::const_iterator, - @KWSYS_NAMESPACE@_CXX_DECL_TYPENAME hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::const_iterator> +std::pair::const_iterator, + typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::const_iterator> hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> ::equal_range(const key_type& __key) const { - typedef @KWSYS_NAMESPACE@_stl::pair _Pii; + typedef std::pair _Pii; const size_type __n = _M_bkt_num_key(__key); 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); if (__n > __old_n) { _M_buckets_type __tmp( - __n, (_Node*)(0) - @KWSYS_NAMESPACE@_HASH_BUCKETS_GET_ALLOCATOR(_M_buckets)); + __n, (_Node*)(0), + _M_buckets.get_allocator()); try { for (size_type __bucket = 0; __bucket < __old_n; ++__bucket) { _Node* __first = _M_buckets[__bucket]; @@ -1274,14 +983,6 @@ void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> } // 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. #if defined(__clang__) && defined(__has_warning) # if __has_warning("-Wdeprecated") diff --git a/kwsysPlatformTestsCXX.cxx b/kwsysPlatformTestsCXX.cxx index 1596fe4..94579b3 100644 --- a/kwsysPlatformTestsCXX.cxx +++ b/kwsysPlatformTestsCXX.cxx @@ -9,110 +9,11 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 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 -# else -# include -# 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 -void f(std ::list*) {} -int main() { return 0; } -#endif - -#ifdef TEST_KWSYS_IOS_USE_ANSI -#include -int main() { return 0; } -#endif - -#ifdef TEST_KWSYS_IOS_HAVE_STD -#include -void f(std ::ostream*) {} -int main() { return 0; } -#endif - -#ifdef TEST_KWSYS_IOS_USE_SSTREAM -#include -#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 -int main() { return 0; } -#endif - -#ifdef TEST_KWSYS_IOS_USE_STRSTREA_H -#include -int main() { return 0; } -#endif - -#ifdef TEST_KWSYS_STL_STRING_HAVE_OSTREAM -# include -# include -void f(ostream& os, const kwsys_stl::string& s) { os << s; } -int main() { return 0; } -#endif - -#ifdef TEST_KWSYS_STL_STRING_HAVE_ISTREAM -# include -# include -void f(istream& is, kwsys_stl::string& s) { is >> s; } -int main() { return 0; } -#endif - -#ifdef TEST_KWSYS_STL_STRING_HAVE_NEQ_CHAR -# include -bool f(const kwsys_stl::string& s) { return s != ""; } -int main() { return 0; } -#endif - #ifdef TEST_KWSYS_CXX_HAS_CSTDIO #include int main() { return 0; } #endif -#ifdef TEST_KWSYS_CXX_HAS_CSTDDEF -#include -void f(size_t) {} -int main() { return 0; } -#endif - #ifdef TEST_KWSYS_CXX_HAS_LONG_LONG long long f(long long n) { return n; } int main() @@ -131,150 +32,6 @@ int main() } #endif -#ifdef TEST_KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS -template class A; -template int f(A&); -template class A -{ -public: - // "friend int f<>(A&)" would conform - friend int f(A&); -private: - int x; -}; - -template int f(A& a) { return a.x = 0; } -template int f(A&); - -int main() -{ - A a; - return f(a); -} -#endif - -#ifdef TEST_KWSYS_CXX_HAS_MEMBER_TEMPLATES -template -class A -{ -public: - U u; - A(): u(0) {} - template V m(V* p) { return *p = u; } -}; - -int main() -{ - A a; - int s = 1; - return a.m(&s); -} -#endif - -#ifdef TEST_KWSYS_CXX_HAS_FULL_SPECIALIZATION -template struct A {}; -template <> struct A -{ - static int f() { return 0; } -}; -int main() { return A::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 -#include -void f(kwsys_stl::iterator_traits::iterator>::iterator_category const&) {} -int main() { return 0; } -#endif - -#ifdef TEST_KWSYS_STL_HAS_ITERATOR_CATEGORY -#include -#include -void f(kwsys_stl::list::iterator x) { kwsys_stl::iterator_category(x); } -int main() { return 0; } -#endif - -#ifdef TEST_KWSYS_STL_HAS___ITERATOR_CATEGORY -#include -#include -void f(kwsys_stl::list::iterator x) { kwsys_stl::__iterator_category(x); } -int main() { return 0; } -#endif - -#ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_TEMPLATE -#include -template -void f(const Alloc&) -{ - typedef typename Alloc::size_type alloc_size_type; -} -int main() -{ - f(kwsys_stl::allocator()); - return 0; -} -#endif - -#ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE -#include -void f(kwsys_stl::allocator::size_type const&) {} -int main() { return 0; } -#endif - -#ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_REBIND -#include -template -void f(const T&, const Alloc&) -{ - typedef typename Alloc::template rebind::other alloc_type; -} -int main() -{ - f(0, kwsys_stl::allocator()); - return 0; -} -#endif - -#ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT -#include -void f(kwsys_stl::allocator const& a) -{ - a.max_size(sizeof(int)); -} -int main() -{ - f(kwsys_stl::allocator()); - return 0; -} -#endif - -#ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_OBJECTS -#include -void f(kwsys_stl::vector const& v1) -{ - kwsys_stl::vector(1, 1, v1.get_allocator()); -} -int main() -{ - f(kwsys_stl::vector()); - return 0; -} -#endif - #ifdef TEST_KWSYS_STAT_HAS_ST_MTIM #include #include @@ -323,62 +80,55 @@ int main() } #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 -int test_istream(kwsys_ios::istream& is, long long& x) +# include +int test_istream(std::istream& is, long long& x) { return (is >> x)? 1:0; } int main() { long long x = 0; - return test_istream(kwsys_ios::cin, x); + return test_istream(std::cin, x); } #endif #ifdef TEST_KWSYS_IOS_HAS_OSTREAM_LONG_LONG -int test_ostream(kwsys_ios::ostream& os, long long x) +# include +int test_ostream(std::ostream& os, long long x) { return (os << x)? 1:0; } int main() { long long x = 0; - return test_ostream(kwsys_ios::cout, x); + return test_ostream(std::cout, x); } #endif #ifdef TEST_KWSYS_IOS_HAS_ISTREAM___INT64 -int test_istream(kwsys_ios::istream& is, __int64& x) +# include +int test_istream(std::istream& is, __int64& x) { return (is >> x)? 1:0; } int main() { __int64 x = 0; - return test_istream(kwsys_ios::cin, x); + return test_istream(std::cin, x); } #endif #ifdef TEST_KWSYS_IOS_HAS_OSTREAM___INT64 -int test_ostream(kwsys_ios::ostream& os, __int64 x) +# include +int test_ostream(std::ostream& os, __int64 x) { return (os << x)? 1:0; } int main() { __int64 x = 0; - return test_ostream(kwsys_ios::cout, x); + return test_ostream(std::cout, x); } #endif diff --git a/kwsys_cstddef.hxx.in b/kwsys_cstddef.hxx.in deleted file mode 100644 index 925c030..0000000 --- a/kwsys_cstddef.hxx.in +++ /dev/null @@ -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 -#else -# include -#endif - -#ifdef _MSC_VER -# pragma warning(pop) -#endif - -#endif diff --git a/kwsys_ios_fstream.h.in b/kwsys_ios_fstream.h.in deleted file mode 100644 index 4b1a8cf..0000000 --- a/kwsys_ios_fstream.h.in +++ /dev/null @@ -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 -#else -# include -#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 diff --git a/kwsys_ios_iosfwd.h.in b/kwsys_ios_iosfwd.h.in deleted file mode 100644 index f4fafeb..0000000 --- a/kwsys_ios_iosfwd.h.in +++ /dev/null @@ -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 -#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 diff --git a/kwsys_ios_iostream.h.in b/kwsys_ios_iostream.h.in deleted file mode 100644 index 43fc4d5..0000000 --- a/kwsys_ios_iostream.h.in +++ /dev/null @@ -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 -#else -# include -#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 diff --git a/kwsys_ios_sstream.h.in b/kwsys_ios_sstream.h.in deleted file mode 100644 index 29d250c..0000000 --- a/kwsys_ios_sstream.h.in +++ /dev/null @@ -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 -# 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 -# elif @KWSYS_NAMESPACE@_IOS_USE_STRSTREAM_H -# include -# elif @KWSYS_NAMESPACE@_IOS_USE_STRSTREA_H -# include -# endif -# if @KWSYS_NAMESPACE@_IOS_USE_ANSI -# include // Need placement operator new. -# else -# include // 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(StdString::c_str())) {} - istringstream(const kwsys_stl::string& s): - StdString(s), IStrStream(const_cast(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 diff --git a/kwsys_stl.hxx.in b/kwsys_stl.hxx.in deleted file mode 100644 index 610e6d4..0000000 --- a/kwsys_stl.hxx.in +++ /dev/null @@ -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 diff --git a/kwsys_stl_string.hxx.in b/kwsys_stl_string.hxx.in deleted file mode 100644 index cd312cb..0000000 --- a/kwsys_stl_string.hxx.in +++ /dev/null @@ -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 // 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(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(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 diff --git a/testCommandLineArguments.cxx b/testCommandLineArguments.cxx index 6a03c0f..525522d 100644 --- a/testCommandLineArguments.cxx +++ b/testCommandLineArguments.cxx @@ -11,16 +11,16 @@ ============================================================================*/ #include "kwsysPrivate.h" #include KWSYS_HEADER(CommandLineArguments.hxx) -#include KWSYS_HEADER(ios/iostream) -#include KWSYS_HEADER(stl/vector) // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. #if 0 # include "CommandLineArguments.hxx.in" -# include "kwsys_ios_iostream.h.in" #endif +#include +#include + #include /* size_t */ #include /* strcmp */ @@ -28,10 +28,10 @@ static void* random_ptr = reinterpret_cast(0x123); 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 ) { - kwsys_ios::cerr << "Problem processing call_data" << kwsys_ios::endl; + std::cerr << "Problem processing call_data" << std::endl; return 0; } 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) { - kwsys_ios::cout << "Got unknown argument: \"" << argument << "\"" << kwsys_ios::endl; + std::cout << "Got unknown argument: \"" << argument << "\"" << std::endl; 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 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(const char* i1, const char* i2) { return strcmp(i1, i2) == 0; } -static bool CompareTwoItemsOnList(const kwsys_stl::string& i1, - const kwsys_stl::string& i2) { return i1 == i2; } +static bool CompareTwoItemsOnList(const std::string& i1, + const std::string& i2) { return i1 == i2; } int testCommandLineArguments(int argc, char* argv[]) { @@ -74,26 +74,26 @@ int testCommandLineArguments(int argc, char* argv[]) int some_int_variable = 10; double some_double_variable = 10.10; 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_variable1 = false; bool bool_arg1 = false; int bool_arg2 = 0; - kwsys_stl::vector numbers_argument; + std::vector numbers_argument; int valid_numbers[] = { 5, 1, 8, 3, 7, 1, 3, 9, 7, 1 }; - kwsys_stl::vector doubles_argument; + std::vector doubles_argument; double valid_doubles[] = { 12.5, 1.31, 22 }; - kwsys_stl::vector bools_argument; + std::vector bools_argument; bool valid_bools[] = { true, true, false }; - kwsys_stl::vector strings_argument; + std::vector strings_argument; const char* valid_strings[] = { "andy", "bill", "brad", "ken" }; - kwsys_stl::vector stl_strings_argument; - kwsys_stl::string valid_stl_strings[] = { "ken", "brad", "bill", "andy" }; + std::vector stl_strings_argument; + std::string valid_stl_strings[] = { "ken", "brad", "bill", "andy" }; typedef kwsys::CommandLineArguments argT; @@ -122,47 +122,47 @@ int testCommandLineArguments(int argc, char* argv[]) if ( !arg.Parse() ) { - kwsys_ios::cerr << "Problem parsing arguments" << kwsys_ios::endl; + std::cerr << "Problem parsing arguments" << std::endl; 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; - kwsys_ios::cout << "Some double variable was set to: " << some_double_variable << kwsys_ios::endl; + std::cout << "Some int variable was set to: " << some_int_variable << std::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) { - 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; } else { - kwsys_ios::cerr << "Problem setting string variable" << kwsys_ios::endl; + std::cerr << "Problem setting string variable" << std::endl; res = 1; } size_t cc; #define CompareTwoLists(list1, list_valid, lsize) \ if ( list1.size() != lsize ) \ { \ - kwsys_ios::cerr << "Problem setting " #list1 ". Size is: " << list1.size() \ - << " should be: " << lsize << kwsys_ios::endl; \ + std::cerr << "Problem setting " #list1 ". Size is: " << list1.size() \ + << " should be: " << lsize << std::endl; \ res = 1; \ } \ else \ { \ - kwsys_ios::cout << #list1 " argument set:"; \ + std::cout << #list1 " argument set:"; \ for ( cc =0; cc < lsize; ++ cc ) \ { \ - kwsys_ios::cout << " " << list1[cc]; \ + std::cout << " " << list1[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] << "] <> [" \ - << list_valid[cc] << "]" << kwsys_ios::endl; \ + << list_valid[cc] << "]" << std::endl; \ res = 1; \ break; \ } \ } \ - kwsys_ios::cout << kwsys_ios::endl; \ + std::cout << std::endl; \ } CompareTwoLists(numbers_argument, valid_numbers, 10); @@ -171,12 +171,12 @@ int testCommandLineArguments(int argc, char* argv[]) CompareTwoLists(strings_argument, valid_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; - kwsys_ios::cout << "Some bool variable was set to: " << some_bool_variable << kwsys_ios::endl; - kwsys_ios::cout << "Some bool variable was set to: " << some_bool_variable1 << kwsys_ios::endl; - kwsys_ios::cout << "bool_arg1 variable was set to: " << bool_arg1 << kwsys_ios::endl; - kwsys_ios::cout << "bool_arg2 variable was set to: " << bool_arg2 << kwsys_ios::endl; - kwsys_ios::cout << kwsys_ios::endl; + std::cout << "Some STL String variable was set to: " << some_stl_string_variable << std::endl; + std::cout << "Some bool variable was set to: " << some_bool_variable << std::endl; + std::cout << "Some bool variable was set to: " << some_bool_variable1 << std::endl; + std::cout << "bool_arg1 variable was set to: " << bool_arg1 << std::endl; + std::cout << "bool_arg2 variable was set to: " << bool_arg2 << std::endl; + std::cout << std::endl; for ( cc = 0; cc < strings_argument.size(); ++ cc ) { diff --git a/testCommandLineArguments1.cxx b/testCommandLineArguments1.cxx index b65c37f..6eb465d 100644 --- a/testCommandLineArguments1.cxx +++ b/testCommandLineArguments1.cxx @@ -11,16 +11,16 @@ ============================================================================*/ #include "kwsysPrivate.h" #include KWSYS_HEADER(CommandLineArguments.hxx) -#include KWSYS_HEADER(ios/iostream) -#include KWSYS_HEADER(stl/vector) // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. #if 0 # include "CommandLineArguments.hxx.in" -# include "kwsys_ios_iostream.h.in" #endif +#include +#include + #include /* assert */ #include /* strcmp */ @@ -31,7 +31,7 @@ int testCommandLineArguments1(int argc, char* argv[]) int n = 0; char* m = 0; - kwsys_stl::string p; + std::string p; int res = 0; typedef kwsys::CommandLineArguments argT; @@ -43,27 +43,27 @@ int testCommandLineArguments1(int argc, char* argv[]) if ( !arg.Parse() ) { - kwsys_ios::cerr << "Problem parsing arguments" << kwsys_ios::endl; + std::cerr << "Problem parsing arguments" << std::endl; res = 1; } 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; } 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; } 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; } - kwsys_ios::cout << "Value of N: " << n << kwsys_ios::endl; - kwsys_ios::cout << "Value of M: " << m << kwsys_ios::endl; - kwsys_ios::cout << "Value of P: " << p << kwsys_ios::endl; + std::cout << "Value of N: " << n << std::endl; + std::cout << "Value of M: " << m << std::endl; + std::cout << "Value of P: " << p << std::endl; if ( m ) { delete [] m; @@ -79,25 +79,25 @@ int testCommandLineArguments1(int argc, char* argv[]) }; 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; } for ( cc = 0; cc < newArgc; ++ cc ) { assert(newArgv[cc]); /* Quiet Clang scan-build. */ - kwsys_ios::cout << "Unused argument[" << cc << "] = [" << newArgv[cc] << "]" - << kwsys_ios::endl; + std::cout << "Unused argument[" << cc << "] = [" << newArgv[cc] << "]" + << std::endl; 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; } else if ( valid_unused_args[cc] && 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] << "\"" - << kwsys_ios::endl; + << std::endl; res = 1; } } diff --git a/testDynamicLoader.cxx b/testDynamicLoader.cxx index 58adb84..695a134 100644 --- a/testDynamicLoader.cxx +++ b/testDynamicLoader.cxx @@ -12,8 +12,6 @@ #include "kwsysPrivate.h" #include KWSYS_HEADER(DynamicLoader.hxx) -#include KWSYS_HEADER(ios/iostream) -#include KWSYS_HEADER(stl/string) #if defined(__BEOS__) || defined(__HAIKU__) #include /* disable_debugger() API. */ @@ -23,18 +21,19 @@ // duplicate the above list of headers. #if 0 # include "DynamicLoader.hxx.in" -# include "kwsys_ios_iostream.h.in" -# include "kwsys_stl_string.hxx.in" #endif +#include +#include + // Include with <> instead of "" to avoid getting any in-source copy // left on disk. #include -static kwsys_stl::string GetLibName(const char* lname) +static std::string GetLibName(const char* lname) { // Construct proper name of lib - kwsys_stl::string slname; + std::string slname; slname = EXECUTABLE_OUTPUT_PATH; #ifdef CMAKE_INTDIR 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) { - kwsys_ios::cerr << "Testing: " << libname << kwsys_ios::endl; + std::cerr << "Testing: " << libname << std::endl; kwsys::DynamicLoader::LibraryHandle l = kwsys::DynamicLoader::OpenLibrary(libname); // If result is incompatible with expectation just fails (xor): if( (r1 && !l) || (!r1 && l) ) { - kwsys_ios::cerr - << kwsys::DynamicLoader::LastError() << kwsys_ios::endl; + std::cerr + << kwsys::DynamicLoader::LastError() << std::endl; return 1; } kwsys::DynamicLoader::SymbolPointer f = kwsys::DynamicLoader::GetSymbolAddress(l, symbol); if( (r2 && !f) || (!r2 && f) ) { - kwsys_ios::cerr - << kwsys::DynamicLoader::LastError() << kwsys_ios::endl; + std::cerr + << kwsys::DynamicLoader::LastError() << std::endl; return 1; } #ifndef __APPLE__ int s = kwsys::DynamicLoader::CloseLibrary(l); if( (r3 && !s) || (!r3 && s) ) { - kwsys_ios::cerr - << kwsys::DynamicLoader::LastError() << kwsys_ios::endl; + std::cerr + << kwsys::DynamicLoader::LastError() << std::endl; return 1; } #else @@ -118,7 +117,7 @@ int testDynamicLoader(int argc, char *argv[]) res += TestDynamicLoader("libdl.so", "TestDynamicLoader",1,0,1); #endif // 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(), "TestDynamicLoaderSymbolPointer",1,1,1); res += TestDynamicLoader(libname.c_str(), "_TestDynamicLoaderSymbolPointer",1,0,1); diff --git a/testEncoding.cxx b/testEncoding.cxx index 094588c..842b17d 100644 --- a/testEncoding.cxx +++ b/testEncoding.cxx @@ -17,8 +17,8 @@ #include KWSYS_HEADER(Encoding.hxx) #include KWSYS_HEADER(Encoding.h) -#include KWSYS_HEADER(ios/iostream) +#include #include #include #include @@ -28,7 +28,6 @@ #if 0 # include "Encoding.hxx.in" # include "Encoding.h.in" -# include "kwsys_ios_iostream.h.in" #endif //---------------------------------------------------------------------------- diff --git a/testFStream.cxx b/testFStream.cxx index 9abfd4c..ac5220a 100644 --- a/testFStream.cxx +++ b/testFStream.cxx @@ -16,7 +16,6 @@ #endif #include KWSYS_HEADER(FStream.hxx) -#include KWSYS_HEADER(ios/iostream) #include #ifdef __BORLANDC__ # include /* memcmp */ @@ -26,9 +25,9 @@ // duplicate the above list of headers. #if 0 # include "FStream.hxx.in" -# include "kwsys_ios_iostream.h.in" #endif +#include //---------------------------------------------------------------------------- static int testNoFile() @@ -95,20 +94,20 @@ static int testBOM() kwsys::FStream::BOM bom = kwsys::FStream::ReadBOM(in); if(bom != expected_bom[i]) { - kwsys_ios::cout << "Unexpected BOM " << i << std::endl; + std::cout << "Unexpected BOM " << i << std::endl; return 1; } char data[45]; in.read(data, file_data[i][0]); if(!in.good()) { - kwsys_ios::cout << "Unable to read data " << i << std::endl; + std::cout << "Unable to read data " << i << std::endl; return 1; } 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; } @@ -125,20 +124,20 @@ static int testBOM() kwsys::FStream::BOM bom = kwsys::FStream::ReadBOM(in); 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; } char data[45]; in.read(data, file_data[0][0]); 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; } 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; } } @@ -156,20 +155,20 @@ static int testBOM() kwsys::FStream::BOM bom = kwsys::FStream::ReadBOM(in); 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; } char data[45]; in.read(data, file_data[0][0]); 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; } 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; } } diff --git a/testHashSTL.cxx b/testHashSTL.cxx index ac5cf74..ab1f83e 100644 --- a/testHashSTL.cxx +++ b/testHashSTL.cxx @@ -12,7 +12,6 @@ #include "kwsysPrivate.h" #include KWSYS_HEADER(hash_map.hxx) #include KWSYS_HEADER(hash_set.hxx) -#include KWSYS_HEADER(ios/iostream) // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. @@ -20,9 +19,10 @@ # include "hash_map.hxx.in" # include "hash_set.hxx.in" # include "hashtable.hxx.in" -# include "kwsys_ios_iostream.h.in" #endif +#include + #if defined(_MSC_VER) # pragma warning (disable:4786) #endif @@ -44,8 +44,8 @@ static bool test_hash_map() int sum = 0; for(mtype::iterator mi = m.begin(); mi != m.end(); ++mi) { - kwsys_ios::cout << "Found entry [" << mi->first << "," << mi->second << "]" - << kwsys_ios::endl; + std::cout << "Found entry [" << mi->first << "," << mi->second << "]" + << std::endl; sum += mi->second; } return sum == 3; @@ -60,7 +60,7 @@ static bool test_hash_set() int sum = 0; 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; } return sum == 3; diff --git a/testIOS.cxx b/testIOS.cxx index f0c7f1a..396a09d 100644 --- a/testIOS.cxx +++ b/testIOS.cxx @@ -10,158 +10,149 @@ See the License for more information. ============================================================================*/ #include "kwsysPrivate.h" -#include KWSYS_HEADER(stl/vector) -#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 KWSYS_HEADER(Configure.hxx) +#include +#include +#include +#include #include /* strlen */ int testIOS(int, char*[]) { - kwsys_ios::ostringstream ostr; + std::ostringstream ostr; const char hello[] = "hello"; ostr << 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; } const char world[] = "world"; - kwsys_ios::ostringstream ostr2; + std::ostringstream ostr2; ostr2.write( hello, strlen(hello) ); /* I could do sizeof */ ostr2.put( '\0' ); ostr2.write( world, 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; } 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 - kwsys_ios::stringstream strstr; + std::stringstream strstr; strstr.write( (char*)array, narray ); //strstr.seekp( narray / 2 ); // set position of put pointer in mid string 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; } - kwsys_ios::istringstream istr(" 10 20 str "); - kwsys_stl::string s; + std::istringstream istr(" 10 20 str "); + std::string s; int x; if(istr >> x) { if(x != 10) { - kwsys_ios::cerr << "x != 10" << kwsys_ios::endl; + std::cerr << "x != 10" << std::endl; return 1; } } 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; } if(istr >> x) { if(x != 20) { - kwsys_ios::cerr << "x != 20" << kwsys_ios::endl; + std::cerr << "x != 20" << std::endl; return 1; } } 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; } if(istr >> s) { if(s != "str") { - kwsys_ios::cerr << "s != \"str\"" << kwsys_ios::endl; + std::cerr << "s != \"str\"" << std::endl; return 1; } } 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; } 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; } else { // Clear the failure. - istr.clear(istr.rdstate() & ~kwsys_ios::ios::eofbit); - istr.clear(istr.rdstate() & ~kwsys_ios::ios::failbit); + istr.clear(istr.rdstate() & ~std::ios::eofbit); + istr.clear(istr.rdstate() & ~std::ios::failbit); } istr.str("30"); if(istr >> x) { if(x != 30) { - kwsys_ios::cerr << "x != 30" << kwsys_ios::endl; + std::cerr << "x != 30" << std::endl; return 1; } } 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; } - kwsys_ios::stringstream sstr; + std::stringstream sstr; sstr << "40 str2"; if(sstr >> x) { if(x != 40) { - kwsys_ios::cerr << "x != 40" << kwsys_ios::endl; + std::cerr << "x != 40" << std::endl; return 1; } } 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; } if(sstr >> s) { if(s != "str2") { - kwsys_ios::cerr << "s != \"str2\"" << kwsys_ios::endl; + std::cerr << "s != \"str2\"" << std::endl; return 1; } } 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; } // Just try to compile this. if(x == 12345) { - kwsys_ios::ifstream fin("/does_not_exist", - kwsys_ios::ios::in | kwsys_ios_binary); + std::ifstream fin("/does_not_exist", + std::ios::in | std::ios::binary); } - kwsys_ios::cout << "IOS tests passed" << kwsys_ios::endl; + std::cout << "IOS tests passed" << std::endl; return 0; } diff --git a/testSystemInformation.cxx b/testSystemInformation.cxx index fc8ea55..c96751a 100644 --- a/testSystemInformation.cxx +++ b/testSystemInformation.cxx @@ -11,15 +11,15 @@ ============================================================================*/ #include "kwsysPrivate.h" #include KWSYS_HEADER(SystemInformation.hxx) -#include KWSYS_HEADER(ios/iostream) // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. #if 0 # include "SystemInformation.hxx.in" -# include "kwsys_ios_iostream.h.in" #endif +#include + #if defined(KWSYS_USE_LONG_LONG) # if defined(KWSYS_IOS_HAS_OSTREAM_LONG_LONG) # define iostreamLongLong(x) (x) @@ -36,18 +36,18 @@ # error "No Long Long" #endif -#define printMethod(info, m) kwsys_ios::cout << #m << ": " \ +#define printMethod(info, m) std::cout << #m << ": " \ << info.m() << "\n" -#define printMethod2(info, m, unit) kwsys_ios::cout << #m << ": " \ +#define printMethod2(info, m, unit) std::cout << #m << ": " \ << 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" int testSystemInformation(int, char*[]) { - kwsys_ios::cout << "CTEST_FULL_OUTPUT\n"; // avoid truncation + std::cout << "CTEST_FULL_OUTPUT\n"; // avoid truncation kwsys::SystemInformation info; info.RunCPUCheck(); @@ -93,16 +93,16 @@ int testSystemInformation(int, char*[]) { if (info.DoesCPUSupportFeature(static_cast(1) << i)) { - kwsys_ios::cout << "CPU feature " << i << "\n"; + std::cout << "CPU feature " << i << "\n"; } } /* test stack trace */ - kwsys_ios::cout - << "Program Stack:" << kwsys_ios::endl - << kwsys::SystemInformation::GetProgramStack(0,0) << kwsys_ios::endl - << kwsys_ios::endl; + std::cout + << "Program Stack:" << std::endl + << kwsys::SystemInformation::GetProgramStack(0,0) << std::endl + << std::endl; /* test segv handler info.SetStackTraceOnError(1); diff --git a/testSystemTools.cxx b/testSystemTools.cxx index bc9ca5e..e14d2fc 100644 --- a/testSystemTools.cxx +++ b/testSystemTools.cxx @@ -16,19 +16,18 @@ #endif #include KWSYS_HEADER(SystemTools.hxx) -#include KWSYS_HEADER(ios/iostream) // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. #if 0 # include "SystemTools.hxx.in" -# include "kwsys_ios_iostream.h.in" #endif // Include with <> instead of "" to avoid getting any in-source copy // left on disk. #include +#include #include /* strcmp */ #if defined(_WIN32) && !defined(__CYGWIN__) # include /* _umask (MSVC) / umask (Borland) */ @@ -63,17 +62,17 @@ static const char* toUnixPaths[][2] = {0, 0} }; -static bool CheckConvertToUnixSlashes(kwsys_stl::string input, - kwsys_stl::string output) +static bool CheckConvertToUnixSlashes(std::string input, + std::string output) { - kwsys_stl::string result = input; + std::string result = input; kwsys::SystemTools::ConvertToUnixSlashes(result); if ( result != output ) { - kwsys_ios::cerr + std::cerr << "Problem with ConvertToUnixSlashes - input: " << input << " output: " << result << " expected: " << output - << kwsys_ios::endl; + << std::endl; return false; } return true; @@ -87,19 +86,19 @@ static const char* checkEscapeChars[][4] = {0, 0, 0, 0} }; -static bool CheckEscapeChars(kwsys_stl::string input, +static bool CheckEscapeChars(std::string input, const char *chars_to_escape, 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); if (result != output) { - kwsys_ios::cerr + std::cerr << "Problem with CheckEscapeChars - input: " << input << " output: " << result << " expected: " << output - << kwsys_ios::endl; + << std::endl; return false; } return true; @@ -109,75 +108,75 @@ static bool CheckEscapeChars(kwsys_stl::string input, static bool CheckFileOperations() { bool res = true; - const kwsys_stl::string testNonExistingFile(TEST_SYSTEMTOOLS_SOURCE_DIR + const std::string testNonExistingFile(TEST_SYSTEMTOOLS_SOURCE_DIR "/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"); - const kwsys_stl::string testTxtFile(TEST_SYSTEMTOOLS_SOURCE_DIR + const std::string testTxtFile(TEST_SYSTEMTOOLS_SOURCE_DIR "/testSystemTools.cxx"); - const kwsys_stl::string testNewDir(TEST_SYSTEMTOOLS_BINARY_DIR + const std::string testNewDir(TEST_SYSTEMTOOLS_BINARY_DIR "/testSystemToolsNewDir"); - const kwsys_stl::string testNewFile(testNewDir + "/testNewFile.txt"); + const std::string testNewFile(testNewDir + "/testNewFile.txt"); if (kwsys::SystemTools::DetectFileType(testNonExistingFile.c_str()) != kwsys::SystemTools::FileTypeUnknown) { - kwsys_ios::cerr + std::cerr << "Problem with DetectFileType - failed to detect type of: " - << testNonExistingFile << kwsys_ios::endl; + << testNonExistingFile << std::endl; res = false; } if (kwsys::SystemTools::DetectFileType(testDotFile.c_str()) != kwsys::SystemTools::FileTypeUnknown) { - kwsys_ios::cerr + std::cerr << "Problem with DetectFileType - failed to detect type of: " - << testDotFile << kwsys_ios::endl; + << testDotFile << std::endl; res = false; } if (kwsys::SystemTools::DetectFileType(testBinFile.c_str()) != kwsys::SystemTools::FileTypeBinary) { - kwsys_ios::cerr + std::cerr << "Problem with DetectFileType - failed to detect type of: " - << testBinFile << kwsys_ios::endl; + << testBinFile << std::endl; res = false; } if (kwsys::SystemTools::DetectFileType(testTxtFile.c_str()) != kwsys::SystemTools::FileTypeText) { - kwsys_ios::cerr + std::cerr << "Problem with DetectFileType - failed to detect type of: " - << testTxtFile << kwsys_ios::endl; + << testTxtFile << std::endl; res = false; } if (kwsys::SystemTools::FileLength(testBinFile) != 766) { - kwsys_ios::cerr + std::cerr << "Problem with FileLength - incorrect length for: " - << testBinFile << kwsys_ios::endl; + << testBinFile << std::endl; res = false; } if (!kwsys::SystemTools::MakeDirectory(testNewDir)) { - kwsys_ios::cerr + std::cerr << "Problem with MakeDirectory for: " - << testNewDir << kwsys_ios::endl; + << testNewDir << std::endl; res = false; } if (!kwsys::SystemTools::Touch(testNewFile.c_str(), true)) { - kwsys_ios::cerr + std::cerr << "Problem with Touch for: " - << testNewFile << kwsys_ios::endl; + << testNewFile << std::endl; res = false; } @@ -195,34 +194,34 @@ static bool CheckFileOperations() mode_t origPerm, thisPerm; if (!kwsys::SystemTools::GetPermissions(testNewFile, origPerm)) { - kwsys_ios::cerr + std::cerr << "Problem with GetPermissions (1) for: " - << testNewFile << kwsys_ios::endl; + << testNewFile << std::endl; res = false; } if (!kwsys::SystemTools::SetPermissions(testNewFile, 0)) { - kwsys_ios::cerr + std::cerr << "Problem with SetPermissions (1) for: " - << testNewFile << kwsys_ios::endl; + << testNewFile << std::endl; res = false; } if (!kwsys::SystemTools::GetPermissions(testNewFile, thisPerm)) { - kwsys_ios::cerr + std::cerr << "Problem with GetPermissions (2) for: " - << testNewFile << kwsys_ios::endl; + << testNewFile << std::endl; res = false; } if ((thisPerm & fullMask) != 0) { - kwsys_ios::cerr + std::cerr << "SetPermissions failed to set permissions (1) for: " << testNewFile << ": actual = " << thisPerm << "; expected = " - << 0 << kwsys_ios::endl; + << 0 << std::endl; res = false; } @@ -230,70 +229,70 @@ static bool CheckFileOperations() if (kwsys::SystemTools::TestFileAccess(testNewFile, kwsys::TEST_FILE_WRITE)) { - kwsys_ios::cerr + std::cerr << "TestFileAccess incorrectly indicated that this is a writable file:" - << testNewFile << kwsys_ios::endl; + << testNewFile << std::endl; res = false; } if (!kwsys::SystemTools::TestFileAccess(testNewFile, kwsys::TEST_FILE_OK)) { - kwsys_ios::cerr + std::cerr << "TestFileAccess incorrectly indicated that this file does not exist:" - << testNewFile << kwsys_ios::endl; + << testNewFile << std::endl; res = false; } // Test restoring/setting full permissions. if (!kwsys::SystemTools::SetPermissions(testNewFile, fullMask)) { - kwsys_ios::cerr + std::cerr << "Problem with SetPermissions (2) for: " - << testNewFile << kwsys_ios::endl; + << testNewFile << std::endl; res = false; } if (!kwsys::SystemTools::GetPermissions(testNewFile, thisPerm)) { - kwsys_ios::cerr + std::cerr << "Problem with GetPermissions (3) for: " - << testNewFile << kwsys_ios::endl; + << testNewFile << std::endl; res = false; } if ((thisPerm & fullMask) != fullMask) { - kwsys_ios::cerr + std::cerr << "SetPermissions failed to set permissions (2) for: " << testNewFile << ": actual = " << thisPerm << "; expected = " - << fullMask << kwsys_ios::endl; + << fullMask << std::endl; res = false; } // Test setting file permissions while honoring umask if (!kwsys::SystemTools::SetPermissions(testNewFile, fullMask, true)) { - kwsys_ios::cerr + std::cerr << "Problem with SetPermissions (3) for: " - << testNewFile << kwsys_ios::endl; + << testNewFile << std::endl; res = false; } if (!kwsys::SystemTools::GetPermissions(testNewFile, thisPerm)) { - kwsys_ios::cerr + std::cerr << "Problem with GetPermissions (4) for: " - << testNewFile << kwsys_ios::endl; + << testNewFile << std::endl; res = false; } if ((thisPerm & fullMask) != 0) { - kwsys_ios::cerr + std::cerr << "SetPermissions failed to honor umask for: " << testNewFile << ": actual = " << thisPerm << "; expected = " - << 0 << kwsys_ios::endl; + << 0 << std::endl; res = false; } @@ -303,35 +302,35 @@ static bool CheckFileOperations() // Restore file permissions if (!kwsys::SystemTools::SetPermissions(testNewFile, origPerm)) { - kwsys_ios::cerr + std::cerr << "Problem with SetPermissions (4) for: " - << testNewFile << kwsys_ios::endl; + << testNewFile << std::endl; res = false; } // Remove the test file if (!kwsys::SystemTools::RemoveFile(testNewFile)) { - kwsys_ios::cerr + std::cerr << "Problem with RemoveFile: " - << testNewFile << kwsys_ios::endl; + << testNewFile << std::endl; res = false; } - kwsys_stl::string const testFileMissing(testNewDir + "/testMissingFile.txt"); + std::string const testFileMissing(testNewDir + "/testMissingFile.txt"); if (!kwsys::SystemTools::RemoveFile(testFileMissing)) { std::string const& msg = kwsys::SystemTools::GetLastSystemError(); - kwsys_ios::cerr << + std::cerr << "RemoveFile(\"" << testFileMissing << "\") failed: " << msg << "\n"; res = false; } - kwsys_stl::string const testFileMissingDir(testNewDir + "/missing/file.txt"); + std::string const testFileMissingDir(testNewDir + "/missing/file.txt"); if (!kwsys::SystemTools::RemoveFile(testFileMissingDir)) { std::string const& msg = kwsys::SystemTools::GetLastSystemError(); - kwsys_ios::cerr << + std::cerr << "RemoveFile(\"" << testFileMissingDir << "\") failed: " << msg << "\n"; res = false; } @@ -339,9 +338,9 @@ static bool CheckFileOperations() kwsys::SystemTools::Touch(testNewFile.c_str(), true); if (!kwsys::SystemTools::RemoveADirectory(testNewDir)) { - kwsys_ios::cerr + std::cerr << "Problem with RemoveADirectory for: " - << testNewDir << kwsys_ios::endl; + << testNewDir << std::endl; res = false; } @@ -349,14 +348,14 @@ static bool CheckFileOperations() // Perform the same file and directory creation and deletion tests but // with paths > 256 characters in length. - const kwsys_stl::string testNewLongDir( + const std::string testNewLongDir( TEST_SYSTEMTOOLS_BINARY_DIR "/" "012345678901234567890123456789012345678901234567890123456789" "012345678901234567890123456789012345678901234567890123456789" "012345678901234567890123456789012345678901234567890123456789" "012345678901234567890123456789012345678901234567890123456789" "01234567890123"); - const kwsys_stl::string testNewLongFile(testNewLongDir + "/" + const std::string testNewLongFile(testNewLongDir + "/" "012345678901234567890123456789012345678901234567890123456789" "012345678901234567890123456789012345678901234567890123456789" "012345678901234567890123456789012345678901234567890123456789" @@ -365,34 +364,34 @@ static bool CheckFileOperations() if (!kwsys::SystemTools::MakeDirectory(testNewLongDir)) { - kwsys_ios::cerr + std::cerr << "Problem with MakeDirectory for: " - << testNewLongDir << kwsys_ios::endl; + << testNewLongDir << std::endl; res = false; } if (!kwsys::SystemTools::Touch(testNewLongFile.c_str(), true)) { - kwsys_ios::cerr + std::cerr << "Problem with Touch for: " - << testNewLongFile << kwsys_ios::endl; + << testNewLongFile << std::endl; res = false; } if (!kwsys::SystemTools::RemoveFile(testNewLongFile)) { - kwsys_ios::cerr + std::cerr << "Problem with RemoveFile: " - << testNewLongFile << kwsys_ios::endl; + << testNewLongFile << std::endl; res = false; } kwsys::SystemTools::Touch(testNewLongFile.c_str(), true); if (!kwsys::SystemTools::RemoveADirectory(testNewLongDir)) { - kwsys_ios::cerr + std::cerr << "Problem with RemoveADirectory for: " - << testNewLongDir << kwsys_ios::endl; + << testNewLongDir << std::endl; res = false; } #endif @@ -405,12 +404,12 @@ static bool CheckStringOperations() { 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.") { - kwsys_ios::cerr + std::cerr << "Problem with CapitalizedWords " - << '"' << test << '"' << kwsys_ios::endl; + << '"' << test << '"' << std::endl; res = false; } @@ -418,9 +417,9 @@ static bool CheckStringOperations() if (kwsys::SystemTools::UnCapitalizedWords(test) != "mary had a little lamb.") { - kwsys_ios::cerr + std::cerr << "Problem with UnCapitalizedWords " - << '"' << test << '"' << kwsys_ios::endl; + << '"' << test << '"' << std::endl; res = false; } @@ -428,9 +427,9 @@ static bool CheckStringOperations() if (kwsys::SystemTools::AddSpaceBetweenCapitalizedWords(test) != "Mary Had The Little Lamb.") { - kwsys_ios::cerr + std::cerr << "Problem with AddSpaceBetweenCapitalizedWords " - << '"' << test << '"' << kwsys_ios::endl; + << '"' << test << '"' << std::endl; res = false; } @@ -438,9 +437,9 @@ static bool CheckStringOperations() kwsys::SystemTools::AppendStrings("Mary Had A"," Little Lamb."); if (strcmp(cres,"Mary Had A Little Lamb.")) { - kwsys_ios::cerr + std::cerr << "Problem with AppendStrings " - << "\"Mary Had A\" \" Little Lamb.\"" << kwsys_ios::endl; + << "\"Mary Had A\" \" Little Lamb.\"" << std::endl; res = false; } delete [] cres; @@ -449,18 +448,18 @@ static bool CheckStringOperations() kwsys::SystemTools::AppendStrings("Mary Had"," A ","Little Lamb."); if (strcmp(cres,"Mary Had A Little Lamb.")) { - kwsys_ios::cerr + std::cerr << "Problem with AppendStrings " - << "\"Mary Had\" \" A \" \"Little Lamb.\"" << kwsys_ios::endl; + << "\"Mary Had\" \" A \" \"Little Lamb.\"" << std::endl; res = false; } delete [] cres; if (kwsys::SystemTools::CountChar("Mary Had A Little Lamb.",'a') != 3) { - kwsys_ios::cerr + std::cerr << "Problem with CountChar " - << "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl; + << "\"Mary Had A Little Lamb.\"" << std::endl; res = false; } @@ -468,9 +467,9 @@ static bool CheckStringOperations() kwsys::SystemTools::RemoveChars("Mary Had A Little Lamb.","aeiou"); if (strcmp(cres,"Mry Hd A Lttl Lmb.")) { - kwsys_ios::cerr + std::cerr << "Problem with RemoveChars " - << "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl; + << "\"Mary Had A Little Lamb.\"" << std::endl; res = false; } delete [] cres; @@ -479,9 +478,9 @@ static bool CheckStringOperations() kwsys::SystemTools::RemoveCharsButUpperHex("Mary Had A Little Lamb."); if (strcmp(cres,"A")) { - kwsys_ios::cerr + std::cerr << "Problem with RemoveCharsButUpperHex " - << "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl; + << "\"Mary Had A Little Lamb.\"" << std::endl; res = false; } delete [] cres; @@ -491,9 +490,9 @@ static bool CheckStringOperations() kwsys::SystemTools::ReplaceChars(cres2,"aeiou",'X'); if (strcmp(cres2,"MXry HXd A LXttlX LXmb.")) { - kwsys_ios::cerr + std::cerr << "Problem with ReplaceChars " - << "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl; + << "\"Mary Had A Little Lamb.\"" << std::endl; res = false; } delete [] cres2; @@ -501,27 +500,27 @@ static bool CheckStringOperations() if (!kwsys::SystemTools::StringStartsWith("Mary Had A Little Lamb.", "Mary ")) { - kwsys_ios::cerr + std::cerr << "Problem with StringStartsWith " - << "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl; + << "\"Mary Had A Little Lamb.\"" << std::endl; res = false; } if (!kwsys::SystemTools::StringEndsWith("Mary Had A Little Lamb.", " Lamb.")) { - kwsys_ios::cerr + std::cerr << "Problem with StringEndsWith " - << "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl; + << "\"Mary Had A Little Lamb.\"" << std::endl; res = false; } cres = kwsys::SystemTools::DuplicateString("Mary Had A Little Lamb."); if (strcmp(cres,"Mary Had A Little Lamb.")) { - kwsys_ios::cerr + std::cerr << "Problem with DuplicateString " - << "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl; + << "\"Mary Had A Little Lamb.\"" << std::endl; res = false; } delete [] cres; @@ -530,20 +529,20 @@ static bool CheckStringOperations() if (kwsys::SystemTools::CropString(test,13) != "Mary ...Lamb.") { - kwsys_ios::cerr + std::cerr << "Problem with CropString " - << "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl; + << "\"Mary Had A Little Lamb.\"" << std::endl; res = false; } - kwsys_stl::vector lines; + std::vector lines; kwsys::SystemTools::Split("Mary Had A Little Lamb.",lines,' '); if (lines[0] != "Mary" || lines[1] != "Had" || lines[2] != "A" || lines[3] != "Little" || lines[4] != "Lamb.") { - kwsys_ios::cerr + std::cerr << "Problem with Split " - << "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl; + << "\"Mary Had A Little Lamb.\"" << std::endl; res = false; } @@ -552,10 +551,10 @@ static bool CheckStringOperations() ("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 " << "\"L:\\Local Mojo\\Hex Power Pack\\Iffy Voodoo\"" - << kwsys_ios::endl; + << std::endl; res = false; } @@ -563,10 +562,10 @@ static bool CheckStringOperations() ("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 " << "\"L:/Local Mojo/Hex Power Pack/Iffy Voodoo\"" - << kwsys_ios::endl; + << std::endl; res = false; } @@ -574,10 +573,10 @@ static bool CheckStringOperations() ("\\\\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 " << "\"\\\\Foo\\Local Mojo\\Hex Power Pack\\Iffy Voodoo\"" - << kwsys_ios::endl; + << std::endl; res = false; } @@ -585,70 +584,70 @@ static bool CheckStringOperations() ("//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 " << "\"//Foo/Local Mojo/Hex Power Pack/Iffy Voodoo\"" - << kwsys_ios::endl; + << std::endl; res = false; } if (kwsys::SystemTools::ConvertToWindowsExtendedPath("//") != L"//") { - kwsys_ios::cerr + std::cerr << "Problem with ConvertToWindowsExtendedPath " << "\"//\"" - << kwsys_ios::endl; + << std::endl; res = false; } if (kwsys::SystemTools::ConvertToWindowsExtendedPath("\\\\.\\") != L"\\\\.\\") { - kwsys_ios::cerr + std::cerr << "Problem with ConvertToWindowsExtendedPath " << "\"\\\\.\\\"" - << kwsys_ios::endl; + << std::endl; res = false; } if (kwsys::SystemTools::ConvertToWindowsExtendedPath("\\\\.\\X") != L"\\\\.\\X") { - kwsys_ios::cerr + std::cerr << "Problem with ConvertToWindowsExtendedPath " << "\"\\\\.\\X\"" - << kwsys_ios::endl; + << std::endl; res = false; } if (kwsys::SystemTools::ConvertToWindowsExtendedPath("\\\\.\\X:") != L"\\\\?\\X:") { - kwsys_ios::cerr + std::cerr << "Problem with ConvertToWindowsExtendedPath " << "\"\\\\.\\X:\"" - << kwsys_ios::endl; + << std::endl; res = false; } if (kwsys::SystemTools::ConvertToWindowsExtendedPath("\\\\.\\X:\\") != L"\\\\?\\X:\\") { - kwsys_ios::cerr + std::cerr << "Problem with ConvertToWindowsExtendedPath " << "\"\\\\.\\X:\\\"" - << kwsys_ios::endl; + << std::endl; res = false; } if (kwsys::SystemTools::ConvertToWindowsExtendedPath("NUL") != L"\\\\.\\NUL") { - kwsys_ios::cerr + std::cerr << "Problem with ConvertToWindowsExtendedPath " << "\"NUL\"" - << kwsys_ios::endl; + << std::endl; 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\"") { - kwsys_ios::cerr + std::cerr << "Problem with ConvertToWindowsOutputPath " << "\"L://Local Mojo/Hex Power Pack/Iffy Voodoo\"" - << kwsys_ios::endl; + << std::endl; 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\"") { - kwsys_ios::cerr + std::cerr << "Problem with ConvertToWindowsOutputPath " << "\"//grayson/Local Mojo/Hex Power Pack/Iffy Voodoo\"" - << kwsys_ios::endl; + << std::endl; res = false; } @@ -680,10 +679,10 @@ static bool CheckStringOperations() ("//Local Mojo/Hex Power Pack/Iffy Voodoo") != "//Local\\ Mojo/Hex\\ Power\\ Pack/Iffy\\ Voodoo") { - kwsys_ios::cerr + std::cerr << "Problem with ConvertToUnixOutputPath " << "\"//Local Mojo/Hex Power Pack/Iffy Voodoo\"" - << kwsys_ios::endl; + << std::endl; 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)) { - kwsys_ios::cerr << "PutEnv(\"" << env - << "\") failed!" << kwsys_ios::endl; + std::cerr << "PutEnv(\"" << env + << "\") failed!" << std::endl; return false; } const char* v = kwsys::SystemTools::GetEnv(name); v = v? v : "(null)"; if(strcmp(v, value) != 0) { - kwsys_ios::cerr << "GetEnv(\"" << name << "\") returned \"" - << v << "\", not \"" << value << "\"!" << kwsys_ios::endl; + std::cerr << "GetEnv(\"" << name << "\") returned \"" + << v << "\", not \"" << value << "\"!" << std::endl; return false; } return true; @@ -715,14 +714,14 @@ static bool CheckUnPutEnv(const char* env, const char* name) { if(!kwsys::SystemTools::UnPutEnv(env)) { - kwsys_ios::cerr << "UnPutEnv(\"" << env << "\") failed!" - << kwsys_ios::endl; + std::cerr << "UnPutEnv(\"" << env << "\") failed!" + << std::endl; return false; } if(const char* v = kwsys::SystemTools::GetEnv(name)) { - kwsys_ios::cerr << "GetEnv(\"" << name << "\") returned \"" - << v << "\", not (null)!" << kwsys_ios::endl; + std::cerr << "GetEnv(\"" << name << "\") returned \"" + << v << "\", not (null)!" << std::endl; return false; } return true; @@ -744,15 +743,15 @@ static bool CheckEnvironmentOperations() static bool CheckRelativePath( - const kwsys_stl::string& local, - const kwsys_stl::string& remote, - const kwsys_stl::string& expected) + const std::string& local, + const std::string& remote, + const std::string& expected) { - kwsys_stl::string result = kwsys::SystemTools::RelativePath(local, remote); + std::string result = kwsys::SystemTools::RelativePath(local, remote); if(expected != result) { - kwsys_ios::cerr << "RelativePath(" << local << ", " << remote - << ") yielded " << result << " instead of " << expected << kwsys_ios::endl; + std::cerr << "RelativePath(" << local << ", " << remote + << ") yielded " << result << " instead of " << expected << std::endl; return false; } return true; @@ -770,14 +769,14 @@ static bool CheckRelativePaths() } static bool CheckCollapsePath( - const kwsys_stl::string& path, - const kwsys_stl::string& expected) + const std::string& path, + const std::string& expected) { - kwsys_stl::string result = kwsys::SystemTools::CollapseFullPath(path); + std::string result = kwsys::SystemTools::CollapseFullPath(path); if(expected != result) { - kwsys_ios::cerr << "CollapseFullPath(" << path - << ") yielded " << result << " instead of " << expected << kwsys_ios::endl; + std::cerr << "CollapseFullPath(" << path + << ") yielded " << result << " instead of " << expected << std::endl; return false; } return true; @@ -803,7 +802,7 @@ int testSystemTools(int, char*[]) } // Special check for ~ - kwsys_stl::string output; + std::string output; if(kwsys::SystemTools::GetEnv("HOME", output)) { output += "/foo bar/lala"; -- cgit v0.12