Public Member Functions | |
InputFile (G4String filename, G4int _maxline=1024) | |
~InputFile () | |
const char * | filename () |
bool | good () |
int | linenumber () |
char * | getline () |
void | setMaxline (int _maxline) |
void | close () |
void | repeatLine () |
Private Attributes | |
std::ifstream | in |
G4String | name |
char * | line |
int | maxline |
int | lineno |
bool | repeatline |
InputFile::InputFile | ( | G4String | filename, | |
G4int | _maxline = 1024 | |||
) | [inline] |
const char* InputFile::filename | ( | ) | [inline] |
bool InputFile::good | ( | ) | [inline] |
int InputFile::linenumber | ( | ) | [inline] |
References lineno.
Referenced by CylinderImpl::handleCommand(), GridImpl::handleCommand(), and BLFieldMap::readFile().
00053 { return lineno; }
char* InputFile::getline | ( | ) | [inline] |
References in, line, lineno, maxline, and repeatline.
Referenced by CylinderImpl::handleCommand(), GridImpl::handleCommand(), FieldMapImpl::readBlock(), BLFieldMap::readFile(), and TimeImpl::readTime().
00054 { // skips blank lines and comments 00055 if(repeatline) { 00056 repeatline = false; 00057 return line; 00058 } 00059 while(in.good()) { 00060 line[0] = '\0'; 00061 in.getline(line,maxline); 00062 ++lineno; 00063 if(line[0] == '*') 00064 printf("%s\n",line); 00065 if(line[0] == '\0' || line[0] == '#' || line[0] == '*') 00066 continue; 00067 return line; 00068 } 00069 return 0; 00070 }
void InputFile::setMaxline | ( | int | _maxline | ) | [inline] |
void InputFile::close | ( | ) | [inline] |
void InputFile::repeatLine | ( | ) | [inline] |
References repeatline.
Referenced by CylinderImpl::handleCommand(), GridImpl::handleCommand(), and TimeImpl::readTime().
00079 { repeatline = true; }
std::ifstream InputFile::in [private] |
Referenced by close(), getline(), good(), and InputFile().
G4String InputFile::name [private] |
Referenced by filename(), and InputFile().
char* InputFile::line [private] |
Referenced by close(), getline(), InputFile(), and setMaxline().
int InputFile::maxline [private] |
Referenced by getline(), InputFile(), and setMaxline().
int InputFile::lineno [private] |
Referenced by getline(), InputFile(), and linenumber().
bool InputFile::repeatline [private] |
Referenced by getline(), InputFile(), and repeatLine().