From 10511aa0849936df3724556f1f42fc3e4cf43f9f Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Sun, 10 Feb 2013 17:49:42 +0100 Subject: [PATCH] automoc: use a std::vector<> instead a std::list Alex --- Source/cmQtAutomoc.cxx | 23 ++++++++++++----------- Source/cmQtAutomoc.h | 10 +++++----- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx index cc421751e..8a2d308fb 100644 --- a/Source/cmQtAutomoc.cxx +++ b/Source/cmQtAutomoc.cxx @@ -44,10 +44,10 @@ static bool containsQ_OBJECT(const std::string& text) static std::string findMatchingHeader(const std::string& absPath, const std::string& mocSubDir, const std::string& basename, - const std::list& headerExtensions) + const std::vector& headerExtensions) { std::string header; - for(std::list::const_iterator ext = headerExtensions.begin(); + for(std::vector::const_iterator ext = headerExtensions.begin(); ext != headerExtensions.end(); ++ext) { @@ -528,7 +528,7 @@ bool cmQtAutomoc::RunAutomoc() std::vector sourceFiles; cmSystemTools::ExpandListArgument(this->Sources, sourceFiles); - std::list headerExtensions; + std::vector headerExtensions; headerExtensions.push_back(".h"); headerExtensions.push_back(".hpp"); headerExtensions.push_back(".hxx"); @@ -643,7 +643,7 @@ bool cmQtAutomoc::RunAutomoc() void cmQtAutomoc::ParseCppFile(const std::string& absFilename, - const std::list& headerExtensions, + const std::vector& headerExtensions, std::map& includedMocs) { cmsys::RegularExpression mocIncludeRegExp( @@ -821,7 +821,7 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename, void cmQtAutomoc::StrictParseCppFile(const std::string& absFilename, - const std::list& headerExtensions, + const std::vector& headerExtensions, std::map& includedMocs) { cmsys::RegularExpression mocIncludeRegExp( @@ -932,8 +932,8 @@ void cmQtAutomoc::StrictParseCppFile(const std::string& absFilename, void cmQtAutomoc::SearchHeadersForCppFile(const std::string& absFilename, - const std::list& headerExtensions, - std::set& absHeaders) + const std::vector& headerExtensions, + std::set& absHeaders) { // search for header files and private header files we may need to moc: const std::string basename = @@ -941,7 +941,7 @@ void cmQtAutomoc::SearchHeadersForCppFile(const std::string& absFilename, const std::string absPath = cmsys::SystemTools::GetFilenamePath( cmsys::SystemTools::GetRealPath(absFilename.c_str())) + '/'; - for(std::list::const_iterator ext = headerExtensions.begin(); + for(std::vector::const_iterator ext = headerExtensions.begin(); ext != headerExtensions.end(); ++ext) { @@ -952,7 +952,7 @@ void cmQtAutomoc::SearchHeadersForCppFile(const std::string& absFilename, break; } } - for(std::list::const_iterator ext = headerExtensions.begin(); + for(std::vector::const_iterator ext = headerExtensions.begin(); ext != headerExtensions.end(); ++ext) { @@ -1077,7 +1077,8 @@ bool cmQtAutomoc::GenerateMoc(const std::string& sourceFile, } -std::string cmQtAutomoc::Join(const std::list& lst,char separator) +std::string cmQtAutomoc::Join(const std::vector& lst, + char separator) { if (lst.empty()) { @@ -1085,7 +1086,7 @@ std::string cmQtAutomoc::Join(const std::list& lst,char separator) } std::string result; - for (std::list::const_iterator it = lst.begin(); + for (std::vector::const_iterator it = lst.begin(); it != lst.end(); ++it) { diff --git a/Source/cmQtAutomoc.h b/Source/cmQtAutomoc.h index a73747781..ea30b1595 100644 --- a/Source/cmQtAutomoc.h +++ b/Source/cmQtAutomoc.h @@ -41,14 +41,14 @@ private: bool GenerateMoc(const std::string& sourceFile, const std::string& mocFileName); void ParseCppFile(const std::string& absFilename, - const std::list& headerExtensions, + const std::vector& headerExtensions, std::map& includedMocs); void StrictParseCppFile(const std::string& absFilename, - const std::list& headerExtensions, + const std::vector& headerExtensions, std::map& includedMocs); void SearchHeadersForCppFile(const std::string& absFilename, - const std::list& headerExtensions, - std::set& absHeaders); + const std::vector& headerExtensions, + std::set& absHeaders); void ParseHeaders(const std::set& absHeaders, const std::map& includedMocs, @@ -56,7 +56,7 @@ private: void Init(); - std::string Join(const std::list& lst, char separator); + std::string Join(const std::vector& lst, char separator); bool EndsWith(const std::string& str, const std::string& with); bool StartsWith(const std::string& str, const std::string& with); std::string ReadAll(const std::string& filename);