diff --git a/CMakeLists.txt b/CMakeLists.txt index fb5e36bfacb9a67dfec4c781a0b51b188f4c39df..aadb02672d7cb1c148b84e28a564e540633df1a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -342,14 +342,9 @@ 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) - 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_HAS_ITERATOR_TRAITS "Checking whether stl has iterator_traits" DIRECT) IF(KWSYS_STL_HAS_ITERATOR_TRAITS) @@ -769,41 +764,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. -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}") - 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 diff --git a/CommandLineArguments.cxx b/CommandLineArguments.cxx index d7494e526a365c09da7694feed6880780b14f05c..36368368bf58433dd5538cedc5e4d51aa56d4154 100644 --- a/CommandLineArguments.cxx +++ b/CommandLineArguments.cxx @@ -15,18 +15,16 @@ #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) - // 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" #endif +#include <vector> +#include <map> +#include <set> #include <sstream> #include <iostream> @@ -66,11 +64,11 @@ struct CommandLineArgumentsCallbackStructure }; class CommandLineArgumentsVectorOfStrings : - public kwsys_stl::vector<kwsys::String> {}; + public std::vector<kwsys::String> {}; class CommandLineArgumentsSetOfStrings : - public kwsys_stl::set<kwsys::String> {}; + public std::set<kwsys::String> {}; class CommandLineArgumentsMapOfStrucs : - public kwsys_stl::map<kwsys::String, + public std::map<kwsys::String, CommandLineArgumentsCallbackStructure> {}; class CommandLineArgumentsInternal @@ -151,8 +149,8 @@ void CommandLineArguments::ProcessArgument(const char* arg) //---------------------------------------------------------------------------- bool CommandLineArguments::GetMatchedArguments( - kwsys_stl::vector<kwsys_stl::string>* matches, - const kwsys_stl::string& arg) + std::vector<std::string>* matches, + const std::string& arg) { matches->clear(); CommandLineArguments::Internal::CallbacksMap::iterator it; @@ -183,15 +181,15 @@ bool CommandLineArguments::GetMatchedArguments( //---------------------------------------------------------------------------- int CommandLineArguments::Parse() { - kwsys_stl::vector<kwsys_stl::string>::size_type cc; - kwsys_stl::vector<kwsys_stl::string> matches; + std::vector<std::string>::size_type cc; + std::vector<std::string> 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) ) @@ -213,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(); @@ -266,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) ) { @@ -429,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<bool>) -CommandLineArgumentsAddArgumentMacro(VECTOR_INT, kwsys_stl::vector<int>) -CommandLineArgumentsAddArgumentMacro(VECTOR_DOUBLE, kwsys_stl::vector<double>) -CommandLineArgumentsAddArgumentMacro(VECTOR_STRING, kwsys_stl::vector<char*>) -CommandLineArgumentsAddArgumentMacro(VECTOR_STL_STRING, kwsys_stl::vector<kwsys_stl::string>) +CommandLineArgumentsAddArgumentMacro(VECTOR_BOOL, std::vector<bool>) +CommandLineArgumentsAddArgumentMacro(VECTOR_INT, std::vector<int>) +CommandLineArgumentsAddArgumentMacro(VECTOR_DOUBLE, std::vector<double>) +CommandLineArgumentsAddArgumentMacro(VECTOR_STRING, std::vector<char*>) +CommandLineArgumentsAddArgumentMacro(VECTOR_STL_STRING, std::vector<std::string>) //---------------------------------------------------------------------------- #define CommandLineArgumentsAddBooleanArgumentMacro(type, ctype) \ @@ -450,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) @@ -522,7 +520,7 @@ void CommandLineArguments::GenerateHelp() // 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<CommandLineArguments::Internal::String, + typedef std::map<CommandLineArguments::Internal::String, CommandLineArguments::Internal::SetOfStrings > MapArgs; MapArgs mp; MapArgs::iterator mpit, smpit; @@ -679,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" || @@ -695,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<int>(strtol(value.c_str(), &res, 10)); @@ -707,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); @@ -719,7 +717,7 @@ void CommandLineArguments::PopulateVariable( //---------------------------------------------------------------------------- void CommandLineArguments::PopulateVariable( - char** variable, const kwsys_stl::string& value) + char** variable, const std::string& value) { if ( *variable ) { @@ -732,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<bool>* variable, const kwsys_stl::string& value) + std::vector<bool>* variable, const std::string& value) { bool val = false; if ( value == "1" || value == "ON" || value == "on" || value == "On" || @@ -753,7 +751,7 @@ void CommandLineArguments::PopulateVariable( //---------------------------------------------------------------------------- void CommandLineArguments::PopulateVariable( - kwsys_stl::vector<int>* variable, const kwsys_stl::string& value) + std::vector<int>* variable, const std::string& value) { char* res = 0; variable->push_back(static_cast<int>(strtol(value.c_str(), &res, 10))); @@ -765,7 +763,7 @@ void CommandLineArguments::PopulateVariable( //---------------------------------------------------------------------------- void CommandLineArguments::PopulateVariable( - kwsys_stl::vector<double>* variable, const kwsys_stl::string& value) + std::vector<double>* variable, const std::string& value) { char* res = 0; variable->push_back(strtod(value.c_str(), &res)); @@ -777,7 +775,7 @@ void CommandLineArguments::PopulateVariable( //---------------------------------------------------------------------------- void CommandLineArguments::PopulateVariable( - kwsys_stl::vector<char*>* variable, const kwsys_stl::string& value) + std::vector<char*>* variable, const std::string& value) { char* var = new char[ value.size() + 1 ]; strcpy(var, value.c_str()); @@ -786,8 +784,8 @@ void CommandLineArguments::PopulateVariable( //---------------------------------------------------------------------------- void CommandLineArguments::PopulateVariable( - kwsys_stl::vector<kwsys_stl::string>* variable, - const kwsys_stl::string& value) + std::vector<std::string>* variable, + const std::string& value) { variable->push_back(value); } @@ -808,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; @@ -825,25 +823,25 @@ bool CommandLineArguments::PopulateVariable(CommandLineArgumentsCallbackStructur this->PopulateVariable(static_cast<char**>(cs->Variable), var); break; case CommandLineArguments::STL_STRING_TYPE: - this->PopulateVariable(static_cast<kwsys_stl::string*>(cs->Variable), var); + this->PopulateVariable(static_cast<std::string*>(cs->Variable), var); break; case CommandLineArguments::BOOL_TYPE: this->PopulateVariable(static_cast<bool*>(cs->Variable), var); break; case CommandLineArguments::VECTOR_BOOL_TYPE: - this->PopulateVariable(static_cast<kwsys_stl::vector<bool>*>(cs->Variable), var); + this->PopulateVariable(static_cast<std::vector<bool>*>(cs->Variable), var); break; case CommandLineArguments::VECTOR_INT_TYPE: - this->PopulateVariable(static_cast<kwsys_stl::vector<int>*>(cs->Variable), var); + this->PopulateVariable(static_cast<std::vector<int>*>(cs->Variable), var); break; case CommandLineArguments::VECTOR_DOUBLE_TYPE: - this->PopulateVariable(static_cast<kwsys_stl::vector<double>*>(cs->Variable), var); + this->PopulateVariable(static_cast<std::vector<double>*>(cs->Variable), var); break; case CommandLineArguments::VECTOR_STRING_TYPE: - this->PopulateVariable(static_cast<kwsys_stl::vector<char*>*>(cs->Variable), var); + this->PopulateVariable(static_cast<std::vector<char*>*>(cs->Variable), var); break; case CommandLineArguments::VECTOR_STL_STRING_TYPE: - this->PopulateVariable(static_cast<kwsys_stl::vector<kwsys_stl::string>*>(cs->Variable), var); + this->PopulateVariable(static_cast<std::vector<std::string>*>(cs->Variable), var); break; default: std::cerr << "Got unknown variable type: \"" << cs->VariableType << "\"" << std::endl; diff --git a/CommandLineArguments.hxx.in b/CommandLineArguments.hxx.in index 6257870a509a410c29d965f18c2ec562c33a75fd..e4f6d0265522a812eaee40b6a222772fe8a5f8c9 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 <string> +#include <vector> namespace @KWSYS_NAMESPACE@ { @@ -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<bool>* variable, const char* help); + std::vector<bool>* variable, const char* help); void AddArgument(const char* argument, ArgumentTypeEnum type, - kwsys_stl::vector<int>* variable, const char* help); + std::vector<int>* variable, const char* help); void AddArgument(const char* argument, ArgumentTypeEnum type, - kwsys_stl::vector<double>* variable, const char* help); + std::vector<double>* variable, const char* help); void AddArgument(const char* argument, ArgumentTypeEnum type, - kwsys_stl::vector<char*>* variable, const char* help); + std::vector<char*>* variable, const char* help); void AddArgument(const char* argument, ArgumentTypeEnum type, - kwsys_stl::vector<kwsys_stl::string>* variable, const char* help); + std::vector<std::string>* variable, const char* help); /** * Add handler for boolean argument. The argument does not take any option @@ -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<kwsys_stl::string>* matches, - const kwsys_stl::string& arg); + bool GetMatchedArguments(std::vector<std::string>* 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<bool>* variable, const kwsys_stl::string& value); - void PopulateVariable(kwsys_stl::vector<int>* variable, const kwsys_stl::string& value); - void PopulateVariable(kwsys_stl::vector<double>* variable, const kwsys_stl::string& value); - void PopulateVariable(kwsys_stl::vector<char*>* variable, const kwsys_stl::string& value); - void PopulateVariable(kwsys_stl::vector<kwsys_stl::string>* 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<bool>* variable, const std::string& value); + void PopulateVariable(std::vector<int>* variable, const std::string& value); + void PopulateVariable(std::vector<double>* variable, const std::string& value); + void PopulateVariable(std::vector<char*>* variable, const std::string& value); + void PopulateVariable(std::vector<std::string>* 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 228a35db8e9121214061ede6814513975436dace..38d00cf5ce4f2ae81b5b3f4ad45be4a5964a1cee 100644 --- a/Configure.hxx.in +++ b/Configure.hxx.in @@ -15,19 +15,9 @@ /* Include C configuration. */ #include <@KWSYS_NAMESPACE@/Configure.h> -/* 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@ -/* Define the stl namespace macro. */ -#if @KWSYS_NAMESPACE@_STL_HAVE_STD -# define @KWSYS_NAMESPACE@_stl std -#else -# define @KWSYS_NAMESPACE@_stl -#endif - /* Whether the cstddef header is available. */ #define @KWSYS_NAMESPACE@_CXX_HAS_CSTDDEF @KWSYS_CXX_HAS_CSTDDEF@ @@ -95,11 +85,9 @@ 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 @KWSYS_NAMESPACE@ # endif # define KWSYS_NAME_IS_KWSYS @KWSYS_NAMESPACE@_NAME_IS_KWSYS -# define KWSYS_STL_HAVE_STD @KWSYS_NAMESPACE@_STL_HAVE_STD # define KWSYS_STAT_HAS_ST_MTIM @KWSYS_NAMESPACE@_STAT_HAS_ST_MTIM # define KWSYS_CXX_HAS_CSTDDEF @KWSYS_NAMESPACE@_CXX_HAS_CSTDDEF # define KWSYS_CXX_NULL_TEMPLATE_ARGS @KWSYS_NAMESPACE@_CXX_NULL_TEMPLATE_ARGS diff --git a/Directory.cxx b/Directory.cxx index 41e170eb235ab19ca841cb7d06f44d4b41f20910..c549792d2b3095f44be35db55af8afc002b479d8 100644 --- a/Directory.cxx +++ b/Directory.cxx @@ -16,19 +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_vector.hxx.in" #endif +#include <string> +#include <vector> + namespace KWSYS_NAMESPACE { @@ -37,10 +35,10 @@ class DirectoryInternals { public: // Array of Files - kwsys_stl::vector<kwsys_stl::string> Files; + std::vector<std::string> Files; // Path to Open'ed directory - kwsys_stl::string Path; + std::string Path; }; //---------------------------------------------------------------------------- @@ -102,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 @@ -152,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; @@ -219,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(); @@ -239,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 1bcf90e18c3fb26a01a46cb7b434cc58539068a7..e68f337739079cb93adfe1217c591ac686dd0e5f 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 <string> 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 a776f97b0072ff39df98debf820f01bce1046cf2..1941d965acc20111eba72a4790929945f9545fba 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 75811ab8589f04d31984f2cd36304990c1ca4a7f..1e4a91265a07b12b9ba6b5595a0ad524fe812ee0 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 <string> #if defined(__hpux) #include <dl.h> @@ -28,11 +28,6 @@ #include <be/kernel/image.h> #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 aba4175545f68982095b6bc2d3d3ba965f1fc92b..87b1c215042409df310abce8d176b012ee38a3ce 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 <string> +#include <vector> 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 251a56ddc94cf77fbc255e90102aaca0bc58b041..7d9b3e4d83cd5e14032ea5c1960b5abac6b0ab95 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 <vector> #include <stdlib.h> #include <string.h> @@ -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<wchar_t> wchars(length); + std::vector<wchar_t> 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/Glob.cxx b/Glob.cxx index 9d25e2884e56b7ab9ca6e1c08c75b65f093bfb4f..9d634595123d18a991f6789322852e47baf36993 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,11 +26,12 @@ # include "Configure.hxx.in" # include "RegularExpression.hxx.in" # include "SystemTools.hxx.in" -# include "kwsys_stl.hxx.in" -# include "kwsys_stl_vector.hxx.in" -# include "kwsys_stl_algorithm.hxx.in" #endif +#include <string> +#include <vector> +#include <algorithm> + #include <ctype.h> #include <stdio.h> #include <string.h> @@ -53,8 +51,8 @@ namespace KWSYS_NAMESPACE class GlobInternals { public: - kwsys_stl::vector<kwsys_stl::string> Files; - kwsys_stl::vector<kwsys::RegularExpression> Expressions; + std::vector<std::string> Files; + std::vector<kwsys::RegularExpression> Expressions; }; //---------------------------------------------------------------------------- @@ -81,21 +79,21 @@ Glob::~Glob() } //---------------------------------------------------------------------------- -kwsys_stl::vector<kwsys_stl::string>& Glob::GetFiles() +std::vector<std::string>& 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; @@ -119,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 && @@ -152,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 += "["; @@ -220,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) ) @@ -229,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); @@ -261,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()) @@ -276,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()) { @@ -298,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<kwsys_stl::string>::const_iterator - pathIt = kwsys_stl::find(this->VisitedSymlinks.begin(), + std::string message; + for(std::vector<std::string>::const_iterator + pathIt = std::find(this->VisitedSymlinks.begin(), this->VisitedSymlinks.end(), canonicalPath); pathIt != this->VisitedSymlinks.end(); ++pathIt) @@ -337,8 +335,8 @@ 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) { //std::cout << "ProcessDirectory: " << dir << std::endl; bool last = ( start == this->Internals->Expressions.size()-1 ); @@ -359,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); @@ -410,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(); @@ -424,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] != '\\' ) @@ -516,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( @@ -545,7 +543,7 @@ const char* Glob::GetRelative() } //---------------------------------------------------------------------------- -void Glob::AddFile(kwsys_stl::vector<kwsys_stl::string>& files, const kwsys_stl::string& file) +void Glob::AddFile(std::vector<std::string>& files, const std::string& file) { if ( !this->Relative.empty() ) { diff --git a/Glob.hxx.in b/Glob.hxx.in index 5239ccd22729e9b3f71ba760468d3b1ee8393536..ffee9ca80af41f7fca87e552c271a812c11e8045 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 <string> +#include <vector> 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<Message> GlobMessages; - typedef kwsys_stl::vector<Message>::iterator GlobMessagesIterator; + typedef std::vector<Message> GlobMessages; + typedef std::vector<Message>::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<kwsys_stl::string>& GetFiles(); + std::vector<std::string>& 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<kwsys_stl::string>& files, const kwsys_stl::string& file); + void AddFile(std::vector<std::string>& files, const std::string& file); GlobInternals* Internals; bool Recurse; - kwsys_stl::string Relative; + std::string Relative; bool RecurseThroughSymlinks; unsigned int FollowedSymlinkCount; - kwsys_stl::vector<kwsys_stl::string> VisitedSymlinks; + std::vector<std::string> 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/RegularExpression.hxx.in b/RegularExpression.hxx.in index 502fbe2708672db1f1bd561179da0c40f55647bf..d0235d8f6416a3906155b3b0e619f9f14c2c961c 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 <string> /* 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<kwsys_stl::string::size_type>( + return static_cast<std::string::size_type>( 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<kwsys_stl::string::size_type>( + return static_cast<std::string::size_type>( 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<kwsys_stl::string::size_type>( + return static_cast<std::string::size_type>( 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<kwsys_stl::string::size_type>( + return static_cast<std::string::size_type>( 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<kwsys_stl::string::size_type>( + return std::string(this->startp[n], + static_cast<std::string::size_type>( 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 4386c9eb72893fc67122fb998eedd62ba3d30a4e..2e9aedb86a32f1ee211f886c51765733286b5522 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 <string> 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<std::string const&>(l) < + static_cast<std::string const&>(r)); } #endif diff --git a/SystemInformation.cxx b/SystemInformation.cxx index 55080d3304044d756333bc27d1fee23b11bffe91..cddcc8dcb6e3a90bf03b6786d4dae0b86ad4a875 100644 --- a/SystemInformation.cxx +++ b/SystemInformation.cxx @@ -35,8 +35,6 @@ // 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(SystemInformation.hxx) #include KWSYS_HEADER(Process.h) @@ -46,13 +44,13 @@ # include "SystemInformation.hxx.in" # include "Process.h.in" # include "Configure.hxx.in" -# include "kwsys_stl.hxx.in" -# include "kwsys_stl_vector.in" #endif #include <iostream> #include <sstream> #include <fstream> +#include <string> +#include <vector> #if defined(_WIN32) # include <windows.h> @@ -321,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(); @@ -337,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(); @@ -375,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(); @@ -391,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 @@ -476,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(); @@ -485,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<const char*> args); + std::string ParseValueFromKStat(const char* arguments); + std::string RunProcess(std::vector<const char*> args); //For Haiku OS bool QueryHaikuInfo(); @@ -536,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; }; @@ -564,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(); } @@ -629,7 +627,7 @@ bool SystemInformation::DoesCPUSupportFeature(long int i) return this->Implementation->DoesCPUSupportFeature(i); } -kwsys_stl::string SystemInformation::GetCPUDescription() +std::string SystemInformation::GetCPUDescription() { std::ostringstream oss; oss @@ -650,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," "); } @@ -670,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; } @@ -719,7 +717,7 @@ int SystemInformation::GetOSIsApple() #endif } -kwsys_stl::string SystemInformation::GetOSDescription() +std::string SystemInformation::GetOSDescription() { std::ostringstream oss; oss @@ -773,7 +771,7 @@ size_t SystemInformation::GetAvailablePhysicalMemory() return this->Implementation->GetAvailablePhysicalMemory(); } -kwsys_stl::string SystemInformation::GetMemoryDescription( +std::string SystemInformation::GetMemoryDescription( const char *hostLimitEnvVarName, const char *procLimitEnvVarName) { @@ -838,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); } @@ -922,7 +920,7 @@ namespace { #if defined(__linux) || defined(__APPLE__) int LoadLines( FILE *file, - kwsys_stl::vector<kwsys_stl::string> &lines) + std::vector<std::string> &lines) { // Load each line in the given file into a the vector. int nRead=0; @@ -959,7 +957,7 @@ int LoadLines( // ***************************************************************************** int LoadLines( const char *fileName, - kwsys_stl::vector<kwsys_stl::string> &lines) + std::vector<std::string> &lines) { FILE *file=fopen(fileName,"r"); if (file==0) @@ -975,14 +973,14 @@ int LoadLines( // **************************************************************************** template<typename T> int NameValue( - kwsys_stl::vector<kwsys_stl::string> &lines, - kwsys_stl::string name, T &value) + std::vector<std::string> &lines, + std::string name, T &value) { size_t nLines=lines.size(); for (size_t i=0; i<nLines; ++i) { size_t at=lines[i].find(name); - if (at==kwsys_stl::string::npos) + if (at==std::string::npos) { continue; } @@ -1002,7 +1000,7 @@ int GetFieldsFromFile( const char **fieldNames, T *values) { - kwsys_stl::vector<kwsys_stl::string> fields; + std::vector<std::string> fields; if (!LoadLines(fileName,fields)) { return -1; @@ -1052,7 +1050,7 @@ int GetFieldsFromCommand( { return -1; } - kwsys_stl::vector<kwsys_stl::string> fields; + std::vector<std::string> fields; int nl=LoadLines(file,fields); pclose(file); if (nl==0) @@ -1326,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. @@ -1334,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: @@ -1343,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: @@ -1361,15 +1359,15 @@ 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; }; @@ -1418,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) @@ -1458,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; @@ -1725,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"; @@ -1816,8 +1814,8 @@ int SystemInformationImplementation::GetFullyQualifiedDomainName( continue; } - kwsys_stl::string candidate=host; - if ((candidate.find(base)!=kwsys_stl::string::npos) && baseSize<candidate.size()) + std::string candidate=host; + if ((candidate.find(base)!=std::string::npos) && baseSize<candidate.size()) { // success, stop now. ierr=0; @@ -1893,7 +1891,7 @@ const char * SystemInformationImplementation::GetVendorID() } /** Return the type ID of the CPU */ -kwsys_stl::string SystemInformationImplementation::GetTypeID() +std::string SystemInformationImplementation::GetTypeID() { std::ostringstream str; str << this->ChipID.Type; @@ -1901,7 +1899,7 @@ kwsys_stl::string SystemInformationImplementation::GetTypeID() } /** Return the family of the CPU present */ -kwsys_stl::string SystemInformationImplementation::GetFamilyID() +std::string SystemInformationImplementation::GetFamilyID() { std::ostringstream str; str << this->ChipID.Family; @@ -1909,7 +1907,7 @@ kwsys_stl::string SystemInformationImplementation::GetFamilyID() } // Return the model of CPU present */ -kwsys_stl::string SystemInformationImplementation::GetModelID() +std::string SystemInformationImplementation::GetModelID() { std::ostringstream str; str << this->ChipID.Model; @@ -1917,13 +1915,13 @@ kwsys_stl::string SystemInformationImplementation::GetModelID() } // 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() { std::ostringstream str; str << this->ChipID.Revision; @@ -2176,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. @@ -2795,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); } @@ -3144,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) @@ -3176,7 +3174,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile() { this->NumberOfLogicalCPU = 0; this->NumberOfPhysicalCPU = 0; - kwsys_stl::string buffer; + std::string buffer; FILE *fd = fopen("/proc/cpuinfo", "r" ); if ( !fd ) @@ -3205,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) { @@ -3220,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) @@ -3238,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()); @@ -3254,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<float>(atof(CPUSpeed.c_str())); @@ -3270,7 +3268,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile() #endif // Chip family - kwsys_stl::string familyStr = + std::string familyStr = this->ExtractValueFromCpuInfoFile(buffer,"cpu family"); if(familyStr.empty()) { @@ -3300,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; @@ -3308,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"); @@ -3321,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<const char*> cachename; + std::vector<const char*> cachename; cachename.clear(); cachename.push_back("cache size"); // e.g. x86 @@ -3331,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"); @@ -3344,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; } @@ -3725,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" @@ -4460,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); @@ -4523,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; } @@ -4591,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) @@ -4608,9 +4606,9 @@ kwsys_stl::string SystemInformationImplementation::ExtractValueFromSysCtl(const /** Run a given process */ -kwsys_stl::string SystemInformationImplementation::RunProcess(kwsys_stl::vector<const char*> args) +std::string SystemInformationImplementation::RunProcess(std::vector<const char*> args) { - kwsys_stl::string buffer = ""; + std::string buffer = ""; // Run the application kwsysProcess* gp = kwsysProcess_New(); @@ -4668,14 +4666,14 @@ kwsys_stl::string SystemInformationImplementation::RunProcess(kwsys_stl::vector< } -kwsys_stl::string SystemInformationImplementation::ParseValueFromKStat(const char* arguments) +std::string SystemInformationImplementation::ParseValueFromKStat(const char* arguments) { - kwsys_stl::vector<const char*> args; + std::vector<const char*> args; args.clear(); args.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) @@ -4697,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('"'); @@ -4711,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') @@ -4727,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; } @@ -4881,8 +4879,8 @@ bool SystemInformationImplementation::QueryHaikuInfo() bool SystemInformationImplementation::QueryQNXMemory() { #if defined(__QNX__) - kwsys_stl::string buffer; - kwsys_stl::vector<const char*> args; + std::string buffer; + std::vector<const char*> args; args.clear(); args.push_back("showmem"); @@ -4939,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<const char*> args; + std::string buffer; + std::vector<const char*> args; args.clear(); args.push_back("pidin"); @@ -5436,10 +5434,10 @@ bool SystemInformationImplementation::QueryOSInformation() int SystemInformationImplementation::CallSwVers( const char *arg, - kwsys_stl::string &ver) + std::string &ver) { #ifdef __APPLE__ - kwsys_stl::vector<const char*> args; + std::vector<const char*> args; args.push_back("sw_vers"); args.push_back(arg); args.push_back(0); @@ -5453,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 9966f4ca6abca009f39eabdef2726b6af5c9f2f7..7c453887e95b4612080c320f0e473ec2d4ad4c40 100644 --- a/SystemInformation.hxx.in +++ b/SystemInformation.hxx.in @@ -12,13 +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 -#endif -#include <@KWSYS_NAMESPACE@/stl/string> +#include <@KWSYS_NAMESPACE@/Configure.hxx> #include <stddef.h> /* size_t */ +#include <string> namespace @KWSYS_NAMESPACE@ { @@ -44,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(); @@ -60,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(); @@ -76,7 +72,7 @@ public: // returns an informative general description of the os // on this system. - kwsys_stl::string GetOSDescription(); + std::string GetOSDescription(); bool Is64Bits(); @@ -97,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); @@ -143,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(); @@ -153,9 +149,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/SystemTools.cxx b/SystemTools.cxx index 07aa9f5450c5e80a49eae2757723133e052d3375..97a1df874fb4e9a9f0eb81c554e229605b6b7037 100644 --- a/SystemTools.cxx +++ b/SystemTools.cxx @@ -34,8 +34,7 @@ #include <iostream> #include <fstream> #include <sstream> - -#include KWSYS_HEADER(stl/set) +#include <set> // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. @@ -217,12 +216,12 @@ static time_t windows_filetime_to_posix_time(const FILETIME& ft) #ifdef KWSYS_WINDOWS_DIRS #include <wctype.h> -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()); @@ -243,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()); @@ -251,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(), @@ -300,11 +299,11 @@ inline void Realpath(const kwsys_stl::string& path, #include <sys/types.h> #include <fcntl.h> #include <unistd.h> -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()); } @@ -313,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]; @@ -382,14 +381,14 @@ double SystemTools::GetTime(void) } class SystemToolsTranslationMap : - public kwsys_stl::map<kwsys_stl::string,kwsys_stl::string> + public std::map<std::string,std::string> { }; #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; @@ -402,12 +401,12 @@ struct SystemToolsPathCaseCmp }; class SystemToolsPathCaseMap: - public kwsys_stl::map<kwsys_stl::string, kwsys_stl::string, + public std::map<std::string, std::string, SystemToolsPathCaseCmp> {}; #endif // adds the elements of the env variable path to the arg passed in -void SystemTools::GetPath(kwsys_stl::vector<kwsys_stl::string>& path, const char* env) +void SystemTools::GetPath(std::vector<std::string>& path, const char* env) { #if defined(_WIN32) && !defined(__CYGWIN__) const char pathSep = ';'; @@ -424,19 +423,19 @@ void SystemTools::GetPath(kwsys_stl::vector<kwsys_stl::string>& 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; @@ -446,7 +445,7 @@ void SystemTools::GetPath(kwsys_stl::vector<kwsys_stl::string>& path, const char done = true; } } - for(kwsys_stl::vector<kwsys_stl::string>::iterator i = path.begin(); + for(std::vector<std::string>::iterator i = path.begin(); i != path.end(); ++i) { SystemTools::ConvertToUnixSlashes(*i); @@ -458,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) @@ -477,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); } @@ -493,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) @@ -510,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('='); @@ -555,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; @@ -588,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) @@ -602,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; } @@ -640,7 +639,7 @@ struct kwsysEnvCompare } }; -class kwsysEnv: public kwsys_stl::set<const char*, kwsysEnvCompare> +class kwsysEnv: public std::set<const char*, kwsysEnvCompare> { class Free { @@ -650,7 +649,7 @@ class kwsysEnv: public kwsys_stl::set<const char*, kwsysEnvCompare> ~Free() { free(const_cast<char*>(this->Env)); } }; public: - typedef kwsys_stl::set<const char*, kwsysEnvCompare> derived; + typedef std::set<const char*, kwsysEnvCompare> derived; ~kwsysEnv() { for(derived::iterator i = this->begin(); i != this->end(); ++i) @@ -688,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()); } @@ -711,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(), @@ -727,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)) { @@ -740,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); @@ -773,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()) @@ -786,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) { @@ -799,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<char *>(strstr(src,replace)); @@ -845,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); } @@ -916,13 +915,13 @@ static DWORD SystemToolsMakeRegistryMode(DWORD mode, #if defined(_WIN32) && !defined(__CYGWIN__) bool -SystemTools::GetRegistrySubKeys(const kwsys_stl::string& key, - kwsys_stl::vector<kwsys_stl::string>& subkeys, +SystemTools::GetRegistrySubKeys(const std::string& key, + std::vector<std::string>& 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; @@ -955,8 +954,8 @@ SystemTools::GetRegistrySubKeys(const kwsys_stl::string& key, return true; } #else -bool SystemTools::GetRegistrySubKeys(const kwsys_stl::string&, - kwsys_stl::vector<kwsys_stl::string>&, +bool SystemTools::GetRegistrySubKeys(const std::string&, + std::vector<std::string>&, KeyWOW64) { return false; @@ -971,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; @@ -1028,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; @@ -1044,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; @@ -1085,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; } @@ -1099,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; @@ -1130,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; @@ -1204,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()) { @@ -1238,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)) { @@ -1261,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()) @@ -1314,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)) { @@ -1390,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. @@ -1463,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<kwsys_stl::string::value_type>(toupper(s[0])); + n[0] = static_cast<std::string::value_type>(toupper(s[0])); for (size_t i = 1; i < s.size(); i++) { - n[i] = static_cast<kwsys_stl::string::value_type>(tolower(s[i])); + n[i] = static_cast<std::string::value_type>(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) @@ -1494,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<kwsys_stl::string::value_type>(toupper(s[i])); + n[i] = static_cast<std::string::value_type>(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) @@ -1515,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<kwsys_stl::string::value_type>(tolower(s[i])); + n[i] = static_cast<std::string::value_type>(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()); @@ -1592,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<kwsys_stl::string::value_type>(tolower(s[i])); + n[i] = static_cast<std::string::value_type>(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<kwsys_stl::string::value_type>(toupper(s[i])); + n[i] = static_cast<std::string::value_type>(toupper(s[i])); } return n; } @@ -1716,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) { @@ -1738,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) { @@ -1784,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()) @@ -1792,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) { @@ -1817,10 +1816,10 @@ kwsys_stl::string SystemTools::CropString(const kwsys_stl::string& s, } //---------------------------------------------------------------------------- -kwsys_stl::vector<kwsys::String> SystemTools::SplitString(const kwsys_stl::string& p, char sep, bool isPath) +std::vector<kwsys::String> SystemTools::SplitString(const std::string& p, char sep, bool isPath) { - kwsys_stl::string path = p; - kwsys_stl::vector<kwsys::String> paths; + std::string path = p; + std::vector<kwsys::String> paths; if(path.empty()) { return paths; @@ -1830,9 +1829,9 @@ kwsys_stl::vector<kwsys::String> 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; @@ -1912,12 +1911,12 @@ int SystemTools::EstimateFormatLength(const char *format, va_list ap) return static_cast<int>(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) @@ -1948,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 == '.' ) { @@ -1972,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; @@ -1981,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 != ' ' ) @@ -2029,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) { @@ -2055,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; @@ -2066,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<wchar_t> wfull(wfull_len); + std::vector<wchar_t> wfull(wfull_len); GetFullPathNameW(wsource.c_str(), wfull_len, &wfull[0], NULL); /* This should get the correct size without any extra padding from the @@ -2075,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 \\ */ @@ -2084,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]); } } @@ -2119,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) { @@ -2149,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); @@ -2159,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++; @@ -2190,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<kwsys_stl::string::size_type>(0), - static_cast<kwsys_stl::string::size_type>(1), '\"'); + ret.insert(static_cast<std::string::size_type>(0), + static_cast<std::string::size_type>(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)) { @@ -2241,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) @@ -2357,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) ) @@ -2373,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 @@ -2467,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) @@ -2484,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; @@ -2504,12 +2503,12 @@ bool SystemTools::CopyADirectory(const kwsys_stl::string& source, const kwsys_st if (strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)),".") && strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)),"..")) { - kwsys_stl::string fullPath = source; + std::string fullPath = source; fullPath += "/"; fullPath += dir.GetFile(static_cast<unsigned long>(fileNum)); if(SystemTools::FileIsDirectory(fullPath)) { - kwsys_stl::string fullDestPath = destination; + std::string fullDestPath = destination; fullDestPath += "/"; fullDestPath += dir.GetFile(static_cast<unsigned long>(fileNum)); if (!SystemTools::CopyADirectory(fullPath, @@ -2534,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 @@ -2574,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 @@ -2597,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 @@ -2721,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())) { @@ -2769,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. @@ -2797,7 +2796,7 @@ bool SystemTools::RemoveADirectory(const kwsys_stl::string& source) if (strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)),".") && strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)),"..")) { - kwsys_stl::string fullPath = source; + std::string fullPath = source; fullPath += "/"; fullPath += dir.GetFile(static_cast<unsigned long>(fileNum)); if(SystemTools::FileIsDirectory(fullPath) && @@ -2833,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<kwsys_stl::string>& userPaths, +std::string SystemTools +::FindName(const std::string& name, + const std::vector<std::string>& userPaths, bool no_system_path) { // Add the system search path to our path first - kwsys_stl::vector<kwsys_stl::string> path; + std::vector<std::string> path; if (!no_system_path) { SystemTools::GetPath(path, "CMAKE_FILE_PATH"); @@ -2847,7 +2846,7 @@ kwsys_stl::string SystemTools } // now add the additional paths { - for(kwsys_stl::vector<kwsys_stl::string>::const_iterator i = userPaths.begin(); + for(std::vector<std::string>::const_iterator i = userPaths.begin(); i != userPaths.end(); ++i) { path.push_back(*i); @@ -2855,10 +2854,10 @@ kwsys_stl::string SystemTools } // Add a trailing slash to all paths to aid the search process. { - for(kwsys_stl::vector<kwsys_stl::string>::iterator i = path.begin(); + for(std::vector<std::string>::iterator i = path.begin(); i != path.end(); ++i) { - kwsys_stl::string& p = *i; + std::string& p = *i; if(p.empty() || *p.rbegin() != '/') { p += "/"; @@ -2866,8 +2865,8 @@ kwsys_stl::string SystemTools } } // now look for the file - kwsys_stl::string tryPath; - for(kwsys_stl::vector<kwsys_stl::string>::const_iterator p = path.begin(); + std::string tryPath; + for(std::vector<std::string>::const_iterator p = path.begin(); p != path.end(); ++p) { tryPath = *p; @@ -2886,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<kwsys_stl::string>& userPaths, +std::string SystemTools +::FindFile(const std::string& name, + const std::vector<std::string>& 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); @@ -2905,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<kwsys_stl::string>& userPaths, +std::string SystemTools +::FindDirectory(const std::string& name, + const std::vector<std::string>& 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); @@ -2924,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<kwsys_stl::string>& userPaths, + const std::vector<std::string>& 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<kwsys_stl::string>& userPaths, +std::string SystemTools::FindProgram( + const std::string& name, + const std::vector<std::string>& userPaths, bool no_system_path) { - kwsys_stl::vector<kwsys_stl::string> extensions; + std::vector<std::string> extensions; #if defined (_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) bool hasExtension = false; // check to see if the name already has a .xxx at @@ -2957,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<kwsys_stl::string>::iterator i = + for(std::vector<std::string>::iterator i = extensions.begin(); i != extensions.end(); ++i) { tryPath = name; @@ -2979,7 +2978,7 @@ kwsys_stl::string SystemTools::FindProgram( return SystemTools::CollapseFullPath(tryPath); } // now construct the path - kwsys_stl::vector<kwsys_stl::string> path; + std::vector<std::string> path; // Add the system search path to our path. if (!no_system_path) { @@ -2987,7 +2986,7 @@ kwsys_stl::string SystemTools::FindProgram( } // now add the additional paths { - for(kwsys_stl::vector<kwsys_stl::string>::const_iterator i = + for(std::vector<std::string>::const_iterator i = userPaths.begin(); i != userPaths.end(); ++i) { path.push_back(*i); @@ -2995,10 +2994,10 @@ kwsys_stl::string SystemTools::FindProgram( } // Add a trailing slash to all paths to aid the search process. { - for(kwsys_stl::vector<kwsys_stl::string>::iterator i = path.begin(); + for(std::vector<std::string>::iterator i = path.begin(); i != path.end(); ++i) { - kwsys_stl::string& p = *i; + std::string& p = *i; if(p.empty() || *p.rbegin() != '/') { p += "/"; @@ -3006,7 +3005,7 @@ kwsys_stl::string SystemTools::FindProgram( } } // Try each path - for(kwsys_stl::vector<kwsys_stl::string>::iterator p = path.begin(); + for(std::vector<std::string>::iterator p = path.begin(); p != path.end(); ++p) { #ifdef _WIN32 @@ -3014,7 +3013,7 @@ kwsys_stl::string SystemTools::FindProgram( SystemTools::ReplaceString(*p, "\"", ""); #endif // first try with extensions - for(kwsys_stl::vector<kwsys_stl::string>::iterator ext + for(std::vector<std::string>::iterator ext = extensions.begin(); ext != extensions.end(); ++ext) { tryPath = *p; @@ -3039,16 +3038,16 @@ kwsys_stl::string SystemTools::FindProgram( return ""; } -kwsys_stl::string SystemTools::FindProgram( - const kwsys_stl::vector<kwsys_stl::string>& names, - const kwsys_stl::vector<kwsys_stl::string>& path, +std::string SystemTools::FindProgram( + const std::vector<std::string>& names, + const std::vector<std::string>& path, bool noSystemPath) { - for(kwsys_stl::vector<kwsys_stl::string>::const_iterator it = names.begin(); + for(std::vector<std::string>::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() ) @@ -3064,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<kwsys_stl::string>& userPaths) +std::string SystemTools +::FindLibrary(const std::string& name, + const std::vector<std::string>& userPaths) { // See if the executable exists as written. if(SystemTools::FileExists(name) && @@ -3076,11 +3075,11 @@ kwsys_stl::string SystemTools } // Add the system search path to our path. - kwsys_stl::vector<kwsys_stl::string> path; + std::vector<std::string> path; SystemTools::GetPath(path); // now add the additional paths { - for(kwsys_stl::vector<kwsys_stl::string>::const_iterator i = userPaths.begin(); + for(std::vector<std::string>::const_iterator i = userPaths.begin(); i != userPaths.end(); ++i) { path.push_back(*i); @@ -3088,18 +3087,18 @@ kwsys_stl::string SystemTools } // Add a trailing slash to all paths to aid the search process. { - for(kwsys_stl::vector<kwsys_stl::string>::iterator i = path.begin(); + for(std::vector<std::string>::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<kwsys_stl::string>::const_iterator p = path.begin(); + std::string tryPath; + for(std::vector<std::string>::const_iterator p = path.begin(); p != path.end(); ++p) { #if defined(__APPLE__) @@ -3174,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()) { @@ -3231,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( @@ -3258,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 = @@ -3295,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; @@ -3316,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; @@ -3334,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); @@ -3348,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; @@ -3357,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<kwsys_stl::string> failures; - kwsys_stl::string self = argv0 ? argv0 : ""; + std::vector<std::string> failures; + std::string self = argv0 ? argv0 : ""; failures.push_back(self); SystemTools::ConvertToUnixSlashes(self); self = SystemTools::FindProgram(self); @@ -3372,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 @@ -3409,7 +3408,7 @@ bool SystemTools::FindProgramPath(const char* argv0, msg << " argv[0] = \"" << argv0 << "\"\n"; } msg << " Attempted paths:\n"; - kwsys_stl::vector<kwsys_stl::string>::iterator i; + std::vector<std::string>::iterator i; for(i=failures.begin(); i != failures.end(); ++i) { msg << " \"" << *i << "\"\n"; @@ -3422,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 @@ -3441,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() != '/') @@ -3461,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. @@ -3484,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<kwsys_stl::string,kwsys_stl::string>::const_iterator it; + std::map<std::string,std::string>::const_iterator it; for(it = SystemTools::TranslationMap->begin(); it != SystemTools::TranslationMap->end(); ++it ) @@ -3502,13 +3501,13 @@ void SystemTools::CheckTranslationPath(kwsys_stl::string & path) static void SystemToolsAppendComponents( - kwsys_stl::vector<kwsys_stl::string>& out_components, - kwsys_stl::vector<kwsys_stl::string>::const_iterator first, - kwsys_stl::vector<kwsys_stl::string>::const_iterator last) + std::vector<std::string>& out_components, + std::vector<std::string>::const_iterator first, + std::vector<std::string>::const_iterator last) { - static const kwsys_stl::string up = ".."; - static const kwsys_stl::string cur = "."; - for(kwsys_stl::vector<kwsys_stl::string>::const_iterator i = first; + static const std::string up = ".."; + static const std::string cur = "."; + for(std::vector<std::string>::const_iterator i = first; i != last; ++i) { if(*i == up) @@ -3525,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<kwsys_stl::string> out_components; + std::vector<std::string> out_components; // Split the input path components. - kwsys_stl::vector<kwsys_stl::string> path_components; + std::vector<std::string> 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<kwsys_stl::string> base_components; + std::vector<std::string> base_components; if(in_base) { // Use the given base path. @@ -3571,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 @@ -3596,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<kwsys_stl::string> out_components; + std::vector<std::string> out_components; // Split the input path components. - kwsys_stl::vector<kwsys_stl::string> path_components; + std::vector<std::string> 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<kwsys_stl::string> base_components; + std::vector<std::string> base_components; // Use the given base path. SystemTools::SplitPath(in_base, base_components); @@ -3626,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 @@ -3652,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)) { @@ -3663,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<kwsys::String> localSplit = SystemTools::SplitString(l, '/', true); - kwsys_stl::vector<kwsys::String> remoteSplit = SystemTools::SplitString(r, '/', true); - kwsys_stl::vector<kwsys::String> commonPath; // store shared parts of path in this array - kwsys_stl::vector<kwsys::String> finalPath; // store the final relative path here + std::vector<kwsys::String> localSplit = SystemTools::SplitString(l, '/', true); + std::vector<kwsys::String> remoteSplit = SystemTools::SplitString(r, '/', true); + std::vector<kwsys::String> commonPath; // store shared parts of path in this array + std::vector<kwsys::String> finalPath; // store the final relative path here // count up how many matching directory names there are from the start unsigned int sameCount = 0; while( @@ -3715,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<String>::iterator vit = remoteSplit.begin(); + for(std::vector<String>::iterator vit = remoteSplit.begin(); vit != remoteSplit.end(); ++vit) { if(!vit->empty()) @@ -3723,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<String>::iterator vit1 = finalPath.begin(); + for(std::vector<String>::iterator vit1 = finalPath.begin(); vit1 != finalPath.end(); ++vit1) { if(!relativePath.empty() && *relativePath.rbegin() != '/') @@ -3739,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<kwsys_stl::string> path_components; + std::vector<std::string> path_components; SystemTools::SplitPath(pathIn, path_components); if(path_components[0].empty()) // First component always exists. { @@ -3752,7 +3751,7 @@ static int GetCasePathName(const kwsys_stl::string & pathIn, } // Start with root component. - kwsys_stl::vector<kwsys_stl::string>::size_type idx = 0; + std::vector<std::string>::size_type idx = 0; casePath = path_components[idx++]; // make sure drive letter is always upper case if(casePath.size() > 1 && casePath[1] == ':') @@ -3776,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; @@ -3809,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; @@ -3822,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) { @@ -3835,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(); @@ -3921,7 +3920,7 @@ const char* SystemTools::SplitPathRootComponent(const std::string& p, //---------------------------------------------------------------------------- void SystemTools::SplitPath(const std::string& p, - kwsys_stl::vector<kwsys_stl::string>& components, + std::vector<std::string>& components, bool expand_home_dir) { const char* c; @@ -3929,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) { @@ -3981,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; } } @@ -3989,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<kwsys_stl::string>& components) +std::string +SystemTools::JoinPath(const std::vector<std::string>& components) { return SystemTools::JoinPath(components.begin(), components.end()); } //---------------------------------------------------------------------------- -kwsys_stl::string +std::string SystemTools -::JoinPath(kwsys_stl::vector<kwsys_stl::string>::const_iterator first, - kwsys_stl::vector<kwsys_stl::string>::const_iterator last) +::JoinPath(std::vector<std::string>::const_iterator first, + std::vector<std::string>::const_iterator last) { // Construct result in a single string. - kwsys_stl::string result; + std::string result; size_t len = 0; - kwsys_stl::vector<kwsys_stl::string>::const_iterator i; + std::vector<std::string>::const_iterator i; for(i = first; i != last; ++i) { len += 1 + i->size(); @@ -4038,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 @@ -4054,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<kwsys_stl::string>& lines, char separator) +bool SystemTools::Split(const std::string& str, std::vector<std::string>& 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)); @@ -4078,14 +4077,14 @@ bool SystemTools::Split(const kwsys_stl::string& str, kwsys_stl::vector<kwsys_st } //---------------------------------------------------------------------------- -bool SystemTools::Split(const kwsys_stl::string& str, kwsys_stl::vector<kwsys_stl::string>& lines) +bool SystemTools::Split(const std::string& str, std::vector<std::string>& 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)); @@ -4110,15 +4109,15 @@ bool SystemTools::Split(const kwsys_stl::string& str, kwsys_stl::vector<kwsys_st * Return path of a full filename (no trailing slashes). * Warning: returned path is converted to Unix slashes format. */ -kwsys_stl::string SystemTools::GetFilenamePath(const kwsys_stl::string& filename) +std::string SystemTools::GetFilenamePath(const std::string& filename) { - kwsys_stl::string fn = filename; + std::string fn = filename; SystemTools::ConvertToUnixSlashes(fn); - kwsys_stl::string::size_type slash_pos = fn.rfind("/"); - if(slash_pos != kwsys_stl::string::npos) + std::string::size_type slash_pos = fn.rfind("/"); + if(slash_pos != std::string::npos) { - kwsys_stl::string ret = fn.substr(0, slash_pos); + std::string ret = fn.substr(0, slash_pos); if(ret.size() == 2 && ret[1] == ':') { return ret + '/'; @@ -4139,14 +4138,14 @@ kwsys_stl::string SystemTools::GetFilenamePath(const kwsys_stl::string& filename /** * Return file name of a full filename (i.e. file name without path). */ -kwsys_stl::string SystemTools::GetFilenameName(const kwsys_stl::string& filename) +std::string SystemTools::GetFilenameName(const std::string& filename) { #if defined(_WIN32) - kwsys_stl::string::size_type slash_pos = filename.find_last_of("/\\"); + std::string::size_type slash_pos = filename.find_last_of("/\\"); #else - kwsys_stl::string::size_type slash_pos = filename.rfind('/'); + std::string::size_type slash_pos = filename.rfind('/'); #endif - if(slash_pos != kwsys_stl::string::npos) + if(slash_pos != std::string::npos) { return filename.substr(slash_pos + 1); } @@ -4161,11 +4160,11 @@ kwsys_stl::string SystemTools::GetFilenameName(const kwsys_stl::string& filename * Return file extension of a full filename (dot included). * Warning: this is the longest extension (for example: .tar.gz) */ -kwsys_stl::string SystemTools::GetFilenameExtension(const kwsys_stl::string& filename) +std::string SystemTools::GetFilenameExtension(const std::string& filename) { - kwsys_stl::string name = SystemTools::GetFilenameName(filename); - kwsys_stl::string::size_type dot_pos = name.find('.'); - if(dot_pos != kwsys_stl::string::npos) + std::string name = SystemTools::GetFilenameName(filename); + std::string::size_type dot_pos = name.find('.'); + if(dot_pos != std::string::npos) { return name.substr(dot_pos); } @@ -4179,11 +4178,11 @@ kwsys_stl::string SystemTools::GetFilenameExtension(const kwsys_stl::string& fil * Return file extension of a full filename (dot included). * Warning: this is the shortest extension (for example: .gz of .tar.gz) */ -kwsys_stl::string SystemTools::GetFilenameLastExtension(const kwsys_stl::string& filename) +std::string SystemTools::GetFilenameLastExtension(const std::string& filename) { - kwsys_stl::string name = SystemTools::GetFilenameName(filename); - kwsys_stl::string::size_type dot_pos = name.rfind('.'); - if(dot_pos != kwsys_stl::string::npos) + std::string name = SystemTools::GetFilenameName(filename); + std::string::size_type dot_pos = name.rfind('.'); + if(dot_pos != std::string::npos) { return name.substr(dot_pos); } @@ -4197,11 +4196,11 @@ kwsys_stl::string SystemTools::GetFilenameLastExtension(const kwsys_stl::string& * Return file name without extension of a full filename (i.e. without path). * Warning: it considers the longest extension (for example: .tar.gz) */ -kwsys_stl::string SystemTools::GetFilenameWithoutExtension(const kwsys_stl::string& filename) +std::string SystemTools::GetFilenameWithoutExtension(const std::string& filename) { - kwsys_stl::string name = SystemTools::GetFilenameName(filename); - kwsys_stl::string::size_type dot_pos = name.find('.'); - if(dot_pos != kwsys_stl::string::npos) + std::string name = SystemTools::GetFilenameName(filename); + std::string::size_type dot_pos = name.find('.'); + if(dot_pos != std::string::npos) { return name.substr(0, dot_pos); } @@ -4217,12 +4216,12 @@ kwsys_stl::string SystemTools::GetFilenameWithoutExtension(const kwsys_stl::stri * Warning: it considers the last extension (for example: removes .gz * from .tar.gz) */ -kwsys_stl::string -SystemTools::GetFilenameWithoutLastExtension(const kwsys_stl::string& filename) +std::string +SystemTools::GetFilenameWithoutLastExtension(const std::string& filename) { - kwsys_stl::string name = SystemTools::GetFilenameName(filename); - kwsys_stl::string::size_type dot_pos = name.rfind('.'); - if(dot_pos != kwsys_stl::string::npos) + std::string name = SystemTools::GetFilenameName(filename); + std::string::size_type dot_pos = name.rfind('.'); + if(dot_pos != std::string::npos) { return name.substr(0, dot_pos); } @@ -4331,7 +4330,7 @@ SystemTools::DetectFileType(const char *filename, bool SystemTools::LocateFileInDir(const char *filename, const char *dir, - kwsys_stl::string& filename_found, + std::string& filename_found, int try_filename_dirs) { if (!filename || !dir) @@ -4341,12 +4340,12 @@ bool SystemTools::LocateFileInDir(const char *filename, // Get the basename of 'filename' - kwsys_stl::string filename_base = SystemTools::GetFilenameName(filename); + std::string filename_base = SystemTools::GetFilenameName(filename); // Check if 'dir' is really a directory // If win32 and matches something like C:, accept it as a dir - kwsys_stl::string real_dir; + std::string real_dir; if (!SystemTools::FileIsDirectory(dir)) { #if defined( _WIN32 ) @@ -4370,7 +4369,7 @@ bool SystemTools::LocateFileInDir(const char *filename, int need_slash = (dir_len && dir[dir_len - 1] != '/' && dir[dir_len - 1] != '\\'); - kwsys_stl::string temp = dir; + std::string temp = dir; if (need_slash) { temp += "/"; @@ -4390,9 +4389,9 @@ bool SystemTools::LocateFileInDir(const char *filename, else if (try_filename_dirs) { - kwsys_stl::string filename_dir(filename); - kwsys_stl::string filename_dir_base; - kwsys_stl::string filename_dir_bases; + std::string filename_dir(filename); + std::string filename_dir_base; + std::string filename_dir_bases; do { filename_dir = SystemTools::GetFilenamePath(filename_dir); @@ -4426,7 +4425,7 @@ bool SystemTools::LocateFileInDir(const char *filename, return res; } -bool SystemTools::FileIsFullPath(const kwsys_stl::string& in_name) +bool SystemTools::FileIsFullPath(const std::string& in_name) { return SystemTools::FileIsFullPath(in_name.c_str(), in_name.size()); } @@ -4475,7 +4474,7 @@ bool SystemTools::FileIsFullPath(const char* in_name, size_t len) return false; } -bool SystemTools::GetShortPath(const kwsys_stl::string& path, kwsys_stl::string& shortPath) +bool SystemTools::GetShortPath(const std::string& path, std::string& shortPath) { #if defined(_WIN32) && !defined(__CYGWIN__) const int size = int(path.size()) +1; // size of return @@ -4493,8 +4492,8 @@ bool SystemTools::GetShortPath(const kwsys_stl::string& path, kwsys_stl::string& strcpy(tempPath,path.c_str()); } - kwsys_stl::wstring wtempPath = Encoding::ToWide(tempPath); - kwsys_stl::vector<wchar_t> buffer(wtempPath.size()+1); + std::wstring wtempPath = Encoding::ToWide(tempPath); + std::vector<wchar_t> buffer(wtempPath.size()+1); buffer[0] = 0; ret = GetShortPathNameW(wtempPath.c_str(), &buffer[0], static_cast<DWORD>(wtempPath.size())); @@ -4516,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 @@ -4529,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<kwsys_stl::string> e; - kwsys_stl::string findProg = SystemTools::FindProgram(path, e); + std::vector<std::string> e; + std::string findProg = SystemTools::FindProgram(path, e); if(!findProg.empty()) { program = findProg; @@ -4540,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); @@ -4565,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); @@ -4583,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] = '_'; } @@ -4616,7 +4615,7 @@ kwsys_stl::string SystemTools::MakeCidentifier(const kwsys_stl::string& s) // 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(std::istream& is, - kwsys_stl::string& line, + std::string& line, bool* has_newline /* = 0 */, long sizeLimit /* = -1 */) { @@ -4732,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( @@ -4790,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) { @@ -4823,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()] == '/') @@ -4870,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]; @@ -5167,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 @@ -5185,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; @@ -5296,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 ffa1354486682250829a031e43ca3a114fbd5d1a..d2d1d400696ac3dea8db742a9b91bb3021d49671 100644 --- a/SystemTools.hxx.in +++ b/SystemTools.hxx.in @@ -15,9 +15,9 @@ #include <@KWSYS_NAMESPACE@/Configure.hxx> #include <iosfwd> -#include <@KWSYS_NAMESPACE@/stl/string> -#include <@KWSYS_NAMESPACE@/stl/vector> -#include <@KWSYS_NAMESPACE@/stl/map> +#include <string> +#include <vector> +#include <map> #include <@KWSYS_NAMESPACE@/String.hxx> @@ -30,7 +30,7 @@ #include <stdarg.h> // Required for FILE* #include <stdio.h> -#if @KWSYS_NAMESPACE@_STL_HAVE_STD && !defined(va_list) +#if !defined(va_list) // Some compilers move va_list into the std namespace and there is no way to // 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 @@ -48,11 +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 -#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<String> SplitString(const kwsys_stl::string& s, char separator = '/', + static std::vector<String> 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<kwsys_stl::string>& l); - static bool Split(const kwsys_stl::string& s, kwsys_stl::vector<kwsys_stl::string>& l, char separator); + static bool Split(const std::string& s, std::vector<std::string>& l); + static bool Split(const std::string& s, std::vector<std::string>& 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<kwsys_stl::string>& components, + std::vector<std::string>& 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<kwsys_stl::string>& components); - static kwsys_stl::string JoinPath( - kwsys_stl::vector<kwsys_stl::string>::const_iterator first, - kwsys_stl::vector<kwsys_stl::string>::const_iterator last); + static std::string JoinPath( + const std::vector<std::string>& components); + static std::string JoinPath( + std::vector<std::string>::const_iterator first, + std::vector<std::string>::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 @@ -540,19 +535,19 @@ public: * be true when the line read had a newline character. */ static bool GetLineFromStream(std::istream& istr, - kwsys_stl::string& line, + 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<kwsys_stl::string>& path = - kwsys_stl::vector<kwsys_stl::string>(), + static std::string FindFile( + const std::string& name, + const std::vector<std::string>& path = + std::vector<std::string>(), 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<kwsys_stl::string>& path = - kwsys_stl::vector<kwsys_stl::string>(), + static std::string FindDirectory( + const std::string& name, + const std::vector<std::string>& path = + std::vector<std::string>(), 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<kwsys_stl::string>& path = - kwsys_stl::vector<kwsys_stl::string>(), + const std::vector<std::string>& path = + std::vector<std::string>(), bool no_system_path = false); - static kwsys_stl::string FindProgram( - const kwsys_stl::string& name, - const kwsys_stl::vector<kwsys_stl::string>& path = - kwsys_stl::vector<kwsys_stl::string>(), + static std::string FindProgram( + const std::string& name, + const std::vector<std::string>& path = + std::vector<std::string>(), bool no_system_path = false); - static kwsys_stl::string FindProgram( - const kwsys_stl::vector<kwsys_stl::string>& names, - const kwsys_stl::vector<kwsys_stl::string>& path = - kwsys_stl::vector<kwsys_stl::string>(), + static std::string FindProgram( + const std::vector<std::string>& names, + const std::vector<std::string>& path = + std::vector<std::string>(), 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<kwsys_stl::string>& path); + static std::string FindLibrary( + const std::string& name, + const std::vector<std::string>& 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<kwsys_stl::string>& subkeys, + static bool GetRegistrySubKeys(const std::string& key, + std::vector<std::string>& 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<kwsys_stl::string>& path, + static void GetPath(std::vector<std::string>& 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<kwsys_stl::string>& path = - kwsys_stl::vector<kwsys_stl::string>(), + static std::string FindName( + const std::string& name, + const std::vector<std::string>& path = + std::vector<std::string>(), bool no_system_path = false); @@ -1005,9 +998,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/hash_fun.hxx.in b/hash_fun.hxx.in index 6f787ddc569a209b31db50c659ef733dbd540893..ed758048f93299dd0aa5a13e9a925d6345378d8e 100644 --- a/hash_fun.hxx.in +++ b/hash_fun.hxx.in @@ -39,7 +39,7 @@ #include <@KWSYS_NAMESPACE@/Configure.hxx> #include <@KWSYS_NAMESPACE@/cstddef> // size_t -#include <@KWSYS_NAMESPACE@/stl/string> // string +#include <string> namespace @KWSYS_NAMESPACE@ { @@ -66,14 +66,14 @@ struct hash<const char*> { }; @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()); } + struct hash<std::string> { + 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<const @KWSYS_NAMESPACE@_stl::string> { - size_t operator()(const @KWSYS_NAMESPACE@_stl::string & __s) const { return _stl_hash_string(__s.c_str()); } + struct hash<const std::string> { + size_t operator()(const std::string & __s) const { return _stl_hash_string(__s.c_str()); } }; #endif diff --git a/hash_map.hxx.in b/hash_map.hxx.in index 6d4379d8e7b6f2c333c28f5b113275e120360ffe..53ac4de051b8ece5e58291eaefecc078084d24a8 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 <functional> // 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 <class T1, class T2> struct hash_select1st: - public @KWSYS_NAMESPACE@_stl::unary_function<@KWSYS_NAMESPACE@_stl::pair<T1, T2>, T1> + public std::unary_function<std::pair<T1, T2>, T1> { - const T1& operator()(const @KWSYS_NAMESPACE@_stl::pair<T1, T2>& __x) const + const T1& operator()(const std::pair<T1, T2>& __x) const { return __x.first; } }; @@ -68,7 +68,7 @@ struct hash_select1st: template <class _Key, class _Tp, class _HashFcn = hash<_Key>, - class _EqualKey = @KWSYS_NAMESPACE@_stl::equal_to<_Key>, + class _EqualKey = std::equal_to<_Key>, class _Alloc = @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(char) > class hash_map; @@ -81,7 +81,7 @@ template <class _Key, class _Tp, class _HashFcn, class _EqualKey, class hash_map { private: - typedef hashtable<@KWSYS_NAMESPACE@_stl::pair<const _Key,_Tp>,_Key,_HashFcn, + typedef hashtable<std::pair<const _Key,_Tp>,_Key,_HashFcn, hash_select1st<const _Key,_Tp>,_EqualKey,_Alloc> _Ht; _Ht _M_ht; @@ -189,7 +189,7 @@ public: const_iterator end() const { return _M_ht.end(); } public: - @KWSYS_NAMESPACE@_stl::pair<iterator,bool> insert(const value_type& __obj) + std::pair<iterator,bool> insert(const value_type& __obj) { return _M_ht.insert_unique(__obj); } #if @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES template <class _InputIterator> @@ -202,7 +202,7 @@ public: void insert(const_iterator __f, const_iterator __l) { _M_ht.insert_unique(__f, __l); } #endif - @KWSYS_NAMESPACE@_stl::pair<iterator,bool> insert_noresize(const value_type& __obj) + std::pair<iterator,bool> 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 +215,9 @@ public: size_type count(const key_type& __key) const { return _M_ht.count(__key); } - @KWSYS_NAMESPACE@_stl::pair<iterator, iterator> equal_range(const key_type& __key) + std::pair<iterator, iterator> equal_range(const key_type& __key) { return _M_ht.equal_range(__key); } - @KWSYS_NAMESPACE@_stl::pair<const_iterator, const_iterator> + std::pair<const_iterator, const_iterator> equal_range(const key_type& __key) const { return _M_ht.equal_range(__key); } @@ -260,7 +260,7 @@ swap(hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1, template <class _Key, class _Tp, class _HashFcn = hash<_Key>, - class _EqualKey = @KWSYS_NAMESPACE@_stl::equal_to<_Key>, + class _EqualKey = std::equal_to<_Key>, class _Alloc = @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(char) > class hash_multimap; @@ -274,7 +274,7 @@ template <class _Key, class _Tp, class _HashFcn, class _EqualKey, class hash_multimap { private: - typedef hashtable<@KWSYS_NAMESPACE@_stl::pair<const _Key, _Tp>, _Key, _HashFcn, + typedef hashtable<std::pair<const _Key, _Tp>, _Key, _HashFcn, hash_select1st<const _Key, _Tp>, _EqualKey, _Alloc> _Ht; _Ht _M_ht; @@ -405,9 +405,9 @@ public: size_type count(const key_type& __key) const { return _M_ht.count(__key); } - @KWSYS_NAMESPACE@_stl::pair<iterator, iterator> equal_range(const key_type& __key) + std::pair<iterator, iterator> equal_range(const key_type& __key) { return _M_ht.equal_range(__key); } - @KWSYS_NAMESPACE@_stl::pair<const_iterator, const_iterator> + std::pair<const_iterator, const_iterator> 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 5ee01a594314cb16e643c96baac9bc55bff0274e..5b6bb855e2af51570b8ab4b12dfd18c85006366f 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 <functional> // 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 <class _Tp> -struct _Identity : public @KWSYS_NAMESPACE@_stl::unary_function<_Tp,_Tp> +struct _Identity : public std::unary_function<_Tp,_Tp> { const _Tp& operator()(const _Tp& __x) const { return __x; } }; @@ -66,7 +66,7 @@ struct _Identity : public @KWSYS_NAMESPACE@_stl::unary_function<_Tp,_Tp> template <class _Value, class _HashFcn = hash<_Value>, - class _EqualKey = @KWSYS_NAMESPACE@_stl::equal_to<_Value>, + class _EqualKey = std::equal_to<_Value>, class _Alloc = @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(char) > class hash_set; @@ -184,11 +184,11 @@ public: iterator end() const { return _M_ht.end(); } public: - @KWSYS_NAMESPACE@_stl::pair<iterator, bool> insert(const value_type& __obj) + std::pair<iterator, bool> insert(const value_type& __obj) { typedef typename _Ht::iterator _Ht_iterator; - @KWSYS_NAMESPACE@_stl::pair<_Ht_iterator, bool> __p = _M_ht.insert_unique(__obj); - return @KWSYS_NAMESPACE@_stl::pair<iterator,bool>(__p.first, __p.second); + std::pair<_Ht_iterator, bool> __p = _M_ht.insert_unique(__obj); + return std::pair<iterator,bool>(__p.first, __p.second); } #if @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES template <class _InputIterator> @@ -201,19 +201,19 @@ public: void insert(const_iterator __f, const_iterator __l) {_M_ht.insert_unique(__f, __l); } #endif - @KWSYS_NAMESPACE@_stl::pair<iterator, bool> insert_noresize(const value_type& __obj) + std::pair<iterator, bool> 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<iterator, bool>(__p.first, __p.second); + return std::pair<iterator, bool>(__p.first, __p.second); } iterator find(const key_type& __key) const { return _M_ht.find(__key); } size_type count(const key_type& __key) const { return _M_ht.count(__key); } - @KWSYS_NAMESPACE@_stl::pair<iterator, iterator> equal_range(const key_type& __key) const + std::pair<iterator, iterator> equal_range(const key_type& __key) const { return _M_ht.equal_range(__key); } size_type erase(const key_type& __key) {return _M_ht.erase(__key); } @@ -254,7 +254,7 @@ swap(hash_set<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1, template <class _Value, class _HashFcn = hash<_Value>, - class _EqualKey = @KWSYS_NAMESPACE@_stl::equal_to<_Value>, + class _EqualKey = std::equal_to<_Value>, class _Alloc = @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(char) > class hash_multiset; @@ -393,7 +393,7 @@ public: size_type count(const key_type& __key) const { return _M_ht.count(__key); } - @KWSYS_NAMESPACE@_stl::pair<iterator, iterator> equal_range(const key_type& __key) const + std::pair<iterator, iterator> equal_range(const key_type& __key) const { return _M_ht.equal_range(__key); } size_type erase(const key_type& __key) {return _M_ht.erase(__key); } diff --git a/hashtable.hxx.in b/hashtable.hxx.in index 7e7dc4259ab84540d1a3c36e23401d84ac584165..7766bf1ad3c45b766626c77785445fbdf8844474 100644 --- a/hashtable.hxx.in +++ b/hashtable.hxx.in @@ -45,12 +45,12 @@ #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 <algorithm> // lower_bound +#include <functional> // unary_function +#include <iterator> // iterator_traits +#include <memory> // allocator +#include <utility> // pair +#include <vector> // vector #if defined(_MSC_VER) # pragma warning (push) @@ -74,11 +74,11 @@ #endif #if @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_TEMPLATE -# define @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(T) @KWSYS_NAMESPACE@_stl::allocator< T > +# define @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(T) std::allocator< T > #elif @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_NONTEMPLATE -# define @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(T) @KWSYS_NAMESPACE@_stl::allocator +# define @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(T) std::allocator #else -# define @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(T) @KWSYS_NAMESPACE@_stl::alloc +# define @KWSYS_NAMESPACE@_HASH_DEFAULT_ALLOCATOR(T) std::alloc #endif #if @KWSYS_NAMESPACE@_STL_HAS_ALLOCATOR_OBJECTS @@ -341,7 +341,7 @@ struct _Hashtable_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; @@ -378,7 +378,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 +427,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; } @@ -477,7 +477,7 @@ public: 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; + typedef std::vector<_Node*,_M_node_ptr_allocator_type> _M_buckets_type; #else public: typedef hash_allocator<_Val, _Alloc> allocator_type; @@ -489,7 +489,7 @@ private: # else typedef _Alloc _M_node_ptr_allocator_type; # endif - typedef @KWSYS_NAMESPACE@_stl::vector<_Node*,_M_node_ptr_allocator_type> _M_buckets_type; + typedef std::vector<_Node*,_M_node_ptr_allocator_type> _M_buckets_type; #endif private: @@ -576,11 +576,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() @@ -621,7 +621,7 @@ public: return __result; } - @KWSYS_NAMESPACE@_stl::pair<iterator, bool> insert_unique(const value_type& __obj) + std::pair<iterator, bool> insert_unique(const value_type& __obj) { resize(_M_num_elements + 1); return insert_unique_noresize(__obj); @@ -633,18 +633,18 @@ public: return insert_equal_noresize(__obj); } - @KWSYS_NAMESPACE@_stl::pair<iterator, bool> insert_unique_noresize(const value_type& __obj); + std::pair<iterator, bool> insert_unique_noresize(const value_type& __obj); iterator insert_equal_noresize(const value_type& __obj); #if @KWSYS_NAMESPACE@_STL_HAS_ITERATOR_TRAITS # define @KWSYS_NAMESPACE@_HASH_ITERATOR_CATEGORY(T,I) \ - typename @KWSYS_NAMESPACE@_stl::iterator_traits< T >::iterator_category() + typename std::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 ) + std::iterator_category( I ) #elif @KWSYS_NAMESPACE@_STL_HAS___ITERATOR_CATEGORY # define @KWSYS_NAMESPACE@_HASH_ITERATOR_CATEGORY(T,I) \ - @KWSYS_NAMESPACE@_stl::__iterator_category( I ) + std::__iterator_category( I ) #endif #if @KWSYS_NAMESPACE@_CXX_HAS_MEMBER_TEMPLATES && defined(@KWSYS_NAMESPACE@_HASH_ITERATOR_CATEGORY) @@ -664,7 +664,7 @@ public: template <class _InputIterator> 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 +672,7 @@ public: template <class _InputIterator> 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 +680,10 @@ public: template <class _ForwardIterator> 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,10 +691,10 @@ public: template <class _ForwardIterator> 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); @@ -720,7 +720,7 @@ public: void insert_unique(const_iterator __f, const_iterator __l) { 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); @@ -729,7 +729,7 @@ public: void insert_equal(const_iterator __f, const_iterator __l) { 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); @@ -771,10 +771,10 @@ public: return __result; } - @KWSYS_NAMESPACE@_stl::pair<iterator, iterator> + std::pair<iterator, iterator> equal_range(const key_type& __key); - @KWSYS_NAMESPACE@_stl::pair<const_iterator, const_iterator> + std::pair<const_iterator, const_iterator> equal_range(const key_type& __key) const; size_type erase(const key_type& __key); @@ -936,7 +936,7 @@ inline void swap(hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht1, } template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> -@KWSYS_NAMESPACE@_stl::pair<@KWSYS_NAMESPACE@_CXX_DECL_TYPENAME hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator, bool> +std::pair<@KWSYS_NAMESPACE@_CXX_DECL_TYPENAME hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator, bool> hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> ::insert_unique_noresize(const value_type& __obj) { @@ -945,13 +945,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, bool>(iterator(__cur, this), false); + return std::pair<iterator, bool>(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, bool>(iterator(__tmp, this), true); + return std::pair<iterator, bool>(iterator(__tmp, this), true); } template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> @@ -999,11 +999,11 @@ hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::find_or_insert(const value_type& __obj) } template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> -@KWSYS_NAMESPACE@_stl::pair<@KWSYS_NAMESPACE@_CXX_DECL_TYPENAME hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator, +std::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> hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::equal_range(const key_type& __key) { - typedef @KWSYS_NAMESPACE@_stl::pair<iterator, iterator> _Pii; + typedef std::pair<iterator, iterator> _Pii; const size_type __n = _M_bkt_num_key(__key); for (_Node* __first = _M_buckets[__n]; __first; __first = __first->_M_next) @@ -1021,12 +1021,12 @@ hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::equal_range(const key_type& __key) } template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All> -@KWSYS_NAMESPACE@_stl::pair<@KWSYS_NAMESPACE@_CXX_DECL_TYPENAME hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::const_iterator, +std::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> hashtable<_Val,_Key,_HF,_Ex,_Eq,_All> ::equal_range(const key_type& __key) const { - typedef @KWSYS_NAMESPACE@_stl::pair<const_iterator, const_iterator> _Pii; + typedef std::pair<const_iterator, const_iterator> _Pii; const size_type __n = _M_bkt_num_key(__key); for (const _Node* __first = _M_buckets[__n] ; diff --git a/kwsysPlatformTestsCXX.cxx b/kwsysPlatformTestsCXX.cxx index d6e755bf1f819d8ea12dc888aae08f4282583fa9..5ff4652e799cebfa1eacfe3e4de9317262a3f533 100644 --- a/kwsysPlatformTestsCXX.cxx +++ b/kwsysPlatformTestsCXX.cxx @@ -9,21 +9,6 @@ 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 - -#ifdef TEST_KWSYS_STL_HAVE_STD -#include <list> -void f(std ::list<int>*) {} -int main() { return 0; } -#endif - #ifdef TEST_KWSYS_CXX_HAS_CSTDIO #include <cstdio> int main() { return 0; } @@ -119,21 +104,21 @@ int main() #ifdef TEST_KWSYS_STL_HAS_ITERATOR_TRAITS #include <iterator> #include <list> -void f(kwsys_stl::iterator_traits<kwsys_stl::list<int>::iterator>::iterator_category const&) {} +void f(std::iterator_traits<std::list<int>::iterator>::iterator_category const&) {} int main() { return 0; } #endif #ifdef TEST_KWSYS_STL_HAS_ITERATOR_CATEGORY #include <iterator> #include <list> -void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::iterator_category(x); } +void f(std::list<int>::iterator x) { std::iterator_category(x); } int main() { return 0; } #endif #ifdef TEST_KWSYS_STL_HAS___ITERATOR_CATEGORY #include <iterator> #include <list> -void f(kwsys_stl::list<int>::iterator x) { kwsys_stl::__iterator_category(x); } +void f(std::list<int>::iterator x) { std::__iterator_category(x); } int main() { return 0; } #endif @@ -146,14 +131,14 @@ void f(const Alloc&) } int main() { - f(kwsys_stl::allocator<char>()); + f(std::allocator<char>()); return 0; } #endif #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE #include <memory> -void f(kwsys_stl::allocator::size_type const&) {} +void f(std::allocator::size_type const&) {} int main() { return 0; } #endif @@ -166,33 +151,33 @@ void f(const T&, const Alloc&) } int main() { - f(0, kwsys_stl::allocator<char>()); + f(0, std::allocator<char>()); return 0; } #endif #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT #include <memory> -void f(kwsys_stl::allocator<char> const& a) +void f(std::allocator<char> const& a) { a.max_size(sizeof(int)); } int main() { - f(kwsys_stl::allocator<char>()); + f(std::allocator<char>()); return 0; } #endif #ifdef TEST_KWSYS_STL_HAS_ALLOCATOR_OBJECTS #include <vector> -void f(kwsys_stl::vector<int> const& v1) +void f(std::vector<int> const& v1) { - kwsys_stl::vector<int>(1, 1, v1.get_allocator()); + std::vector<int>(1, 1, v1.get_allocator()); } int main() { - f(kwsys_stl::vector<int>()); + f(std::vector<int>()); return 0; } #endif diff --git a/kwsys_stl.hxx.in b/kwsys_stl.hxx.in deleted file mode 100644 index b448d8ad132f923860e557a00fad490746d7847e..0000000000000000000000000000000000000000 --- a/kwsys_stl.hxx.in +++ /dev/null @@ -1,48 +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 - -#endif diff --git a/testCommandLineArguments.cxx b/testCommandLineArguments.cxx index ab8257f1b60092bee48f5b4f15b0964684082d9d..525522dca920b9510d415759e771adbe7d2ff085 100644 --- a/testCommandLineArguments.cxx +++ b/testCommandLineArguments.cxx @@ -11,7 +11,6 @@ ============================================================================*/ #include "kwsysPrivate.h" #include KWSYS_HEADER(CommandLineArguments.hxx) -#include KWSYS_HEADER(stl/vector) // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. @@ -20,6 +19,7 @@ #endif #include <iostream> +#include <vector> #include <stddef.h> /* size_t */ #include <string.h> /* strcmp */ @@ -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<int> numbers_argument; + std::vector<int> numbers_argument; int valid_numbers[] = { 5, 1, 8, 3, 7, 1, 3, 9, 7, 1 }; - kwsys_stl::vector<double> doubles_argument; + std::vector<double> doubles_argument; double valid_doubles[] = { 12.5, 1.31, 22 }; - kwsys_stl::vector<bool> bools_argument; + std::vector<bool> bools_argument; bool valid_bools[] = { true, true, false }; - kwsys_stl::vector<char*> strings_argument; + std::vector<char*> strings_argument; const char* valid_strings[] = { "andy", "bill", "brad", "ken" }; - kwsys_stl::vector<kwsys_stl::string> stl_strings_argument; - kwsys_stl::string valid_stl_strings[] = { "ken", "brad", "bill", "andy" }; + std::vector<std::string> stl_strings_argument; + std::string valid_stl_strings[] = { "ken", "brad", "bill", "andy" }; typedef kwsys::CommandLineArguments argT; diff --git a/testCommandLineArguments1.cxx b/testCommandLineArguments1.cxx index 1ae2cb1dfa7c7a74bf18c290f893985be4411b57..6eb465d81a6a0c0d0cd83e4747850fff7586fe23 100644 --- a/testCommandLineArguments1.cxx +++ b/testCommandLineArguments1.cxx @@ -11,7 +11,6 @@ ============================================================================*/ #include "kwsysPrivate.h" #include KWSYS_HEADER(CommandLineArguments.hxx) -#include KWSYS_HEADER(stl/vector) // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. @@ -20,6 +19,8 @@ #endif #include <iostream> +#include <vector> + #include <assert.h> /* assert */ #include <string.h> /* strcmp */ @@ -30,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; diff --git a/testDynamicLoader.cxx b/testDynamicLoader.cxx index 9c1a2b5bdb6e6baa3264327040228c891c6075fb..695a134d24da8e5dd3d0576257132d14d50bd4e8 100644 --- a/testDynamicLoader.cxx +++ b/testDynamicLoader.cxx @@ -12,7 +12,6 @@ #include "kwsysPrivate.h" #include KWSYS_HEADER(DynamicLoader.hxx) -#include KWSYS_HEADER(stl/string) #if defined(__BEOS__) || defined(__HAIKU__) #include <be/kernel/OS.h> /* disable_debugger() API. */ @@ -24,16 +23,17 @@ # include "DynamicLoader.hxx.in" #endif +#include <string> #include <iostream> // Include with <> instead of "" to avoid getting any in-source copy // left on disk. #include <testSystemTools.h> -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 += "/"; @@ -117,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/testIOS.cxx b/testIOS.cxx index 7597dae4e9231c7b1baf69ff1ac6fb1dc39705cf..396a09d47d01ec6e9c70b9991b3bdde0a2b5a5be 100644 --- a/testIOS.cxx +++ b/testIOS.cxx @@ -10,17 +10,12 @@ See the License for more information. ============================================================================*/ #include "kwsysPrivate.h" -#include KWSYS_HEADER(stl/vector) - -// Work-around CMake dependency scanning limitation. This must -// duplicate the above list of headers. -#if 0 -# include "kwsys_stl_vector.h.in" -#endif +#include KWSYS_HEADER(Configure.hxx) #include <sstream> #include <fstream> #include <iostream> +#include <vector> #include <string.h> /* strlen */ int testIOS(int, char*[]) @@ -55,7 +50,7 @@ int testIOS(int, char*[]) } std::istringstream istr(" 10 20 str "); - kwsys_stl::string s; + std::string s; int x; if(istr >> x) { diff --git a/testSystemTools.cxx b/testSystemTools.cxx index d4852b250ed0058005baaf7561a55aae250367b4..e14d2fc4e43396e3d83eb43eea45a65791efd5db 100644 --- a/testSystemTools.cxx +++ b/testSystemTools.cxx @@ -62,10 +62,10 @@ 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 ) { @@ -86,12 +86,12 @@ 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) { @@ -108,17 +108,17 @@ 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) @@ -317,7 +317,7 @@ static bool CheckFileOperations() 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(); @@ -326,7 +326,7 @@ static bool CheckFileOperations() 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(); @@ -348,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" @@ -404,7 +404,7 @@ 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.") { std::cerr @@ -535,7 +535,7 @@ static bool CheckStringOperations() res = false; } - kwsys_stl::vector<kwsys_stl::string> lines; + std::vector<std::string> 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.") @@ -691,7 +691,7 @@ 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)) { @@ -743,11 +743,11 @@ 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) { std::cerr << "RelativePath(" << local << ", " << remote @@ -769,10 +769,10 @@ 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) { std::cerr << "CollapseFullPath(" << path @@ -802,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";