13# ifndef WIN32_LEAN_AND_MEAN
14# define WIN32_LEAN_AND_MEAN
19#elif defined(__linux__)
32#if defined(__clang__) || defined(__GNUC__)
33 #define CSV_CONST __attribute__((__const__))
34 #define CSV_PURE __attribute__((__pure__))
35 #define CSV_PRIVATE __attribute__((__visibility__("hidden")))
36 #define CSV_NON_NULL(...) __attribute__((__nonnull__(__VA_ARGS__)))
37#elif defined(_MSC_VER)
41 #define CSV_NON_NULL(...)
46 #define CSV_NON_NULL(...)
49#if defined(__GNUC__) || defined(__clang__)
50 #define CSV_UNREACHABLE() __builtin_unreachable()
51#elif defined(_MSC_VER)
52 #define CSV_UNREACHABLE() __assume(0)
54 #define CSV_UNREACHABLE() abort()
59#pragma region Compatibility Macros
74#define STATIC_ASSERT(x) static_assert(x, "Assertion failed")
76#if (defined(CMAKE_CXX_STANDARD) && CMAKE_CXX_STANDARD == 20) || __cplusplus >= 202002L
80#if (defined(CMAKE_CXX_STANDARD) && CMAKE_CXX_STANDARD == 17) || __cplusplus >= 201703L
84#if (defined(CMAKE_CXX_STANDARD) && CMAKE_CXX_STANDARD >= 14) || __cplusplus >= 201402L
95#include "../external/string_view.hpp"
103 #define IF_CONSTEXPR if constexpr
104 #define CONSTEXPR_VALUE constexpr
106 #define CONSTEXPR_17 constexpr
108 #define IF_CONSTEXPR if
109 #define CONSTEXPR_VALUE const
111 #define CONSTEXPR_17 inline
115 template<
bool B,
class T =
void>
116 using enable_if_t = std::enable_if_t<B, T>;
118 #define CONSTEXPR_14 constexpr
119 #define CONSTEXPR_VALUE_14 constexpr
121 template<
bool B,
class T =
void>
122 using enable_if_t =
typename std::enable_if<B, T>::type;
124 #define CONSTEXPR_14 inline
125 #define CONSTEXPR_VALUE_14 const
129 template<
typename F,
typename... Args>
130 using invoke_result_t =
typename std::invoke_result<F, Args...>::type;
132 template<
typename F,
typename... Args>
133 using invoke_result_t =
typename std::result_of<F(Args...)>::type;
138#if defined __GNUC__ && !defined __clang__
139 #if (__GNUC__ >= 7 &&__GNUC_MINOR__ >= 2) || (__GNUC__ >= 8)
140 #define CONSTEXPR constexpr
144 #define CONSTEXPR constexpr
149#define CONSTEXPR inline
156 namespace internals {
158#if defined(PAGE_SIZE)
171#elif defined(__linux__)
195 static_assert(std::is_floating_point<T>::value,
"T must be a floating point type.");
249 constexpr unsigned CHAR_OFFSET = std::numeric_limits<char>::is_signed ? 128 : 0;
std::array< ParseFlags, 256 > ParseFlagMap
An array which maps ASCII chars to a parsing flag.
std::array< bool, 256 > WhitespaceMap
An array which maps ASCII chars to a flag indicating if it is whitespace.
constexpr size_t ITERATION_CHUNK_SIZE
Chunk size for lazy-loading large CSV files.
bool is_equal(T a, T b, T epsilon=0.001)
const int PAGE_SIZE
Size of a memory page in bytes.
ParseFlags
An enum used for describing the significance of each character with respect to CSV parsing.
@ QUOTE_ESCAPE_QUOTE
A quote inside or terminating a quote_escaped field.
@ NOT_SPECIAL
Characters with no special meaning or escaped delimiters and newlines.
@ NEWLINE
Characters which signify a new row.
@ QUOTE
Characters which may signify a quote escape.
@ DELIMITER
Characters which signify a new field.
constexpr ParseFlags 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_CONST CONSTEXPR_17 OutArray arrayToDefault(T &&value)
Helper constexpr function to initialize an array with all the elements set to value.
The all encompassing namespace.
constexpr int CSV_NOT_FOUND
Integer indicating a requested column wasn't found.
constexpr unsigned CHAR_OFFSET
Offset to convert char into array index.
nonstd::string_view string_view
The string_view class used by this library.