PTextFile Class Reference

Detailed Description

DEPRECATED, use PStringList::FromTextFile() instead; The PTextFile class can be used to read text file line by line; NOT thread-safe.

Definition at line 27 of file PTextFile.h.

#include <PTextFile.h>

Constructor & Destructor Documentation

◆ PTextFile() [1/2]

PTextFile::PTextFile ( )

Default constructor, does nothing.

◆ PTextFile() [2/2]

PTextFile::PTextFile ( const PTextFile other)

Constructs a shared copy of other.

◆ ~PTextFile()

virtual PTextFile::~PTextFile ( )
virtual

Destroys this object.

Member Function Documentation

◆ GetFileName()

const PString& PTextFile::GetFileName ( ) const

Returns the name of the file.

◆ GetLine() [1/2]

PString PTextFile::GetLine ( papillon::int32  lineNumber) const

Gets the nth line (starts at 0).

◆ GetLine() [2/2]

PStringList PTextFile::GetLine ( papillon::int32  lineNumber,
const PString separator 
) const

Gets the nth line as list of tokens which has been delimited by the specified separator.

◆ GetLines()

const PStringList& PTextFile::GetLines ( ) const

Gets all the lines of the text file.

◆ GetNumberOfLines()

papillon::int32 PTextFile::GetNumberOfLines ( ) const

Returns the number of lines in this text file.

◆ operator=()

PTextFile& PTextFile::operator= ( const PTextFile other)

Performs a shared copy of other to this object.

◆ ReadAll()

static PResult PTextFile::ReadAll ( const PString filename,
PTextFile textFile 
)
static

Creates a PTextFile from the specified filename.

All lines contained in the file are loaded in memory for further access. Returns PResult::C_OK if success, another result otherwise.