aboutsummaryrefslogtreecommitdiff
path: root/src/function/read_file.cc
diff options
context:
space:
mode:
authorAdrian Kummerländer2014-04-20 20:37:39 +0200
committerAdrian Kummerländer2014-04-20 20:37:39 +0200
commitab840f41154f01d85fec769da693035149689c39 (patch)
treecc758e40330b6ded5dad6690b4de680a81ea46a4 /src/function/read_file.cc
parent29a9fb20b4c8414f2590886e43ae86794a53db89 (diff)
downloadInputXSLT-ab840f41154f01d85fec769da693035149689c39.tar
InputXSLT-ab840f41154f01d85fec769da693035149689c39.tar.gz
InputXSLT-ab840f41154f01d85fec769da693035149689c39.tar.bz2
InputXSLT-ab840f41154f01d85fec769da693035149689c39.tar.lz
InputXSLT-ab840f41154f01d85fec769da693035149689c39.tar.xz
InputXSLT-ab840f41154f01d85fec769da693035149689c39.tar.zst
InputXSLT-ab840f41154f01d85fec769da693035149689c39.zip
Replaced c-style file reading with std::ifstream
* there is no reason for performing system-calls instead of using the features offered by the standard library in this situation
Diffstat (limited to 'src/function/read_file.cc')
-rw-r--r--src/function/read_file.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/function/read_file.cc b/src/function/read_file.cc
index dcbff25..ea7a758 100644
--- a/src/function/read_file.cc
+++ b/src/function/read_file.cc
@@ -1,6 +1,6 @@
#include "read_file.h"
-#include "utility.h"
+#include <fstream>
namespace InputXSLT {
@@ -33,10 +33,15 @@ xalan::XObjectPtr FunctionReadFile::execute(
fileName.end()
);
+ std::ifstream file(fileName);
+
+ std::string content(
+ (std::istreambuf_iterator<char>(file)),
+ (std::istreambuf_iterator<char>())
+ );
+
return executionContext.getXObjectFactory().createString(
- xalan::XalanDOMString(
- InputXSLT::readFile(fileName).data()
- )
+ xalan::XalanDOMString(content.data())
);
}