diff options
author | Adrian Kummerländer | 2014-05-22 21:07:16 +0200 |
---|---|---|
committer | Adrian Kummerländer | 2014-05-22 21:07:16 +0200 |
commit | 2c358ced7ca10ab37a382477d8b55fdb4e353f44 (patch) | |
tree | 7478370a0dfe8cb8329e028e55d5860b33d48509 /src/function | |
parent | 4d0569669e01434b3bb9f689cd176f590344bea8 (diff) | |
download | InputXSLT-2c358ced7ca10ab37a382477d8b55fdb4e353f44.tar InputXSLT-2c358ced7ca10ab37a382477d8b55fdb4e353f44.tar.gz InputXSLT-2c358ced7ca10ab37a382477d8b55fdb4e353f44.tar.bz2 InputXSLT-2c358ced7ca10ab37a382477d8b55fdb4e353f44.tar.lz InputXSLT-2c358ced7ca10ab37a382477d8b55fdb4e353f44.tar.xz InputXSLT-2c358ced7ca10ab37a382477d8b55fdb4e353f44.tar.zst InputXSLT-2c358ced7ca10ab37a382477d8b55fdb4e353f44.zip |
Replaced std::pair<bool, *> with the more convenient boost::optional<*>
* InputXSLT is dependent on boost anyway, so there is no argument to be made to emulate boost::optional using std::pair
Diffstat (limited to 'src/function')
-rw-r--r-- | src/function/read_file.cc | 13 | ||||
-rw-r--r-- | src/function/read_xml_file.cc | 13 |
2 files changed, 8 insertions, 18 deletions
diff --git a/src/function/read_file.cc b/src/function/read_file.cc index 85f834d..1a870a6 100644 --- a/src/function/read_file.cc +++ b/src/function/read_file.cc @@ -28,18 +28,13 @@ xercesc::DOMDocument* FunctionReadFile::constructDocument( const FilesystemContext& fsContext, const FunctionBase::parameter_tuple& parameters ) { - boost::filesystem::path filePath( - fsContext.resolve(std::get<0>(parameters)) - ); + const std::string& rawPath = std::get<0>(parameters); + boost::filesystem::path filePath(fsContext.resolve(rawPath)); if ( !(boost::filesystem::exists(filePath) && boost::filesystem::is_regular_file(filePath)) ) { - auto resolvedPath = this->include_resolver_->resolve( - std::get<0>(parameters) - ); - - if ( resolvedPath.first ) { - filePath = resolvedPath.second; + if ( auto resolvedPath = this->include_resolver_->resolve(rawPath) ) { + filePath = *resolvedPath; } } diff --git a/src/function/read_xml_file.cc b/src/function/read_xml_file.cc index b9246e6..4eb44e5 100644 --- a/src/function/read_xml_file.cc +++ b/src/function/read_xml_file.cc @@ -38,18 +38,13 @@ xercesc::DOMDocument* FunctionReadXmlFile::constructDocument( const FilesystemContext& fsContext, const FunctionBase::parameter_tuple& parameters ) { - boost::filesystem::path filePath( - fsContext.resolve(std::get<0>(parameters)) - ); + const std::string& rawPath = std::get<0>(parameters); + boost::filesystem::path filePath(fsContext.resolve(rawPath)); if ( !(boost::filesystem::exists(filePath) && boost::filesystem::is_regular_file(filePath)) ) { - auto resolvedPath = this->include_resolver_->resolve( - std::get<0>(parameters) - ); - - if ( resolvedPath.first ) { - filePath = resolvedPath.second; + if ( auto resolvedPath = this->include_resolver_->resolve(rawPath) ) { + filePath = *resolvedPath; } } |