diff options
| author | Thomas Schmucker <ts@its1.de> | 2020-07-05 11:54:28 +0200 |
|---|---|---|
| committer | Thomas Schmucker <ts@its1.de> | 2020-07-05 11:54:28 +0200 |
| commit | db6807fd6644b1e129008ff9622384cef4e48654 (patch) | |
| tree | 1e7869a413caedcea433e051987df80bbb445403 /csv.h | |
| parent | 12b36ad95dc633648b6c93d7626e17a0016b4547 (diff) | |
| download | libcsv-db6807fd6644b1e129008ff9622384cef4e48654.tar.gz libcsv-db6807fd6644b1e129008ff9622384cef4e48654.tar.bz2 libcsv-db6807fd6644b1e129008ff9622384cef4e48654.zip | |
Formatiere den Quellcode mit clang-format
Diffstat (limited to 'csv.h')
| -rw-r--r-- | csv.h | 26 |
1 files changed, 13 insertions, 13 deletions
| @@ -1,14 +1,14 @@ | |||
| 1 | #pragma once | 1 | #pragma once |
| 2 | 2 | ||
| 3 | #include <stdio.h> /* FILE */ | 3 | #include <stddef.h> /* size_t */ |
| 4 | #include <stddef.h> /* size_t */ | 4 | #include <stdio.h> /* FILE */ |
| 5 | 5 | ||
| 6 | #ifdef __cplusplus | 6 | #ifdef __cplusplus |
| 7 | extern "C" { | 7 | extern "C" { |
| 8 | #endif | 8 | #endif |
| 9 | 9 | ||
| 10 | typedef enum { | 10 | typedef enum { |
| 11 | CSV_ERR_OK = 0, | 11 | CSV_ERR_OK = 0, |
| 12 | CSV_ERR_OUT_OF_MEMORY = -1, | 12 | CSV_ERR_OUT_OF_MEMORY = -1, |
| 13 | CSV_ERR_OUT_OF_RANGE = -2, | 13 | CSV_ERR_OUT_OF_RANGE = -2, |
| 14 | CSV_ERR_IO_READ = -3, | 14 | CSV_ERR_IO_READ = -3, |
| @@ -32,23 +32,23 @@ extern const csv_options_t csv_default_options; | |||
| 32 | 32 | ||
| 33 | typedef struct { | 33 | typedef struct { |
| 34 | char *str; | 34 | char *str; |
| 35 | int cap, pos; | 35 | int cap, pos; |
| 36 | } csv_string_t; | 36 | } csv_string_t; |
| 37 | 37 | ||
| 38 | typedef struct { | 38 | typedef struct { |
| 39 | int *fields; | 39 | int *fields; |
| 40 | int cap, pos; | 40 | int cap, pos; |
| 41 | } csv_field_t; | 41 | } csv_field_t; |
| 42 | 42 | ||
| 43 | typedef struct { | 43 | typedef struct { |
| 44 | const csv_options_t *csv_options; | 44 | const csv_options_t *csv_options; |
| 45 | csv_string_t csv_string; | 45 | csv_string_t csv_string; |
| 46 | csv_field_t csv_field; | 46 | csv_field_t csv_field; |
| 47 | } csv_t; | 47 | } csv_t; |
| 48 | 48 | ||
| 49 | /* initialization */ | 49 | /* initialization */ |
| 50 | void csv_init(csv_t *csv); | 50 | void csv_init(csv_t *csv); |
| 51 | void csv_init_opt(csv_t *csv, const csv_options_t * const csv_options); | 51 | void csv_init_opt(csv_t *csv, const csv_options_t *const csv_options); |
| 52 | 52 | ||
| 53 | /* cleanup after error */ | 53 | /* cleanup after error */ |
| 54 | void csv_cleanup(csv_t *csv); | 54 | void csv_cleanup(csv_t *csv); |
| @@ -57,15 +57,15 @@ void csv_cleanup(csv_t *csv); | |||
| 57 | int csv_read(csv_t *csv, FILE *in); | 57 | int csv_read(csv_t *csv, FILE *in); |
| 58 | 58 | ||
| 59 | /* field access */ | 59 | /* field access */ |
| 60 | int csv_nfields(const csv_t * const csv); | 60 | int csv_nfields(const csv_t *const csv); |
| 61 | const char * csv_field(const csv_t * const csv, int idx); | 61 | const char *csv_field(const csv_t *const csv, int idx); |
| 62 | 62 | ||
| 63 | /* write */ | 63 | /* write */ |
| 64 | void csv_write(FILE *out, const csv_t * const csv); | 64 | void csv_write(FILE *out, const csv_t *const csv); |
| 65 | void csv_write_ex(FILE *out, int n, const char *fields[], const csv_options_t * const csv_options); | 65 | void csv_write_ex(FILE *out, int n, const char *fields[], const csv_options_t *const csv_options); |
| 66 | 66 | ||
| 67 | /* error handling */ | 67 | /* error handling */ |
| 68 | const char * csv_err_str(csv_err_t csv_err); | 68 | const char *csv_err_str(csv_err_t csv_err); |
| 69 | 69 | ||
| 70 | #ifdef __cplusplus | 70 | #ifdef __cplusplus |
| 71 | } | 71 | } |
