Vince's CSV Parser
Loading...
Searching...
No Matches
raw_csv_data.hpp
Go to the documentation of this file.
1
10#pragma once
11
12#include <memory>
13
14#include "col_names.hpp"
15#include "common.hpp"
16#include "memory/field_scalar_list.hpp"
17#include "memory/quote_arena.hpp"
18#include "memory/raw_csv_field.hpp"
19#include "memory/raw_csv_field_list.hpp"
20
21namespace csv {
22 namespace internals {
23 class JsonConverter;
24
25 using memory::CSVFieldScalarList;
26 using memory::RawCSVField;
27 using memory::RawCSVFieldList;
28 using memory::RawCSVQuoteArena;
29
35 struct RawCSVData {
36 std::shared_ptr<void> _data = nullptr;
37 csv::string_view data = "";
38
40 size_t source_start = 0;
41
42 internals::RawCSVFieldList fields;
43
45 internals::CSVFieldScalarList field_scalars;
46
48 internals::RawCSVQuoteArena quote_arena;
49
51 mutable internals::lazy_shared_ptr<JsonConverter> json_converter;
52
53 internals::ColNamesPtr col_names = nullptr;
54 internals::ParseFlagMap parse_flags;
56
60 bool has_ws_trimming = false;
61
62 bool has_field_scalars() const noexcept {
63 return !this->field_scalars.empty();
64 }
65 };
66
67 using RawCSVDataPtr = std::shared_ptr<RawCSVData>;
68 }
69}
A standalone header file containing shared code.
std::array< ParseFlags, 256 > ParseFlagMap
An array which maps ASCII chars to a parsing flag.
Definition common.hpp:481
std::array< bool, 256 > WhitespaceMap
An array which maps ASCII chars to a flag indicating if it is whitespace.
Definition common.hpp:484
The all encompassing namespace.
std::string_view string_view
The string_view class used by this library.
Definition common.hpp:176
A class for storing raw CSV data and associated metadata.
internals::RawCSVQuoteArena quote_arena
Parser-time sidecar bytes for fields whose quoted contents contained doubled quotes.
bool has_ws_trimming
True when at least one whitespace trim character is configured.
internals::lazy_shared_ptr< JsonConverter > json_converter
Cached JSON converter for rows sharing this parsed backing storage.
internals::CSVFieldScalarList field_scalars
Optional parser-time scalar sidecar; empty unless eager classification is enabled.
size_t source_start
Absolute byte offset where this parsed chunk starts in the source.