csv-parser 1.1.0
Csv::Parser (csv-parser)
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
Csv::LocaleUnawareBehaviorPolicy Struct Reference

This policy controls the behavior of the parser. More...

#include <csv_policies.h>

Static Public Member Functions

static constexpr bool useEmptyCellType () noexcept
 If true, empty cell type is a separate type from (empty) string.
 
template<typename Number >
static constexpr std::optional< Number > readNumber (std::string_view cell)
 Try to read a numeric value from string data.
 
template<typename CellT >
static constexpr CellT create (std::string_view cell, CellTypeHint hint)
 Create an object of type CellT from cell contents represented as string_view.
 

Detailed Description

This policy controls the behavior of the parser.

This version does not use locale-aware number conversion. This policy is faster, but less compatible with pre-C++20/23 compilers due to limited std::from_chars() support. However, it allows compile-time parsing of integral types.

Member Function Documentation

◆ create()

template<typename CellT >
static constexpr CellT Csv::LocaleUnawareBehaviorPolicy::create ( std::string_view  cell,
CellTypeHint  hint 
)
inlinestaticconstexpr

Create an object of type CellT from cell contents represented as string_view.

By default, it handles Cell* classes (CellReference, etc.) and primitive numeric types (long int, double, etc.).

◆ readNumber()

template<typename Number >
static constexpr std::optional< Number > Csv::LocaleUnawareBehaviorPolicy::readNumber ( std::string_view  cell)
inlinestaticconstexpr

Try to read a numeric value from string data.

See also
Csv::readNumberNoLocale().

◆ useEmptyCellType()

static constexpr bool Csv::LocaleUnawareBehaviorPolicy::useEmptyCellType ( )
inlinestaticconstexprnoexcept

If true, empty cell type is a separate type from (empty) string.

Default: true.


The documentation for this struct was generated from the following file: