-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileProcessor.cpp
More file actions
34 lines (28 loc) · 878 Bytes
/
FileProcessor.cpp
File metadata and controls
34 lines (28 loc) · 878 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "FileProcessor.h"
FileProcessor::FileProcessor(){
tr = new Translator();
cout << "FileProcessor contructor" << endl;
}
FileProcessor::~FileProcessor(){
delete tr;
cout << "FileProcesser destructor" << endl;
}
void FileProcessor::processFile(string englishInput, string translatedOutput){
string line;
stringstream toTranslateStream;
ifstream readFile(englishInput);
if(readFile.is_open()){
while(getline(readFile,line)){
toTranslateStream << line;
}
readFile.close();
}
string toTranslate = toTranslateStream.str();
string translated = tr->translateEnglishSentence(toTranslate);
ofstream output;
output.open(translatedOutput);
output << "<p><b>" << toTranslate << "</b></p>\n";
output << "<p></p>\n";
output << "<p>" << translated << "</p>";
output.close();
}