13 # ifndef WIN32_LEAN_AND_MEAN
14 # define WIN32_LEAN_AND_MEAN
19 #elif defined(__linux__)
29 #include <type_traits>
31 #include "../external/string_view.hpp"
36 #include "../external/hedley.h"
40 #pragma region Compatibility Macros
55 #define STATIC_ASSERT(x) static_assert(x, "Assertion failed")
57 #if CMAKE_CXX_STANDARD == 17 || __cplusplus >= 201703L
61 #if CMAKE_CXX_STANDARD >= 14 || __cplusplus >= 201402L
66 #include <string_view>
79 #define IF_CONSTEXPR if constexpr
80 #define CONSTEXPR_VALUE constexpr
82 #define CONSTEXPR_17 constexpr
84 #define IF_CONSTEXPR if
85 #define CONSTEXPR_VALUE const
87 #define CONSTEXPR_17 inline
91 template<
bool B,
class T =
void>
92 using enable_if_t = std::enable_if_t<B, T>;
94 #define CONSTEXPR_14 constexpr
95 #define CONSTEXPR_VALUE_14 constexpr
97 template<
bool B,
class T =
void>
98 using enable_if_t =
typename std::enable_if<B, T>::type;
100 #define CONSTEXPR_14 inline
101 #define CONSTEXPR_VALUE_14 const
106 #if defined __GNUC__ && !defined __clang__
107 #if (__GNUC__ >= 7 &&__GNUC_MINOR__ >= 2) || (__GNUC__ >= 8)
108 #define CONSTEXPR constexpr
112 #define CONSTEXPR constexpr
117 #define CONSTEXPR inline
124 namespace internals {
126 #if defined(PAGE_SIZE)
132 inline int getpagesize() {
133 _SYSTEM_INFO sys_info = {};
134 GetSystemInfo(&sys_info);
135 return std::max(sys_info.dwPageSize, sys_info.dwAllocationGranularity);
139 #elif defined(__linux__)
154 inline bool is_equal(T a, T b, T epsilon = 0.001) {
156 static_assert(std::is_floating_point<T>::value,
"T must be a floating point type.");
157 return std::abs(a - b) < epsilon;
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
For functions that lazy load a large CSV, this determines how many bytes are read at a time.
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.
The all encompassing namespace.
constexpr int CSV_NOT_FOUND
Integer indicating a requested column wasn't found.
nonstd::string_view string_view
The string_view class used by this library.