TextLineReader Class Reference

Helper for reading text files. More...

Collaboration diagram for TextLineReader:
[legend]

List of all members.

Public Member Functions

void Close ()
 Closes the file.
void Close ()
 Closes the file.
void Error (const char *msg,...)
 Prints a formatted error message with line number info.
void Error (const char *msg,...)
 Prints a formatted error message with line number info.
bool Gobble ()
 Tries to read one line from a file.
bool Gobble ()
 Tries to read one line from a file.
int line_num () const
 Returns the currnet line number.
int line_num () const
 Returns the currnet line number.
bool MoreLines ()
 Are there more lines left?
bool MoreLines ()
 Are there more lines left?
success_t Open (const char *fname)
 Opens a file.
success_t Open (const char *fname)
 Opens a file.
const StringPeek () const
 Gets the current line.
StringPeek ()
 Gets the current line.
const StringPeek () const
 Gets the current line.
StringPeek ()
 Gets the current line.
 TextLineReader ()
 Creates an unitialized object.
 TextLineReader ()
 Creates an unitialized object.
 ~TextLineReader ()
 Automatically closes the file.
 ~TextLineReader ()
 Automatically closes the file.

Detailed Description

Helper for reading text files.

Files are closed automatically when they fall out of scope, though you may choose to close it yourself at no harm.

Definition at line 60 of file textfile.h.


Constructor & Destructor Documentation

TextLineReader::TextLineReader (  )  [inline]

Creates an unitialized object.

Definition at line 71 of file textfile.h.

TextLineReader::~TextLineReader (  )  [inline]

Automatically closes the file.

Definition at line 78 of file textfile.h.

TextLineReader::TextLineReader (  )  [inline]

Creates an unitialized object.

Definition at line 71 of file textfile.h.

TextLineReader::~TextLineReader (  )  [inline]

Automatically closes the file.

Definition at line 78 of file textfile.h.


Member Function Documentation

void TextLineReader::Close (  )  [inline]

Closes the file.

(No need for a return value since you are only reading the file.)

Definition at line 96 of file textfile.h.

void TextLineReader::Close (  )  [inline]

Closes the file.

(No need for a return value since you are only reading the file.)

Definition at line 96 of file textfile.h.

void TextLineReader::Error ( const char *  msg,
  ... 
)

Prints a formatted error message with line number info.

void TextLineReader::Error ( const char *  msg,
  ... 
)

Prints a formatted error message with line number info.

Definition at line 96 of file textfile.cc.

References String::c_str().

Referenced by DatasetInfo::InitFromArff(), DatasetInfo::InitFromCsv(), DatasetInfo::InitFromFile(), data::LargeLoad(), and DatasetInfo::ReadPoint().

bool TextLineReader::Gobble (  ) 

Tries to read one line from a file.

Returns:
true if a line was returned, false if end of file
bool TextLineReader::Gobble (  ) 

Tries to read one line from a file.

Returns:
true if a line was returned, false if end of file

Definition at line 123 of file textfile.cc.

References String::Destruct(), and String::Init().

Referenced by DatasetInfo::InitFromArff(), DatasetInfo::InitFromCsv(), data::LargeLoad(), Open(), and DatasetInfo::ReadPoint().

int TextLineReader::line_num (  )  const [inline]

Returns the currnet line number.

Definition at line 111 of file textfile.h.

int TextLineReader::line_num (  )  const [inline]

Returns the currnet line number.

Definition at line 111 of file textfile.h.

Referenced by data::LargeLoad().

bool TextLineReader::MoreLines (  )  [inline]

Are there more lines left?

Definition at line 104 of file textfile.h.

bool TextLineReader::MoreLines (  )  [inline]

Are there more lines left?

Definition at line 104 of file textfile.h.

Referenced by DatasetInfo::ReadPoint().

success_t TextLineReader::Open ( const char *  fname  ) 

Opens a file.

Returns:
success value
success_t TextLineReader::Open ( const char *  fname  ) 

Opens a file.

Returns:
success value

Definition at line 109 of file textfile.cc.

References Gobble(), and String::Init().

Referenced by Dataset::InitFromFile(), and data::LargeLoad().

const String& TextLineReader::Peek (  )  const [inline]

Gets the current line.

Definition at line 125 of file textfile.h.

String& TextLineReader::Peek (  )  [inline]

Gets the current line.

Definition at line 118 of file textfile.h.

const String& TextLineReader::Peek (  )  const [inline]

Gets the current line.

Definition at line 125 of file textfile.h.

String& TextLineReader::Peek (  )  [inline]

The documentation for this class was generated from the following files:
Generated on Mon Jan 24 12:04:40 2011 for FASTlib by  doxygen 1.6.3