Wrapper for comma-separated-value (csv) files. More...
Classes | |
struct | col_data_t |
Variables | |
const char * | col_data_t::value |
| |
typedef std::vector< col_data_t > | vec_col_t |
vector of values provided to callback | |
typedef void(* | csv_callback_fn )(IN void *context, IN const vec_col_t &data) |
callback for parseCsvStream() | |
void | parseCsvStream (IN std::istream &in, IN const VecString &columns, IN csv_callback_fn callback, IN void *context) |
parse a stream of lines containing comma-separated values. |
Wrapper for comma-separated-value (csv) files.
This is for special files where: 1) columns are delimited by commas (duh), 2) the first row defines the column names (and column names are unique!), 3) all subsequent rows have the same number of columns
NOTE: the csv parser respects the orders of the input column names! If you specify the ordering as "A,B,C", you'll receive that order in the callback vector, even if the data is actually ordered as "C,A,B". Put another way: applications can assume that data is ordered in the callback data array in the exact same column order that was passed in to the parseCsvStream() call.
typedef std::vector<col_data_t> vec_col_t |
typedef void(* csv_callback_fn)(IN void *context, IN const vec_col_t &data) |
callback for parseCsvStream()
void parseCsvStream | ( | IN std::istream & | in, | |
IN const VecString & | columns, | |||
IN csv_callback_fn | callback, | |||
IN void * | context | |||
) |
parse a stream of lines containing comma-separated values.
The caller must provide:
This routine will:
const char* col_data_t::value [inherited] |