ALib C++ Library
Library Version: 2511 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::files::TextFileLineReader Struct Reference

Description:

A rather simple text file line-reader. While this is used with class TTextFile, it might well be used as a standalone helper, i.e. in cases where the text file is read but does not need to be stored in a vector.

Definition at line 24 of file ALib.Files.TextFile.H.

#include <ALib.Files.TextFile.H>

Collaboration diagram for alib::files::TextFileLineReader:
[legend]

Public Field Index:

std::ifstream IFStream
 The input stream opened on construction.
 
NString4K Line
 The line buffer.
 
alib::IStreamLine ReadOp
 An AString-appendable object used for reading.
 
system::SystemErrors Status
 

Public Method Index:

 TextFileLineReader (const CString &filePath)
 
 TextFileLineReader (files::File file)
 
Substring NextLine ()
 

Protected Method Index:

void construct (const CString &filePath)
 

Field Details:

◆ IFStream

std::ifstream alib::files::TextFileLineReader::IFStream

The input stream opened on construction.

Definition at line 25 of file ALib.Files.TextFile.H.

◆ Line

NString4K alib::files::TextFileLineReader::Line

The line buffer.

Definition at line 26 of file ALib.Files.TextFile.H.

◆ ReadOp

alib::IStreamLine alib::files::TextFileLineReader::ReadOp

An AString-appendable object used for reading.

Definition at line 27 of file ALib.Files.TextFile.H.

◆ Status

system::SystemErrors alib::files::TextFileLineReader::Status

Set after construction. If SystemErrors::OK, the file was correctly opened.

Definition at line 28 of file ALib.Files.TextFile.H.

Constructor(s) / Destructor Details:

◆ TextFileLineReader() [1/2]

alib::files::TextFileLineReader::TextFileLineReader ( const CString & filePath)
inline

Constructor. Opens the file specified by filePath. On success, the field Status will hold SystemErrors::OK, an error code otherwise.

Parameters
filePathThe path of the text-file to read.

Definition at line 52 of file ALib.Files.TextFile.H.

Here is the call graph for this function:

◆ TextFileLineReader() [2/2]

alib::files::TextFileLineReader::TextFileLineReader ( files::File file)
inline

Alternative constructor taking a File object instead of a file's path string.

Parameters
fileThe text-file to read.

Definition at line 58 of file ALib.Files.TextFile.H.

Here is the call graph for this function:

Method Details:

◆ construct()

void alib::files::TextFileLineReader::construct ( const CString & filePath)
inlineprotected

Implementation of the two constructors.

Parameters
filePathThe path of the text-file to read.

Definition at line 34 of file ALib.Files.TextFile.H.

◆ NextLine()

Substring alib::files::TextFileLineReader::NextLine ( )
inline

Reads the next text-line into the field Line and returns a Substring pointing to it. When the end of the file is reached, the returned object is nulled.Prior to the invocation, method IsEOF may be called to detect the end of the file actively.

Returns
The next line read, or NULL_STRING when all lines were read.

Definition at line 71 of file ALib.Files.TextFile.H.


The documentation for this struct was generated from the following file: