Vince's CSV Parser
|
A standalone header file containing shared code. More...
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <type_traits>
#include "../external/string_view.hpp"
#include "../external/hedley.h"
Go to the source code of this file.
Namespaces | |
csv | |
The all encompassing namespace. | |
csv::internals | |
Stuff that is generally not of interest to end-users. | |
Macros | |
#define | CSV_INLINE |
Helper macro which should be #defined as "inline" in the single header version. | |
#define | STATIC_ASSERT(x) static_assert(x, "Assertion failed") |
#define | IF_CONSTEXPR if |
Expands to if constexpr in C++17 and if otherwise. | |
#define | CONSTEXPR_VALUE const |
Expands to constexpr in C++17 and const otherwise. More... | |
#define | CONSTEXPR_17 inline |
#define | CONSTEXPR_14 inline |
#define | CONSTEXPR_VALUE_14 const |
#define | CONSTEXPR inline |
Expands to constexpr in decent compilers and inline otherwise. More... | |
Typedefs | |
using | csv::string_view = nonstd::string_view |
The string_view class used by this library. | |
template<bool B, class T = void> | |
using | csv::enable_if_t = typename std::enable_if< B, T >::type |
using | csv::internals::ParseFlagMap = std::array< ParseFlags, 256 > |
An array which maps ASCII chars to a parsing flag. | |
using | csv::internals::WhitespaceMap = std::array< bool, 256 > |
An array which maps ASCII chars to a flag indicating if it is whitespace. | |
Enumerations | |
enum class | csv::internals::ParseFlags { csv::internals::QUOTE_ESCAPE_QUOTE = 0 , csv::internals::QUOTE = 2 | 1 , csv::internals::NOT_SPECIAL = 4 , csv::internals::DELIMITER = 4 | 2 , csv::internals::NEWLINE = 4 | 2 | 1 } |
An enum used for describing the significance of each character with respect to CSV parsing. More... | |
Functions | |
template<typename T > | |
bool | csv::internals::is_equal (T a, T b, T epsilon=0.001) |
constexpr ParseFlags | csv::internals::quote_escape_flag (ParseFlags flag, bool quote_escape) noexcept |
Transform the ParseFlags given the context of whether or not the current field is quote escaped. | |
csv::internals::STATIC_ASSERT (ParseFlags::DELIMITER< ParseFlags::NEWLINE) | |
csv::internals::STATIC_ASSERT (quote_escape_flag(ParseFlags::NOT_SPECIAL, false)==ParseFlags::NOT_SPECIAL) | |
Optimizations for reducing branching in parsing loop. More... | |
csv::internals::STATIC_ASSERT (quote_escape_flag(ParseFlags::QUOTE, false)==ParseFlags::QUOTE) | |
csv::internals::STATIC_ASSERT (quote_escape_flag(ParseFlags::DELIMITER, false)==ParseFlags::DELIMITER) | |
csv::internals::STATIC_ASSERT (quote_escape_flag(ParseFlags::NEWLINE, false)==ParseFlags::NEWLINE) | |
csv::internals::STATIC_ASSERT (quote_escape_flag(ParseFlags::NOT_SPECIAL, true)==ParseFlags::NOT_SPECIAL) | |
csv::internals::STATIC_ASSERT (quote_escape_flag(ParseFlags::QUOTE, true)==ParseFlags::QUOTE_ESCAPE_QUOTE) | |
csv::internals::STATIC_ASSERT (quote_escape_flag(ParseFlags::DELIMITER, true)==ParseFlags::NOT_SPECIAL) | |
csv::internals::STATIC_ASSERT (quote_escape_flag(ParseFlags::NEWLINE, true)==ParseFlags::NOT_SPECIAL) | |
Variables | |
const int | csv::internals::PAGE_SIZE = 4096 |
Size of a memory page in bytes. More... | |
constexpr size_t | csv::internals::ITERATION_CHUNK_SIZE = 10000000 |
For functions that lazy load a large CSV, this determines how many bytes are read at a time. | |
constexpr int | csv::CSV_NOT_FOUND = -1 |
Integer indicating a requested column wasn't found. | |
A standalone header file containing shared code.
Definition in file common.hpp.
#define CONSTEXPR inline |
Expands to constexpr
in decent compilers and inline
otherwise.
Intended for functions and methods.
Definition at line 117 of file common.hpp.
#define CONSTEXPR_VALUE const |
Expands to constexpr
in C++17 and const
otherwise.
Mainly used for global variables.
Definition at line 85 of file common.hpp.