aboutsummaryrefslogtreecommitdiff
path: root/src/support/filesystem_context.cc
diff options
context:
space:
mode:
authorAdrian Kummerländer2014-04-21 13:30:23 +0200
committerAdrian Kummerländer2014-04-21 13:30:23 +0200
commitcdf4ad3486debe75fe89b2f04bb62541f3ac8405 (patch)
treeb09b380ca22abe5678079f86420c748dcd82c70d /src/support/filesystem_context.cc
parent5f4f3f003e1f08e5495e0fe30fae18eb6029888d (diff)
downloadInputXSLT-cdf4ad3486debe75fe89b2f04bb62541f3ac8405.tar
InputXSLT-cdf4ad3486debe75fe89b2f04bb62541f3ac8405.tar.gz
InputXSLT-cdf4ad3486debe75fe89b2f04bb62541f3ac8405.tar.bz2
InputXSLT-cdf4ad3486debe75fe89b2f04bb62541f3ac8405.tar.lz
InputXSLT-cdf4ad3486debe75fe89b2f04bb62541f3ac8405.tar.xz
InputXSLT-cdf4ad3486debe75fe89b2f04bb62541f3ac8405.tar.zst
InputXSLT-cdf4ad3486debe75fe89b2f04bb62541f3ac8405.zip
Extracted filesystem path resolution into InputXSLT::FilesystemContext
* this class provides methods for resolving paths relative to the contained base path * other filesystem interaction methods will also be implemented in this class ** for instance directory traversal
Diffstat (limited to 'src/support/filesystem_context.cc')
-rw-r--r--src/support/filesystem_context.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/support/filesystem_context.cc b/src/support/filesystem_context.cc
new file mode 100644
index 0000000..d3f9614
--- /dev/null
+++ b/src/support/filesystem_context.cc
@@ -0,0 +1,24 @@
+#include "filesystem_context.h"
+
+namespace InputXSLT {
+
+FilesystemContext::FilesystemContext(const std::string& path):
+ path_(path) { }
+
+boost::filesystem::path FilesystemContext::resolve(
+ const std::string& path) const {
+ return boost::filesystem::path(this->path_ / path);
+}
+
+boost::filesystem::path FilesystemContext::resolve(
+ const xalan::XalanDOMString& path) const {
+ xalan::CharVectorType castHelper;
+ path.transcode(castHelper);
+
+ return this->resolve(std::string(
+ castHelper.begin(),
+ castHelper.end()
+ ));
+}
+
+}