aboutsummaryrefslogtreecommitdiff
path: root/src/support
diff options
context:
space:
mode:
authorAdrian Kummerländer2014-05-04 20:49:37 +0200
committerAdrian Kummerländer2014-05-04 20:49:37 +0200
commitbd24e3fe6335bc776400be6bcb44a0701ecc4133 (patch)
tree748364b36990e1fe949a3826ff6e878c2f14f9fb /src/support
parenta0ddbb0ccba20123fc4e8243d962f86232282612 (diff)
downloadInputXSLT-bd24e3fe6335bc776400be6bcb44a0701ecc4133.tar
InputXSLT-bd24e3fe6335bc776400be6bcb44a0701ecc4133.tar.gz
InputXSLT-bd24e3fe6335bc776400be6bcb44a0701ecc4133.tar.bz2
InputXSLT-bd24e3fe6335bc776400be6bcb44a0701ecc4133.tar.lz
InputXSLT-bd24e3fe6335bc776400be6bcb44a0701ecc4133.tar.xz
InputXSLT-bd24e3fe6335bc776400be6bcb44a0701ecc4133.tar.zst
InputXSLT-bd24e3fe6335bc776400be6bcb44a0701ecc4133.zip
Moved DOM document construction logic into local functions
* this change makes the underlying similarity between all currently implemented external functions obvious * they more or less only differ in their document construction logic ** i.e. there is a possibility for a second layer of abstraction between the classes derived from xalan::Function and the actual functionality * added boost::filesystem::path taking overload of the _iterate_ member method to FilesystemGuard ** this overload functions as the _master_ overload that is called by all other overloads which merely perform type conversion and path resolution ** this overload doesn't perform path resolution
Diffstat (limited to 'src/support')
-rw-r--r--src/support/filesystem_context.cc11
-rw-r--r--src/support/filesystem_context.h2
2 files changed, 10 insertions, 3 deletions
diff --git a/src/support/filesystem_context.cc b/src/support/filesystem_context.cc
index 32646be..418d159 100644
--- a/src/support/filesystem_context.cc
+++ b/src/support/filesystem_context.cc
@@ -36,11 +36,9 @@ boost::filesystem::path FilesystemContext::resolve(
}
void FilesystemContext::iterate(
- const std::string& path,
+ const boost::filesystem::path& directory,
std::function<void(const boost::filesystem::path&)> func
) const {
- const boost::filesystem::path directory(this->resolve(path));
-
if ( boost::filesystem::is_directory(directory) ) {
for ( boost::filesystem::directory_iterator iter(directory);
iter != boost::filesystem::directory_iterator();
@@ -54,6 +52,13 @@ void FilesystemContext::iterate(
}
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 {
diff --git a/src/support/filesystem_context.h b/src/support/filesystem_context.h
index f743c89..05d5862 100644
--- a/src/support/filesystem_context.h
+++ b/src/support/filesystem_context.h
@@ -20,6 +20,8 @@ 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&,