A class with some handy functions to manipulate ASCII text files.
More...
#include <TextFileUtils.h>
|
static Rows | ReadTabSeparatedLineFromTextFile (std::string inFileName) |
| Reads a text file where fields on a line are separated by tabs Reference http://stackoverflow.com/questions/1075712/reading-delimited-files-in-c. More...
|
|
static std::vector< std::string > | ReadLinesFromTextFile (std::string inFileName) |
| Reads single-word lines from a text file. More...
|
|
static bool | FilterText (std::string inFileName, std::string outFileName, int *pFilterValues, int filterLength, int nrColumnsToFilter, int nrOtherColumns) |
| Filters a text file with numbers, keeping only valid rows The first columns contain values to be filtered; only if all those values in these columns are valid, the row is kept. More...
|
|
static bool | SaveVectorOfValuesToTextFile (std::vector< double > inVector, std::string outFileName) |
| Saves the values in a vector of doubles to a text file. More...
|
|
static bool | SaveVectorOfValuesToTextFile (std::vector< int > inVector, std::string outFileName) |
| Saves the values in a vector of integers to a text file. More...
|
|
static bool | SaveVectorOfIntensityPointsToTextFile (std::vector< common::IntensityPoint > inVector, std::string outFileName) |
| Saves the values in a vector of doubles to a text file. More...
|
|
A class with some handy functions to manipulate ASCII text files.
bool stira::common::TextFileUtils::FilterText |
( |
std::string |
inFileName, |
|
|
std::string |
outFileName, |
|
|
int * |
pFilterValues, |
|
|
int |
filterLength, |
|
|
int |
nrColumnsToFilter, |
|
|
int |
nrOtherColumns |
|
) |
| |
|
static |
Filters a text file with numbers, keeping only valid rows The first columns contain values to be filtered; only if all those values in these columns are valid, the row is kept.
- Parameters
-
inFileName | file name for input data |
outFileName | file name for output datap |
pFilterValues | array with the valid values: if all of the first nrColumnsToFilter have values that are also in the array, the row is kept |
filterLength | length of array with valid values |
nrColumnsToFilter | how many columns must contain values that are in pFilterValue |
nrOtherColumns | nr of other columns to copy when a row is valid |
std::vector< std::string > stira::common::TextFileUtils::ReadLinesFromTextFile |
( |
std::string |
inFileName | ) |
|
|
static |
Reads single-word lines from a text file.
- Parameters
-
inFileName | file name to read from |
- Returns
- vector of strings per line
Rows stira::common::TextFileUtils::ReadTabSeparatedLineFromTextFile |
( |
std::string |
inFileName | ) |
|
|
static |
bool stira::common::TextFileUtils::SaveVectorOfIntensityPointsToTextFile |
( |
std::vector< common::IntensityPoint > |
inVector, |
|
|
std::string |
outFileName |
|
) |
| |
|
static |
Saves the values in a vector of doubles to a text file.
- Parameters
-
inVector | vector with values to be written |
outFileName | file name for output data |
bool stira::common::TextFileUtils::SaveVectorOfValuesToTextFile |
( |
std::vector< double > |
inVector, |
|
|
std::string |
outFileName |
|
) |
| |
|
static |
Saves the values in a vector of doubles to a text file.
- Parameters
-
inVector | vector with values to be written |
outFileName | file name for output data |
bool stira::common::TextFileUtils::SaveVectorOfValuesToTextFile |
( |
std::vector< int > |
inVector, |
|
|
std::string |
outFileName |
|
) |
| |
|
static |
Saves the values in a vector of integers to a text file.
- Parameters
-
inVector | vector with values to be written |
outFileName | file name for output data |
The documentation for this class was generated from the following files:
- common/common/TextFileUtils.h
- common/common/TextFileUtils.cpp