diff options
author | Adrian Kummerländer | 2014-04-18 22:19:46 +0200 |
---|---|---|
committer | Adrian Kummerländer | 2014-04-18 22:19:46 +0200 |
commit | 6c205f4859588fc8dad786dce5f2fa32c75fd3f3 (patch) | |
tree | 46a87960849f2b8ee53f74bf2c2de98c1a0da526 /src/read_file_command.h | |
parent | 6dd832dd0adb35f63148a0e7bd5bdcfb28516c3b (diff) | |
download | InputXSLT-6c205f4859588fc8dad786dce5f2fa32c75fd3f3.tar InputXSLT-6c205f4859588fc8dad786dce5f2fa32c75fd3f3.tar.gz InputXSLT-6c205f4859588fc8dad786dce5f2fa32c75fd3f3.tar.bz2 InputXSLT-6c205f4859588fc8dad786dce5f2fa32c75fd3f3.tar.lz InputXSLT-6c205f4859588fc8dad786dce5f2fa32c75fd3f3.tar.xz InputXSLT-6c205f4859588fc8dad786dce5f2fa32c75fd3f3.tar.zst InputXSLT-6c205f4859588fc8dad786dce5f2fa32c75fd3f3.zip |
Code style improvements
* marked assignment and equality operators as deleted instead of making them private
* XercesParserLiaison is stored in a std::shared_ptr specialization instance for scope guarding
* moved implementation details into InputXSLT namespace
Diffstat (limited to 'src/read_file_command.h')
-rw-r--r-- | src/read_file_command.h | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/src/read_file_command.h b/src/read_file_command.h index 837ec04..5e47c36 100644 --- a/src/read_file_command.h +++ b/src/read_file_command.h @@ -7,17 +7,17 @@ #include "utility.h" -namespace xalan = xalanc_1_11; +namespace InputXSLT { class FunctionReadFile : public xalan::Function { public: virtual xalan::XObjectPtr execute( - xalan::XPathExecutionContext& executionContext, - xalan::XalanNode* context, - const xalan::Function::XObjectArgVectorType& args, + xalan::XPathExecutionContext& executionContext, + xalan::XalanNode* context, + const xalan::Function::XObjectArgVectorType& arguments, const xalan::Locator* locator ) const { - if ( args.size() != 1 ) { + if ( arguments.size() != 1 ) { xalan::XPathExecutionContext::GetAndReleaseCachedString guard( executionContext ); @@ -25,21 +25,21 @@ class FunctionReadFile : public xalan::Function { generalError(executionContext, context, locator); } - xalan::CharVectorType tmpFileName; - std::string fileName; + xalan::CharVectorType fileNameVector; + std::string fileNameString; - args[0]->str().transcode(tmpFileName); + arguments[0]->str().transcode(fileNameVector); std::move( - tmpFileName.begin(), - tmpFileName.end(), - fileName.begin() + fileNameVector.begin(), + fileNameVector.end(), + fileNameString.begin() ); - std::string content(readFile(fileName)); - return executionContext.getXObjectFactory().createString( - xalan::XalanDOMString(content.data()) + xalan::XalanDOMString( + InputXSLT::readFile(fileNameString).data() + ) ); } @@ -47,15 +47,16 @@ class FunctionReadFile : public xalan::Function { return xalan::XalanCopyConstruct(manager, *this); } - protected: + FunctionReadFile& operator=(const FunctionReadFile&) = delete; + bool operator==(const FunctionReadFile&) const = delete; + + private: const xalan::XalanDOMString& getError(xalan::XalanDOMString& result) const { result.assign("The read-file() function expects one argument."); return result; } - private: - FunctionReadFile& operator=(const FunctionReadFile&); - bool operator==(const FunctionReadFile&) const; - }; + +} |