-
Notifications
You must be signed in to change notification settings - Fork 0
/
DgInLocTextFile.cpp
58 lines (49 loc) · 1.81 KB
/
DgInLocTextFile.cpp
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
////////////////////////////////////////////////////////////////////////////////
//
// DgInLocTextFile.cpp: DgInLocTextFile class implementation
//
// Version 6.1 - Kevin Sahr, 5/23/13
//
////////////////////////////////////////////////////////////////////////////////
#include "DgInLocTextFile.h"
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
DgInLocTextFile::DgInLocTextFile (const DgRFBase& rfIn,
const string* fileNameIn, bool isPointFileIn,
DgReportLevel failLevel)
: DgInLocFile (rfIn, fileNameIn, isPointFileIn, failLevel)
{
if (fileNameIn)
if (!open(NULL, DgBase::Silent))
report("DgInLocTextFile::DgInLocTextFile() unable to open file " +
fileName_, failLevel);
} // DgInLocTextFile::DgInLocTextFile
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
bool
DgInLocTextFile::open (const string *fileNameIn, DgReportLevel failLevel)
//
// Open fileName as an input file. Report with a report level of failLevel
// if the open is unsuccessful.
//
// Returns true if successful and false if unsuccessful.
//
{
// make sure we are not already open
if ((rdbuf())->is_open()) close();
if (fileNameIn)
fileName_ = *fileNameIn;
ifstream::open(fileName_.c_str(), ios::in);
if (good())
{
debug("DgInLocTextFile::open() opened file " + fileName_);
return true;
}
else
{
report("DgInLocTextFile::open() unable to open file " + fileName_,
failLevel);
return false;
}
} // DgInLocTextFile::open
////////////////////////////////////////////////////////////////////////////////