Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Public Member Functions | Private Attributes

CsvFile Class Reference
[File IO]

This class handles csv files. Currently only loading is implemented. More...

#include <OpenMS/FORMAT/CsvFile.h>

Inheritance diagram for CsvFile:
TextFile StringList

List of all members.

Public Member Functions

 CsvFile ()
 Default constructor.
virtual ~CsvFile ()
 destructor
 CsvFile (const String &filename, char is= ',', bool ie=false, Int first_n=-1)
 Constructor with filename.
void fload (const String &filename, char is= ',', bool ie=false, Int first_n=-1)
 Loads data from a text file.
bool getRow (Size row, StringList &list)
 writes all items from a row to list

Private Attributes

char itemseperator_
bool itemenclosed_

Detailed Description

This class handles csv files. Currently only loading is implemented.

Note:
items are allowed to be enclosed by only one character e.g. "item" where " is enclosing character

Constructor & Destructor Documentation

CsvFile (  ) 

Default constructor.

virtual ~CsvFile (  )  [virtual]

destructor

CsvFile ( const String filename,
char  is = ',',
bool  ie = false,
Int  first_n = -1 
)

Constructor with filename.

Parameters:
filename The input file name.
is character which separates the items.
ie Whether or not every item is enclosed.
first_n Only the given number of lines are read, starting from the beginning of the file.
Exceptions:
Exception::FileNotFound is thrown if the file could not be opened.

Member Function Documentation

void fload ( const String filename,
char  is = ',',
bool  ie = false,
Int  first_n = -1 
)

Loads data from a text file.

Parameters:
filename The input file name.
is character which separates the items.
ie Whether or not every item is enclosed.
first_n Only the given number of lines are read, starting from the beginning of the file.
Exceptions:
Exception::FileNotFound is thrown if the file could not be opened.
bool getRow ( Size  row,
StringList list 
)

writes all items from a row to list

Parameters:
row the row which will be read
list StringList which will contain all items of the row
Exceptions:
Exception::InvalidIterator is thrown if the row is not existing
Returns:
returns false if the given row could not be separated into items

Member Data Documentation

bool itemenclosed_ [private]
char itemseperator_ [private]

OpenMS / TOPP release 1.10.0 Documentation generated on Thu Mar 7 2013 09:42:53 using doxygen 1.7.1