diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/support/filesystem_context.cc | 38 | ||||
-rw-r--r-- | src/support/filesystem_context.h | 20 |
2 files changed, 34 insertions, 24 deletions
diff --git a/src/support/filesystem_context.cc b/src/support/filesystem_context.cc index 8395046..a30bccc 100644 --- a/src/support/filesystem_context.cc +++ b/src/support/filesystem_context.cc @@ -29,8 +29,22 @@ boost::filesystem::path FilesystemContext::resolve( } void FilesystemContext::iterate( + const std::string& path, + const std::function<void(const boost::filesystem::path&)>& func +) const { + this->iterate(this->resolve(path), func); +} + +void FilesystemContext::iterate( + const xalan::XalanDOMString& path, + const std::function<void(const boost::filesystem::path&)>& func +) const { + this->iterate(toString(path), func); +} + +void FilesystemContext::iterate( const boost::filesystem::path& directory, - std::function<void(const boost::filesystem::path&)> func + const std::function<void(const boost::filesystem::path&)>& func ) const { std::vector<boost::filesystem::path> directoryItems; @@ -49,23 +63,11 @@ void FilesystemContext::iterate( directoryItems.end() ); - for ( auto&& item : directoryItems ) { - func(item); - } -} - -void FilesystemContext::iterate( - const std::string& path, - std::function<void(const boost::filesystem::path&)> func -) const { - this->iterate(this->resolve(path), func); -} - -void FilesystemContext::iterate( - const xalan::XalanDOMString& path, - std::function<void(const boost::filesystem::path&)> func -) const { - this->iterate(toString(path), func); + std::for_each( + directoryItems.begin(), + directoryItems.end(), + func + ); } } diff --git a/src/support/filesystem_context.h b/src/support/filesystem_context.h index 6322da6..1f574de 100644 --- a/src/support/filesystem_context.h +++ b/src/support/filesystem_context.h @@ -21,12 +21,20 @@ class FilesystemContext { boost::filesystem::path resolve(const std::string&) const; boost::filesystem::path resolve(const xalan::XalanDOMString&) const; - void iterate(const boost::filesystem::path&, - std::function<void(const boost::filesystem::path&)>) const; - void iterate(const std::string&, - std::function<void(const boost::filesystem::path&)>) const; - void iterate(const xalan::XalanDOMString&, - std::function<void(const boost::filesystem::path&)>) const; + void iterate( + const std::string&, + const std::function<void(const boost::filesystem::path&)>& + ) const; + + void iterate( + const xalan::XalanDOMString&, + const std::function<void(const boost::filesystem::path&)>& + ) const; + + void iterate( + const boost::filesystem::path&, + const std::function<void(const boost::filesystem::path&)>& + ) const; private: const boost::filesystem::path path_; |