From 6c205f4859588fc8dad786dce5f2fa32c75fd3f3 Mon Sep 17 00:00:00 2001 From: Adrian Kummerländer Date: Fri, 18 Apr 2014 22:19:46 +0200 Subject: 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 --- src/read_file_command.h | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) (limited to 'src/read_file_command.h') 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; - }; + +} -- cgit v1.2.3