aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerländer2014-05-23 17:08:16 +0200
committerAdrian Kummerländer2014-05-23 17:08:16 +0200
commit6ede83ca2c50353bb9f97260f0ef04234041e73b (patch)
treee505893c34559c0cdac5dea77331177952ebefb1
parent2c358ced7ca10ab37a382477d8b55fdb4e353f44 (diff)
downloadInputXSLT-6ede83ca2c50353bb9f97260f0ef04234041e73b.tar
InputXSLT-6ede83ca2c50353bb9f97260f0ef04234041e73b.tar.gz
InputXSLT-6ede83ca2c50353bb9f97260f0ef04234041e73b.tar.bz2
InputXSLT-6ede83ca2c50353bb9f97260f0ef04234041e73b.tar.lz
InputXSLT-6ede83ca2c50353bb9f97260f0ef04234041e73b.tar.xz
InputXSLT-6ede83ca2c50353bb9f97260f0ef04234041e73b.tar.zst
InputXSLT-6ede83ca2c50353bb9f97260f0ef04234041e73b.zip
Simplified IncludeEntityResolver constructor and improved constness
* std::vector<FilesystemContext> instance is now const ** this required a constructor change * marked resolve member method as const as it doesn't need to modify anything ** this is also true for the overloaded resolveEntity member method ** the base class xercesc::EntityResolver prevents us from marking it as such
-rw-r--r--src/support/include_entity_resolver.cc15
-rw-r--r--src/support/include_entity_resolver.h5
2 files changed, 5 insertions, 15 deletions
diff --git a/src/support/include_entity_resolver.cc b/src/support/include_entity_resolver.cc
index 68af11a..948a61b 100644
--- a/src/support/include_entity_resolver.cc
+++ b/src/support/include_entity_resolver.cc
@@ -35,18 +35,7 @@ namespace InputXSLT {
IncludeEntityResolver::IncludeEntityResolver(
const std::vector<std::string>& path):
- path_() {
- this->path_.reserve(path.size());
-
- std::transform(
- path.begin(),
- path.end(),
- std::back_inserter(this->path_),
- [](const std::string& path) -> FilesystemContext {
- return FilesystemContext(path);
- }
- );
-}
+ path_(path.begin(), path.end()) { }
xercesc::InputSource* IncludeEntityResolver::resolveEntity(
const XMLCh* const,
@@ -70,7 +59,7 @@ xercesc::InputSource* IncludeEntityResolver::resolveEntity(
}
boost::optional<boost::filesystem::path> IncludeEntityResolver::resolve(
- const std::string& filePath) {
+ const std::string& filePath) const {
for ( auto&& context : this->path_ ) {
const boost::filesystem::path resolvedPath(
context.resolve(filePath)
diff --git a/src/support/include_entity_resolver.h b/src/support/include_entity_resolver.h
index 1a3bbc1..28992d6 100644
--- a/src/support/include_entity_resolver.h
+++ b/src/support/include_entity_resolver.h
@@ -22,10 +22,11 @@ class IncludeEntityResolver : public xercesc::EntityResolver {
const XMLCh* const
);
- boost::optional<boost::filesystem::path> resolve(const std::string&);
+ boost::optional<boost::filesystem::path> resolve(
+ const std::string&) const;
private:
- std::vector<FilesystemContext> path_;
+ const std::vector<FilesystemContext> path_;
};