42OOFEMTXTDataReader :: OOFEMTXTDataReader(std :: string inputfilename) :
DataReader(),
45 std :: list< std :: pair< int, std :: string > >lines;
49 if ( !inputStream.is_open() ) {
60 lines.emplace_back(make_pair(lineNumber, line));
64 for (
auto it = lines.begin();
it != lines.end(); ++
it ) {
65 if ( it->second.compare(0, 8,
"@include") == 0 ) {
66 std :: string fname = it->second.substr(10, it->second.length()-11);
67 OOFEM_LOG_INFO(
"Reading included file: %s\n", fname.c_str());
74 std :: ifstream includedStream(fname);
75 if ( !includedStream.is_open() ) {
76 OOFEM_ERROR(
"Can't open input stream (%s)", fname.c_str());
78 while (this->giveLineFromInput(includedStream, includedLine, line)) {
79 lines.emplace(it, make_pair(includedLine, line));
85 for (
auto &line: lines ) {
87 this->recordList.emplace_back(line.first, line.second);
89 this->it = this->recordList.begin();
154OOFEMTXTDataReader :: giveRawLineFromInput(std :: ifstream &stream,
int &lineNum, std :: string &line)
158 std :: getline(stream, line);
161 }
if ( line.length() > 0 ) {
162 if ( line.back() ==
'\\' ) {
163 std :: string continuedLine;
166 std :: getline(stream, continuedLine);
171 line += continuedLine;
172 }
while ( continuedLine.back() ==
'\\' );
175 }
while ( line.length() == 0 || line [ 0 ] ==
'#' );