Inheritance diagram for Eaagles::Basic::LcFileReader:


Public Member Functions | |
| LcFileReader () | |
| bool | open () |
| bool | isReady () |
| const char * | getPathname () const |
| bool | setPathname (const char *path) |
| const char * | getFilename () const |
| bool | setFilename (const char *file) |
| int | getRecordLength () const |
| bool | setRecordLength (const int len) |
| int | getRecordNumber () const |
| bool | setRecordNumber (const int num) |
| const char * | getRecord (const int n=-1, const int len=0) |
| void | backRecord (const int n=1) |
| void | skipRecord (const int n=1) |
| const char * | getFirstRecord () |
| const char * | getNextRecord () |
Private Member Functions | |
| bool | setSlotPathname (LcString *const msg) |
| bool | setSlotFilename (LcString *const msg) |
| bool | setSlotRecordLength (LcNumber *const msg) |
Private Attributes | |
| std::ifstream * | dbf |
| int | rnum |
| int | crnum |
| int | rlen |
| char * | rec |
| char | filename [FILENAME_LENGTH] |
| char | pathname [PATHNAME_LENGTH] |
Static Private Attributes | |
| static const size_t | FILENAME_LENGTH = 256 |
| static const size_t | PATHNAME_LENGTH = 256 |
Manages the reading of the fixed record length files
Form name: FileReader
Slots:
1. pathname (String) Path to the file
2. filename (String) File name (appended to pathname)
3. recordLength (Number) Length (in characters) of the records
Notes:
1) Record numbers range from 1 to the number of records in the file.
2) getRecord(), getFirstRecord() and getNextRecord() return 0
for invalid record numbers (e.g., beyond end of file).
3) The 'const char*' returned from getRecord(), getFirstRecord(),
and getNextRecord() point to an internal buffer which is only
valid until the next read.
4) The file name and path names are limited to 255 characters.
| Eaagles::Basic::LcFileReader::LcFileReader | ( | ) |
| bool Eaagles::Basic::LcFileReader::open | ( | ) |
Opens 'filename' in directory 'pathname' with 'recordLength' characters per record. If 'recordLength' is not provided, it must be set using setRecordLength() before the first access. Returns true of all is well.
| bool Eaagles::Basic::LcFileReader::isReady | ( | ) |
Returns true if the file is open and ready to use.
| const char* Eaagles::Basic::LcFileReader::getPathname | ( | ) | const [inline] |
Gets the path name to the file.
| bool Eaagles::Basic::LcFileReader::setPathname | ( | const char * | path | ) |
Sets the path name to the file. If provided, this string is used as a prefix to file name.
| const char* Eaagles::Basic::LcFileReader::getFilename | ( | ) | const [inline] |
| bool Eaagles::Basic::LcFileReader::setFilename | ( | const char * | file | ) |
Sets the name of the file to be read. If the path name is provided, the file name is appended to the path name.
| int Eaagles::Basic::LcFileReader::getRecordLength | ( | ) | const [inline] |
Returns the current record length.
| bool Eaagles::Basic::LcFileReader::setRecordLength | ( | const int | len | ) |
Sets the current record length to 'num' and returns true if all is well.
| int Eaagles::Basic::LcFileReader::getRecordNumber | ( | ) | const [inline] |
Returns the current record number.
| bool Eaagles::Basic::LcFileReader::setRecordNumber | ( | const int | num | ) | [inline] |
Sets the current record number to 'num' and returns true if all is well.
| const char * Eaagles::Basic::LcFileReader::getRecord | ( | const int | n = -1, |
|
| const int | len = 0 | |||
| ) |
Reads 'len' characters starting at record number 'num'. 'Len' can be up to 4 times recordLength().
| void Eaagles::Basic::LcFileReader::backRecord | ( | const int | n = 1 |
) | [inline] |
Decrements the current record by 'n' or 1.
| void Eaagles::Basic::LcFileReader::skipRecord | ( | const int | n = 1 |
) | [inline] |
Increments the current record by 'n' or 1.
| const char * Eaagles::Basic::LcFileReader::getFirstRecord | ( | ) | [inline] |
Reads the first record.
| const char * Eaagles::Basic::LcFileReader::getNextRecord | ( | ) | [inline] |
Reads the next record.
| bool Eaagles::Basic::LcFileReader::setSlotPathname | ( | LcString *const | msg | ) | [private] |
| bool Eaagles::Basic::LcFileReader::setSlotFilename | ( | LcString *const | msg | ) | [private] |
| bool Eaagles::Basic::LcFileReader::setSlotRecordLength | ( | LcNumber *const | msg | ) | [private] |
std::ifstream* Eaagles::Basic::LcFileReader::dbf [private] |
int Eaagles::Basic::LcFileReader::rnum [private] |
record number
int Eaagles::Basic::LcFileReader::crnum [private] |
current (in memory) record number
int Eaagles::Basic::LcFileReader::rlen [private] |
record length
char* Eaagles::Basic::LcFileReader::rec [private] |
the (in memory) record
const size_t Eaagles::Basic::LcFileReader::FILENAME_LENGTH = 256 [static, private] |
Max length of file name.
const size_t Eaagles::Basic::LcFileReader::PATHNAME_LENGTH = 256 [static, private] |
Max length of path name.
char Eaagles::Basic::LcFileReader::filename[FILENAME_LENGTH] [private] |
file name
char Eaagles::Basic::LcFileReader::pathname[PATHNAME_LENGTH] [private] |
path name
1.5.0