From 6ede83ca2c50353bb9f97260f0ef04234041e73b Mon Sep 17 00:00:00 2001 From: Adrian Kummerländer Date: Fri, 23 May 2014 17:08:16 +0200 Subject: Simplified IncludeEntityResolver constructor and improved constness * std::vector 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 --- src/support/include_entity_resolver.cc | 15 ++------------- src/support/include_entity_resolver.h | 5 +++-- 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& 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 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 resolve(const std::string&); + boost::optional resolve( + const std::string&) const; private: - std::vector path_; + const std::vector path_; }; -- cgit v1.2.3