automoc: use a std::vector<> instead a std::list

Alex
This commit is contained in:
Alex Neundorf 2013-02-10 17:49:42 +01:00
parent 12806779be
commit 10511aa084
2 changed files with 17 additions and 16 deletions

View File

@ -44,10 +44,10 @@ static bool containsQ_OBJECT(const std::string& text)
static std::string findMatchingHeader(const std::string& absPath, static std::string findMatchingHeader(const std::string& absPath,
const std::string& mocSubDir, const std::string& mocSubDir,
const std::string& basename, const std::string& basename,
const std::list<std::string>& headerExtensions) const std::vector<std::string>& headerExtensions)
{ {
std::string header; std::string header;
for(std::list<std::string>::const_iterator ext = headerExtensions.begin(); for(std::vector<std::string>::const_iterator ext = headerExtensions.begin();
ext != headerExtensions.end(); ext != headerExtensions.end();
++ext) ++ext)
{ {
@ -528,7 +528,7 @@ bool cmQtAutomoc::RunAutomoc()
std::vector<std::string> sourceFiles; std::vector<std::string> sourceFiles;
cmSystemTools::ExpandListArgument(this->Sources, sourceFiles); cmSystemTools::ExpandListArgument(this->Sources, sourceFiles);
std::list<std::string> headerExtensions; std::vector<std::string> headerExtensions;
headerExtensions.push_back(".h"); headerExtensions.push_back(".h");
headerExtensions.push_back(".hpp"); headerExtensions.push_back(".hpp");
headerExtensions.push_back(".hxx"); headerExtensions.push_back(".hxx");
@ -643,7 +643,7 @@ bool cmQtAutomoc::RunAutomoc()
void cmQtAutomoc::ParseCppFile(const std::string& absFilename, void cmQtAutomoc::ParseCppFile(const std::string& absFilename,
const std::list<std::string>& headerExtensions, const std::vector<std::string>& headerExtensions,
std::map<std::string, std::string>& includedMocs) std::map<std::string, std::string>& includedMocs)
{ {
cmsys::RegularExpression mocIncludeRegExp( cmsys::RegularExpression mocIncludeRegExp(
@ -821,7 +821,7 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename,
void cmQtAutomoc::StrictParseCppFile(const std::string& absFilename, void cmQtAutomoc::StrictParseCppFile(const std::string& absFilename,
const std::list<std::string>& headerExtensions, const std::vector<std::string>& headerExtensions,
std::map<std::string, std::string>& includedMocs) std::map<std::string, std::string>& includedMocs)
{ {
cmsys::RegularExpression mocIncludeRegExp( cmsys::RegularExpression mocIncludeRegExp(
@ -932,7 +932,7 @@ void cmQtAutomoc::StrictParseCppFile(const std::string& absFilename,
void cmQtAutomoc::SearchHeadersForCppFile(const std::string& absFilename, void cmQtAutomoc::SearchHeadersForCppFile(const std::string& absFilename,
const std::list<std::string>& headerExtensions, const std::vector<std::string>& headerExtensions,
std::set<std::string>& absHeaders) std::set<std::string>& absHeaders)
{ {
// search for header files and private header files we may need to moc: // search for header files and private header files we may need to moc:
@ -941,7 +941,7 @@ void cmQtAutomoc::SearchHeadersForCppFile(const std::string& absFilename,
const std::string absPath = cmsys::SystemTools::GetFilenamePath( const std::string absPath = cmsys::SystemTools::GetFilenamePath(
cmsys::SystemTools::GetRealPath(absFilename.c_str())) + '/'; cmsys::SystemTools::GetRealPath(absFilename.c_str())) + '/';
for(std::list<std::string>::const_iterator ext = headerExtensions.begin(); for(std::vector<std::string>::const_iterator ext = headerExtensions.begin();
ext != headerExtensions.end(); ext != headerExtensions.end();
++ext) ++ext)
{ {
@ -952,7 +952,7 @@ void cmQtAutomoc::SearchHeadersForCppFile(const std::string& absFilename,
break; break;
} }
} }
for(std::list<std::string>::const_iterator ext = headerExtensions.begin(); for(std::vector<std::string>::const_iterator ext = headerExtensions.begin();
ext != headerExtensions.end(); ext != headerExtensions.end();
++ext) ++ext)
{ {
@ -1077,7 +1077,8 @@ bool cmQtAutomoc::GenerateMoc(const std::string& sourceFile,
} }
std::string cmQtAutomoc::Join(const std::list<std::string>& lst,char separator) std::string cmQtAutomoc::Join(const std::vector<std::string>& lst,
char separator)
{ {
if (lst.empty()) if (lst.empty())
{ {
@ -1085,7 +1086,7 @@ std::string cmQtAutomoc::Join(const std::list<std::string>& lst,char separator)
} }
std::string result; std::string result;
for (std::list<std::string>::const_iterator it = lst.begin(); for (std::vector<std::string>::const_iterator it = lst.begin();
it != lst.end(); it != lst.end();
++it) ++it)
{ {

View File

@ -41,13 +41,13 @@ private:
bool GenerateMoc(const std::string& sourceFile, bool GenerateMoc(const std::string& sourceFile,
const std::string& mocFileName); const std::string& mocFileName);
void ParseCppFile(const std::string& absFilename, void ParseCppFile(const std::string& absFilename,
const std::list<std::string>& headerExtensions, const std::vector<std::string>& headerExtensions,
std::map<std::string, std::string>& includedMocs); std::map<std::string, std::string>& includedMocs);
void StrictParseCppFile(const std::string& absFilename, void StrictParseCppFile(const std::string& absFilename,
const std::list<std::string>& headerExtensions, const std::vector<std::string>& headerExtensions,
std::map<std::string, std::string>& includedMocs); std::map<std::string, std::string>& includedMocs);
void SearchHeadersForCppFile(const std::string& absFilename, void SearchHeadersForCppFile(const std::string& absFilename,
const std::list<std::string>& headerExtensions, const std::vector<std::string>& headerExtensions,
std::set<std::string>& absHeaders); std::set<std::string>& absHeaders);
void ParseHeaders(const std::set<std::string>& absHeaders, void ParseHeaders(const std::set<std::string>& absHeaders,
@ -56,7 +56,7 @@ private:
void Init(); void Init();
std::string Join(const std::list<std::string>& lst, char separator); std::string Join(const std::vector<std::string>& lst, char separator);
bool EndsWith(const std::string& str, const std::string& with); bool EndsWith(const std::string& str, const std::string& with);
bool StartsWith(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); std::string ReadAll(const std::string& filename);