Reader of ASCII files. More...
#include <MEDMEM_EnsightUtils.hxx>
Public Member Functions | |
| _ASCIIFileReader (const string &fileName) throw (MEDEXCEPTION) | |
| Constructor of ASCIIFileReader. | |
| ~_ASCIIFileReader () | |
| Destructor of ASCIIFileReader closes its file. | |
| bool | eof () |
| Return true if the whole file has been read. | |
| string | getWord () |
| never throws | |
| int | getInt () throw (MEDEXCEPTION) |
| float | getReal () throw (MEDEXCEPTION) |
| needed after getWord(), getInt() or getReal() to get a next line | |
| void | toNextLine () |
| char * | getLine () throw (MEDEXCEPTION) |
| Read a next line from the file. | |
| const char * | getCurrentPtr () const |
| bool | lookAt (const char *text) |
| bool | isTimeStepBeginning () |
| Return true if TIME_STEP_BEG follows and skips TIME_STEP_BEG line. | |
| bool | isTimeStepEnd () |
| read out given data | |
| void | skip (int nbVals, int nbPerLine, int valWidth) |
| read out width chars and nbLines line-ends | |
| void | skip (int width, int nbLines) |
| read out width chars and nbLines line-ends | |
| template<class T > | |
| char * | convertReals (const int nbValues, const char *undefValue=0, set< int > *undefIndices=0, const vector< int > *partialIndices=0, const int nbPartialComponents=0) throw (MEDEXCEPTION) |
Static Public Member Functions | |
| static int | split (const string &str, string &part1, string &part2, const char separator=' ', const bool fromBack=false) |
| < divide a string into two parts | |
| static int | split (const string &str, std::list< string > &parts, const char separator=' ', const bool fromBack=false) |
| check if string contains only digits | |
| static bool | isDigit (const string &str, const bool real=false) |
| check if a string contains only digits | |
Private Attributes | |
| int | _file |
| char * | _start |
| char * | _ptr |
| char * | _eptr |
| bool | _isWin |
Reader of ASCII files.
| MEDMEM_ENSIGHT._ASCIIFileReader::_ASCIIFileReader | ( | const string & | fileName | ) | throw (MEDEXCEPTION) |
Constructor of ASCIIFileReader.
References BUFFER_SIZE, Med_Gen_test.fileName, and MEDMEM_ENSIGHT.MAX_LINE_LENGTH.
| MEDMEM_ENSIGHT._ASCIIFileReader::~_ASCIIFileReader | ( | ) |
Destructor of ASCIIFileReader closes its file.
References MEDMEM_ENSIGHT._ASCIIFileReader._file, and MEDMEM_ENSIGHT._ASCIIFileReader._start.
| bool MEDMEM_ENSIGHT._ASCIIFileReader::eof | ( | ) |
Return true if the whole file has been read.
References MEDMEM_ENSIGHT._ASCIIFileReader._eptr, MEDMEM_ENSIGHT._ASCIIFileReader._file, MEDMEM_ENSIGHT._ASCIIFileReader._ptr, MEDMEM_ENSIGHT._ASCIIFileReader._start, BUFFER_SIZE, and MEDMEM_ENSIGHT.MAX_LINE_LENGTH.
| string MEDMEM_ENSIGHT._ASCIIFileReader::getWord | ( | ) |
never throws
Read a next word from the file.
References MEDMEM_ENSIGHT._ASCIIFileReader._eptr, MEDMEM_ENSIGHT._ASCIIFileReader._ptr, and MEDMEM_ENSIGHT._ASCIIFileReader.eof().
| int MEDMEM_ENSIGHT._ASCIIFileReader.getInt | ( | ) | throw (MEDEXCEPTION) |
| float MEDMEM_ENSIGHT._ASCIIFileReader.getReal | ( | ) | throw (MEDEXCEPTION) |
| void MEDMEM_ENSIGHT._ASCIIFileReader.toNextLine | ( | ) |
| char * MEDMEM_ENSIGHT._ASCIIFileReader::getLine | ( | ) | throw (MEDEXCEPTION) |
Read a next line from the file.
References MEDMEM_ENSIGHT._ASCIIFileReader._eptr, MEDMEM_ENSIGHT._ASCIIFileReader._ptr, MEDMEM_ENSIGHT._ASCIIFileReader._start, and MEDMEM_ENSIGHT._ASCIIFileReader.eof().
| const char* MEDMEM_ENSIGHT._ASCIIFileReader.getCurrentPtr | ( | ) | const |
| bool MEDMEM_ENSIGHT._ASCIIFileReader::lookAt | ( | const char * | text | ) |
References MEDMEM_ENSIGHT._ASCIIFileReader._ptr.
| bool MEDMEM_ENSIGHT._ASCIIFileReader::isTimeStepBeginning | ( | ) |
Return true if TIME_STEP_BEG follows and skips TIME_STEP_BEG line.
References MEDMEM_ENSIGHT._ASCIIFileReader._ptr, MEDMEM_ENSIGHT._ASCIIFileReader.eof(), LOCALIZED, MEDMEM_ENSIGHT.TIME_STEP_BEG, and MEDMEM_ENSIGHT.TIME_STEP_BEG_LEN.
| bool MEDMEM_ENSIGHT._ASCIIFileReader::isTimeStepEnd | ( | ) |
read out given data
Return true if TIME_STEP_END follows and skips TIME_STEP_END line.
References MEDMEM_ENSIGHT._ASCIIFileReader._ptr, MEDMEM_ENSIGHT._ASCIIFileReader.eof(), MEDMEM_ENSIGHT.TIME_STEP_END, and MEDMEM_ENSIGHT.TIME_STEP_END_LEN.
read out width chars and nbLines line-ends
read out given data
read out width chars and nbLines line-ends
References MEDMEM_ENSIGHT._ASCIIFileReader._eptr, MEDMEM_ENSIGHT._ASCIIFileReader._isWin, MEDMEM_ENSIGHT._ASCIIFileReader._ptr, and MEDMEM_ENSIGHT._ASCIIFileReader.eof().
| char* MEDMEM_ENSIGHT._ASCIIFileReader.convertReals | ( | const int | nbValues, |
| const char * | undefValue = 0, |
||
| set< int > * | undefIndices = 0, |
||
| const vector< int > * | partialIndices = 0, |
||
| const int | nbPartialComponents = 0 |
||
| ) | throw (MEDEXCEPTION) |
References batchmode_medcorba_test.value.
| int MEDMEM_ENSIGHT._ASCIIFileReader::split | ( | const string & | str, |
| string & | part1, | ||
| string & | part2, | ||
| const char | separator = ' ', |
||
| const bool | fromBack = false |
||
| ) | [static] |
< divide a string into two parts
divide a string into two parts
divide a string into parts, return nb of parts
| int MEDMEM_ENSIGHT._ASCIIFileReader::split | ( | const string & | str, |
| std::list< string > & | parts, | ||
| const char | separator = ' ', |
||
| const bool | fromBack = false |
||
| ) | [static] |
check if string contains only digits
divide a string into parts, return nb of parts
References INTERP_KERNEL.swap().
| bool MEDMEM_ENSIGHT._ASCIIFileReader::isDigit | ( | const string & | str, |
| const bool | real = false |
||
| ) | [static] |
check if a string contains only digits
References TestMedCorba7.s.
int MEDMEM_ENSIGHT._ASCIIFileReader._file [private] |
char* MEDMEM_ENSIGHT._ASCIIFileReader._start [private] |
char* MEDMEM_ENSIGHT._ASCIIFileReader._ptr [private] |
char* MEDMEM_ENSIGHT._ASCIIFileReader._eptr [private] |
bool MEDMEM_ENSIGHT._ASCIIFileReader._isWin [private] |