diff options
| author | Murilo Ijanc <[email protected]> | 2026-07-26 12:28:10 -0300 |
|---|---|---|
| committer | Murilo Ijanc <[email protected]> | 2026-07-26 12:28:10 -0300 |
| commit | b71faa6e95a0736f1ff171e006b171467b65db90 (patch) | |
| tree | 7580c3ab515e8f50726dc68dbc240995ff4a1a4c /src/csv.hpp | |
| download | cpp-b71faa6e95a0736f1ff171e006b171467b65db90.tar.gz | |
Initial importv0.1.0
Diffstat (limited to 'src/csv.hpp')
| -rw-r--r-- | src/csv.hpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/csv.hpp b/src/csv.hpp new file mode 100644 index 0000000..485d8a5 --- /dev/null +++ b/src/csv.hpp @@ -0,0 +1,21 @@ +#ifndef CEPIS_SRC_CSV_HPP +#define CEPIS_SRC_CSV_HPP + +#include <string> +#include <string_view> +#include <vector> + +namespace cepis::detail { + +/// Parses RFC 4180 CSV into rows of fields. +/// +/// Values may contain commas, quotes and newlines when double-quoted, with +/// `""` as the escape — splitting on `,` would corrupt exactly the street +/// names most likely to matter. A leading UTF-8 BOM is dropped, `\r\n` and +/// `\n` both end a record, and a trailing newline does not produce an empty +/// final row. +std::vector<std::vector<std::string>> parse_csv(std::string_view text); + +} // namespace cepis::detail + +#endif // CEPIS_SRC_CSV_HPP |