From 1f90b8086fcad7ac033e76a96bf102db7c15e44f Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Tue, 5 Oct 2021 20:33:16 +0200 Subject: drop 'using namespace std' in s* + toolkit Change-Id: Ibd0b983d46a5683df64b4de79cd444427705e9e3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123118 Tested-by: Jenkins Reviewed-by: Julien Nabet --- soltools/mkdepend/collectdircontent.cxx | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'soltools') diff --git a/soltools/mkdepend/collectdircontent.cxx b/soltools/mkdepend/collectdircontent.cxx index 7ea5fa272de9..c5e910c2e7bf 100644 --- a/soltools/mkdepend/collectdircontent.cxx +++ b/soltools/mkdepend/collectdircontent.cxx @@ -2,22 +2,20 @@ #include "collectdircontent.hxx" #include -using namespace std; - -PathFilePair IncludesCollection::split_path(const string& filePath) { - string sepU = "/"; - string sepW = "\\"; - string::size_type pos = filePath.rfind (sepU); - string::size_type posW = filePath.rfind (sepW); - if ((posW != string::npos) && ((posW > pos) || (pos == string::npos))) pos = posW; - if (pos != string::npos) { - string dirName = filePath.substr(0, pos); +PathFilePair IncludesCollection::split_path(const std::string& filePath) { + std::string sepU = "/"; + std::string sepW = "\\"; + std::string::size_type pos = filePath.rfind (sepU); + std::string::size_type posW = filePath.rfind (sepW); + if ((posW != std::string::npos) && ((posW > pos) || (pos == std::string::npos))) pos = posW; + if (pos != std::string::npos) { + std::string dirName = filePath.substr(0, pos); return PathFilePair(dirName, filePath.substr(pos + 1, filePath.length())); } else return PathFilePair(".", filePath); } -void IncludesCollection::add_to_collection(const string& dirPath) { +void IncludesCollection::add_to_collection(const std::string& dirPath) { DirContent dirContent; #if defined(_WIN32) WIN32_FIND_DATA FindFileData; @@ -29,7 +27,7 @@ void IncludesCollection::add_to_collection(const string& dirPath) { return; } do { - string winFileName(FindFileData.cFileName); + std::string winFileName(FindFileData.cFileName); transform( winFileName.begin(), winFileName.end(), winFileName.begin(), [](char c) { @@ -54,7 +52,7 @@ void IncludesCollection::add_to_collection(const string& dirPath) { allIncludes.insert(EntriesPair(dirPath, dirContent)); } -bool IncludesCollection::exists(string filePath) { +bool IncludesCollection::exists(std::string filePath) { #if defined(_WIN32) transform( filePath.begin(), filePath.end(), filePath.begin(), @@ -63,8 +61,8 @@ bool IncludesCollection::exists(string filePath) { }); #endif // defined( _WIN32 ) PathFilePair dirFile = split_path(filePath); - string dirPath = dirFile.first; - string fileName = dirFile.second; + std::string dirPath = dirFile.first; + std::string fileName = dirFile.second; DirMap::iterator mapIter = allIncludes.find(dirPath); if (mapIter == allIncludes.end()) { add_to_collection(dirPath); -- cgit