csvpp 1.2.0
CSV parsing / writing libraries
Loading...
Searching...
No Matches
Typedefs | Functions
CSV_row

A dynamic array of strings. More...

Collaboration diagram for CSV_row:

Typedefs

typedef struct CSV_row CSV_row
 

Functions

CSV_row * CSV_row_init (void)
 Create a new CSV_row.
 
void CSV_row_free (CSV_row *rec)
 Free a CSV_row.
 
void CSV_row_append (CSV_row *rec, char *field)
 Append a new field.
 
size_t CSV_row_size (const CSV_row *rec)
 Get CSV_Record array size.
 
const char * CSV_row_get (const CSV_row *rec, size_t i)
 CSV_row array element access.
 
CSV_status CSV_row_read_v (CSV_row *rec,...)
 Reads fields into variadic arguments.
 
const char *const * CSV_row_arr (const CSV_row *rec)
 CSV_row array access.
 

Detailed Description

A dynamic array of strings.

Used as input to CSV_writer_write_row() and output from CSV_reader_read_row()

Function Documentation

◆ CSV_row_append()

void CSV_row_append ( CSV_row * rec,
char * field )

Append a new field.

Parameters
fieldString to append to the array. rec will take ownership of the field and will free it when CSV_row_free() is called on it

◆ CSV_row_arr()

const char *const * CSV_row_arr ( const CSV_row * rec)

CSV_row array access.

Returns
char * array within CSV_row (read only). May be useful for passing to other libraries

◆ CSV_row_free()

void CSV_row_free ( CSV_row * rec)

Free a CSV_row.

Will also free all strings added by CSV_row_append()

◆ CSV_row_get()

const char * CSV_row_get ( const CSV_row * rec,
size_t i )

CSV_row array element access.

Parameters
iindex to access
Returns
string at index i (read-only - use CSV_strdup if you need a permanent copy)

◆ CSV_row_init()

CSV_row * CSV_row_init ( void )

Create a new CSV_row.

Returns
New CSV_row. Free with CSV_row_free()

◆ CSV_row_read_v()

CSV_status CSV_row_read_v ( CSV_row * rec,
... )

Reads fields into variadic arguments.

Parameters
[out]...char** variables to read into(read only). Last argument must be NULL If more parameters are passed than there are fields in the row, the remaining parameters will be set to NULL. Fewer parameters than contained in the row may be passed, resulting in only the first fields being copied The char *'s written out are owned by the CSV_row object, and shouldn't be freed
Returns
CSV_OK on successful read
CSV_TOO_MANY_FIELDS_WARNING when there are more parameters than fields

◆ CSV_row_size()

size_t CSV_row_size ( const CSV_row * rec)

Get CSV_Record array size.

Returns
Size of array