Vince's CSV Parser
Loading...
Searching...
No Matches
mmap.hpp
1#pragma once
2
3#include "driver.hpp"
4
5#if !defined(__EMSCRIPTEN__)
6namespace csv {
7 namespace internals {
8 namespace parser {
24 public:
26 csv::string_view filename,
27 const CSVFormat& format,
28 const ColNamesPtr& col_names = nullptr
29 );
30
32
33 std::string& get_csv_head() override {
34 // head_ was already populated in the constructor.
35 return this->head_;
36 }
37
38 void next(size_t bytes) override;
39
40 private:
44 bool finalize_loaded_chunk(
45 csv::string_view chunk,
46 std::shared_ptr<void> owner,
47 size_t length,
48 size_t chunk_size
49 );
50
51 size_t read_window_size(size_t chunk_size) const noexcept;
52
53 std::string _filename;
54 size_t mmap_pos = 0;
55 std::string head_;
56 };
57 }
58 }
59}
60#endif
Stores information about how to parse a CSV file.
Abstract base class for source adapters.
Definition driver.hpp:182
Parser for memory-mapped files.
Definition mmap.hpp:23
void next(size_t bytes) override
Parse the next block of data.
Definition mmap.cpp:65
Contains CSV parser source-adapter declarations and format helpers.
The all encompassing namespace.
std::string_view string_view
The string_view class used by this library.
Definition common.hpp:182