diff options
author | Pavel Solodovnikov <hellyeahdominate@gmail.com> | 2017-09-11 13:40:26 +0300 |
---|---|---|
committer | Pavel Solodovnikov <hellyeahdominate@gmail.com> | 2017-09-12 16:22:47 +0300 |
commit | 7d5095796ab616cf9b709036387bb95ab9984141 (patch) | |
tree | c010e922adad95ef86ab4a3ac2a3abd63e9f33ef /Source/cmFileMonitor.cxx | |
parent | 00975e926199eea21763470e2ab876246e36669a (diff) | |
download | cmake-7d5095796ab616cf9b709036387bb95ab9984141.tar.gz |
Meta: modernize old-fashioned loops to range-based `for`.
Changes done via `clang-tidy` with some manual fine-tuning
for the variable naming and `auto` type deduction
where appropriate.
Diffstat (limited to 'Source/cmFileMonitor.cxx')
-rw-r--r-- | Source/cmFileMonitor.cxx | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/Source/cmFileMonitor.cxx b/Source/cmFileMonitor.cxx index c0401d7013..04a3c0ef71 100644 --- a/Source/cmFileMonitor.cxx +++ b/Source/cmFileMonitor.cxx @@ -49,8 +49,8 @@ public: int status) const final { if (pathSegment.empty()) { - for (const auto& i : this->Children) { - i.second->Trigger(std::string(), events, status); + for (auto const& child : this->Children) { + child.second->Trigger(std::string(), events, status); } } else { const auto i = this->Children.find(pathSegment); @@ -62,24 +62,24 @@ public: void StartWatching() override { - for (const auto& i : this->Children) { - i.second->StartWatching(); + for (auto const& child : this->Children) { + child.second->StartWatching(); } } void StopWatching() override { - for (const auto& i : this->Children) { - i.second->StopWatching(); + for (auto const& child : this->Children) { + child.second->StopWatching(); } } std::vector<std::string> WatchedFiles() const final { std::vector<std::string> result; - for (const auto& i : this->Children) { - for (const auto& j : i.second->WatchedFiles()) { - result.push_back(j); + for (auto const& child : this->Children) { + for (std::string const& f : child.second->WatchedFiles()) { + result.push_back(f); } } return result; @@ -88,9 +88,9 @@ public: std::vector<std::string> WatchedDirectories() const override { std::vector<std::string> result; - for (const auto& i : this->Children) { - for (const auto& j : i.second->WatchedDirectories()) { - result.push_back(j); + for (auto const& child : this->Children) { + for (std::string const& dir : child.second->WatchedDirectories()) { + result.push_back(dir); } } return result; @@ -184,8 +184,9 @@ public: std::vector<std::string> WatchedDirectories() const override { std::vector<std::string> result = { Path() }; - for (const auto& j : cmVirtualDirectoryWatcher::WatchedDirectories()) { - result.push_back(j); + for (std::string const& dir : + cmVirtualDirectoryWatcher::WatchedDirectories()) { + result.push_back(dir); } return result; } @@ -267,7 +268,7 @@ public: static_cast<void>(ps); const std::string path = this->Path(); - for (const auto& cb : this->CbList) { + for (cmFileMonitor::Callback const& cb : this->CbList) { cb(path, events, status); } } @@ -311,7 +312,7 @@ cmFileMonitor::~cmFileMonitor() void cmFileMonitor::MonitorPaths(const std::vector<std::string>& paths, Callback const& cb) { - for (const auto& p : paths) { + for (std::string const& p : paths) { std::vector<std::string> pathSegments; cmsys::SystemTools::SplitPath(p, pathSegments, true); |