ALib C++ Framework
by
Library Version: 2605 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::system::TextFileLineReader< TLocalBufferSize > Struct Template Reference

Description:

template<size_t TLocalBufferSize = 1024>
struct alib::system::TextFileLineReader< TLocalBufferSize >

A rather simple text file line-reader. While this is used with the 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.

Template Parameters
TLocalBufferSizeThe size of the local buffer. If lines are wider and the local buffer is exceeded, it will be replaced by an heap-allocated buffer, which is then reused for any further line.
Defaults to 1024.

Definition at line 18 of file textfile.hpp.

#include <textfile.hpp>

Collaboration diagram for alib::system::TextFileLineReader< TLocalBufferSize >:
[legend]

Public Field Index:

std::ifstream IFStream
 The input stream opened on construction.
NLocalString< TLocalBufferSize > Line
 The line buffer.
IStreamLineN ReadOp
std::errc Status

Public Method Index:

 TextFileLineReader (const CPathString &filePath)
NSubstring NextLine ()

Protected Method Index:

void construct (const CPathString &filePath)

Field Details:

◆ IFStream

template<size_t TLocalBufferSize = 1024>
std::ifstream alib::system::TextFileLineReader< TLocalBufferSize >::IFStream

The input stream opened on construction.

Definition at line 19 of file textfile.hpp.

◆ Line

template<size_t TLocalBufferSize = 1024>
NLocalString<TLocalBufferSize> alib::system::TextFileLineReader< TLocalBufferSize >::Line

The line buffer.

Definition at line 20 of file textfile.hpp.

◆ ReadOp

template<size_t TLocalBufferSize = 1024>
IStreamLineN alib::system::TextFileLineReader< TLocalBufferSize >::ReadOp

An AString-appendable object used for reading.

Definition at line 21 of file textfile.hpp.

◆ Status

template<size_t TLocalBufferSize = 1024>
std::errc alib::system::TextFileLineReader< TLocalBufferSize >::Status

Set after construction. If value is 0, the file was correctly opened.

Definition at line 23 of file textfile.hpp.

Constructor(s) / Destructor Details:

◆ TextFileLineReader()

template<size_t TLocalBufferSize = 1024>
alib::system::TextFileLineReader< TLocalBufferSize >::TextFileLineReader ( const CPathString & filePath)
inline

Constructor. Opens the file specified by filePath. On success, the field Status will hold std::errc(0), an error code otherwise.

Parameters
filePathThe path of the text-file to read.

Definition at line 48 of file textfile.hpp.

Method Details:

◆ construct()

template<size_t TLocalBufferSize = 1024>
void alib::system::TextFileLineReader< TLocalBufferSize >::construct ( const CPathString & filePath)
inlineprotected

Implementation of the two constructors.

Parameters
filePathThe path of the text-file to read.

Definition at line 29 of file textfile.hpp.

◆ NextLine()

template<size_t TLocalBufferSize = 1024>
NSubstring alib::system::TextFileLineReader< TLocalBufferSize >::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 57 of file textfile.hpp.


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