OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
owl::TFileLineIterator Class Reference

The TFileLineIterator class is used to iterate through a TTextFile file. More...

#include <owl/file.h>

Public Member Functions

 TFileLineIterator (TTextFile &file, uint bufsize=260)
 Constructor for iterating through file.
 
virtual ~TFileLineIterator ()
 Deletes the buffer.
 
const tcharoperator* () const
 Returns a pointer to the start of the buffer if the file has not been completely iterated through; otherwise returns 0.
 
 operator const tchar * () const
 Returns a pointer to the start of the buffer if the file has not been completely iterated through; otherwise returns 0.
 
const tcharoperator++ ()
 Loads the next line in the file and then returns a pointer to the start of the buffer if the file has not been completely iterated through; otherwise returns 0.
 
const tcharCurrent () const
 Returns a pointer to the start of the buffer if the file has not been completely iterated through; otherwise returns 0.
 
uint Line () const
 Returns the current line number.
 

Protected Member Functions

 TFileLineIterator ()
 Protected default constructor. Intializes everything to 0.
 
virtual bool NextLine ()
 Loads the next line in the file. Returns true if successful; false otherwise.
 

Protected Attributes

TTextFileFile
 Pointer to the file being iterated through.
 
TCHARLineBuffer
 Buffer lines of text are loaded into.
 
uint BuffSize
 Size of the buffer allocated for loading a line of text.
 
uint LineNumber
 Current line number in buffer. Line numbering starts at 1.
 
bool Done
 

Detailed Description

The TFileLineIterator class is used to iterate through a TTextFile file.

Definition at line 472 of file file.h.

Constructor & Destructor Documentation

◆ TFileLineIterator() [1/2]

owl::TFileLineIterator::TFileLineIterator ( TTextFile & file,
uint bufsize = 260 )

Constructor for iterating through file.

The bufsize paramater is used for setting the buffer size.

Definition at line 1548 of file file.cpp.

References BuffSize, Done, LineBuffer, and NextLine().

◆ ~TFileLineIterator()

owl::TFileLineIterator::~TFileLineIterator ( )
virtual

Deletes the buffer.

Definition at line 1561 of file file.cpp.

References LineBuffer.

◆ TFileLineIterator() [2/2]

owl::TFileLineIterator::TFileLineIterator ( )
inlineprotected

Protected default constructor. Intializes everything to 0.

Definition at line 1172 of file file.h.

Member Function Documentation

◆ Current()

const tchar * owl::TFileLineIterator::Current ( ) const
inline

Returns a pointer to the start of the buffer if the file has not been completely iterated through; otherwise returns 0.

Definition at line 1194 of file file.h.

References Done, and LineBuffer.

◆ Line()

uint owl::TFileLineIterator::Line ( ) const
inline

Returns the current line number.

Definition at line 1213 of file file.h.

References LineNumber.

◆ NextLine()

bool owl::TFileLineIterator::NextLine ( )
protectedvirtual

Loads the next line in the file. Returns true if successful; false otherwise.

Definition at line 1570 of file file.cpp.

References BuffSize, File, owl::TTextFile::GetString(), owl::TFile::IsOpen(), LineBuffer, and owl::ToBool().

◆ operator const tchar *()

owl::TFileLineIterator::operator const tchar * ( ) const
inline

Returns a pointer to the start of the buffer if the file has not been completely iterated through; otherwise returns 0.

Definition at line 1187 of file file.h.

◆ operator*()

const tchar * owl::TFileLineIterator::operator* ( ) const
inline

Returns a pointer to the start of the buffer if the file has not been completely iterated through; otherwise returns 0.

Definition at line 1180 of file file.h.

References Done, and LineBuffer.

◆ operator++()

const tchar * owl::TFileLineIterator::operator++ ( )
inline

Loads the next line in the file and then returns a pointer to the start of the buffer if the file has not been completely iterated through; otherwise returns 0.

Definition at line 1201 of file file.h.

References Done, LineBuffer, LineNumber, and NextLine().

Member Data Documentation

◆ BuffSize

uint owl::TFileLineIterator::BuffSize
protected

Size of the buffer allocated for loading a line of text.

Definition at line 496 of file file.h.

◆ Done

bool owl::TFileLineIterator::Done
protected

Definition at line 501 of file file.h.

◆ File

TTextFile* owl::TFileLineIterator::File
protected

Pointer to the file being iterated through.

Definition at line 490 of file file.h.

◆ LineBuffer

TCHAR* owl::TFileLineIterator::LineBuffer
protected

Buffer lines of text are loaded into.

Definition at line 493 of file file.h.

◆ LineNumber

uint owl::TFileLineIterator::LineNumber
protected

Current line number in buffer. Line numbering starts at 1.

Definition at line 499 of file file.h.


The documentation for this class was generated from the following files: