Public Member Functions | |
ColumnTextParser (std::string CommentLineSymbol="", std::string Delimiter=" \t\r\n") | |
~ColumnTextParser () | |
bool | loadFromFile (std::string Filename) |
bool | setFromString (std::string Contents, unsigned int ColumnsNbr) |
std::string | getValue (unsigned int Line, unsigned int Column) |
bool | getStringValue (unsigned int Line, unsigned int Column, std::string *Value) |
bool | getLongValue (unsigned int Line, unsigned int Column, long *Value) |
bool | getDoubleValue (unsigned int Line, unsigned int Column, double *Value) |
std::vector< std::string > | getValues (unsigned int Line) |
int | getLinesCount () const |
int | getColsCount () const |
void | streamContents (std::ostream &OStream) |
Class for column file management and handling
openfluid::tools::ColumnTextParser::ColumnTextParser | ( | std::string | CommentLineSymbol = "" , |
std::string | Delimiter = " \t\r\n" |
||
) |
Constructor
Destructor
int openfluid::tools::ColumnTextParser::getColsCount | ( | ) | const [inline] |
Returns the number of columns
bool openfluid::tools::ColumnTextParser::getDoubleValue | ( | unsigned int | Line, |
unsigned int | Column, | ||
double * | Value | ||
) |
Gets the value at a specified row-column, as a double precision float
[in] | Line | the line number of the value (first line is 0) |
[in] | Column | the column number of the value (first column is 0) |
[out] | Value | the requested value if exists |
int openfluid::tools::ColumnTextParser::getLinesCount | ( | ) | const [inline] |
Returns the number of lines
bool openfluid::tools::ColumnTextParser::getLongValue | ( | unsigned int | Line, |
unsigned int | Column, | ||
long * | Value | ||
) |
Gets the value at a specified row-column, as a long int
[in] | Line | the line number of the value (first line is 0) |
[in] | Column | the column number of the value (first column is 0) |
[out] | Value | the requested value if exists |
bool openfluid::tools::ColumnTextParser::getStringValue | ( | unsigned int | Line, |
unsigned int | Column, | ||
std::string * | Value | ||
) |
Gets the value at a specified row-column, as a string
[in] | Line | the line number of the value (first line is 0) |
[in] | Column | the column number of the value (first column is 0) |
[out] | Value | the requested value if exists |
std::string openfluid::tools::ColumnTextParser::getValue | ( | unsigned int | Line, |
unsigned int | Column | ||
) |
Returns the value at a specified row-column, as a string
[in] | Line | the line number of the value (first line is 0) |
[in] | Column | the column number of the value (first column is 0) |
std::vector<std::string> openfluid::tools::ColumnTextParser::getValues | ( | unsigned int | Line | ) |
Returns the values at a specified line
[in] | Line | the line number of the value (first line is 0) |
bool openfluid::tools::ColumnTextParser::loadFromFile | ( | std::string | Filename | ) |
Loads a column text file
[in] | Filename | the full path of the file to load |
bool openfluid::tools::ColumnTextParser::setFromString | ( | std::string | Contents, |
unsigned int | ColumnsNbr | ||
) |
Parses a one-line delimiter-separated string to set contents ex: "147.2 18 15 25 36 51.3 25.1 15", for 4 columns
[in] | Contents | the string to parse |
[in] | ColumnsNbr | the number of columns (for splitting the sting into lines) |
void openfluid::tools::ColumnTextParser::streamContents | ( | std::ostream & | OStream | ) |