scnlib  0.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Low-level parsing operations

The functions in this category abstract away the input range under an unifying interface. More...

Functions

template<typename WrappedRange , typename std::enable_if< WrappedRange::is_direct >::type * = nullptr>
expected
< detail::ranges::range_value_t
< WrappedRange > > 
scn::read_char (WrappedRange &r)
 Reads a single character from the range. More...
 
template<typename WrappedRange , typename std::enable_if< WrappedRange::is_contiguous >::type * = nullptr>
expected< span< const typename
detail::extract_char_type
< typename
WrappedRange::iterator >::type > > 
scn::read_zero_copy (WrappedRange &r, detail::ranges::range_difference_t< WrappedRange > n)
 Reads up to n characters from r, and returns a span into the range. More...
 
template<typename WrappedRange , typename std::enable_if< WrappedRange::is_contiguous >::type * = nullptr>
expected< span< const typename
detail::extract_char_type
< typename
WrappedRange::iterator >::type > > 
scn::read_all_zero_copy (WrappedRange &r)
 Reads every character from r, and returns a span into the range. More...
 
template<typename WrappedRange , typename OutputIterator , typename std::enable_if< WrappedRange::is_contiguous >::type * = nullptr>
error scn::read_into (WrappedRange &r, OutputIterator &it, detail::ranges::range_difference_t< WrappedRange > n)
 Reads n characters from r into it. More...
 
template<typename WrappedRange , typename Predicate , typename std::enable_if< WrappedRange::is_contiguous >::type * = nullptr>
expected< span< const typename
detail::extract_char_type
< typename
WrappedRange::iterator >::type > > 
scn::read_until_space_zero_copy (WrappedRange &r, Predicate is_space, bool keep_final_space)
 Reads characters from r until a space is found (as determined by is_space), and returns a span into the range. More...
 
template<typename WrappedRange , typename OutputIterator , typename Predicate , typename std::enable_if< WrappedRange::is_contiguous >::type * = nullptr>
error scn::read_until_space (WrappedRange &r, OutputIterator &out, Predicate is_space, bool keep_final_space)
 Reads characters from r until a space is found (as determined by is_space) and writes them into out. More...
 
template<typename WrappedRange , typename OutputIterator , typename Sentinel , typename Predicate , typename std::enable_if< WrappedRange::is_direct >::type * = nullptr>
error scn::read_until_space_ranged (WrappedRange &r, OutputIterator &out, Sentinel end, Predicate is_space, bool keep_final_space)
 Reads characters from r until a space is found (as determined by is_space), or out reaches end, and writes them into out. More...
 
template<typename WrappedRange , typename std::enable_if< WrappedRange::is_contiguous >::type * = nullptr>
error scn::putback_n (WrappedRange &r, detail::ranges::range_difference_t< WrappedRange > n)
 Puts back n characters into r as if by repeatedly calling r.advance(-1) . More...
 
template<typename Context , typename std::enable_if< !Context::range_type::is_contiguous >::type * = nullptr>
error scn::skip_range_whitespace (Context &ctx) noexcept
 Reads from the range in ctx as if by repeatedly calling read_char(), until a non-space character is found (as determined by ctx.locale()), or EOF is reached. More...
 

Detailed Description

The functions in this category abstract away the input range under an unifying interface.

Function Documentation

template<typename WrappedRange , typename std::enable_if< WrappedRange::is_contiguous >::type * = nullptr>
error scn::putback_n ( WrappedRange &  r,
detail::ranges::range_difference_t< WrappedRange >  n 
)

Puts back n characters into r as if by repeatedly calling r.advance(-1) .

Definition at line 486 of file reader.h.

template<typename WrappedRange , typename std::enable_if< WrappedRange::is_contiguous >::type * = nullptr>
expected< span< const typename detail::extract_char_type< typename WrappedRange::iterator >::type > > scn::read_all_zero_copy ( WrappedRange &  r)

Reads every character from r, and returns a span into the range.

If r.begin() == r.end(), returns EOF. If the range does not satisfy contiguous_range, returns an empty span.

Definition at line 138 of file reader.h.

template<typename WrappedRange , typename std::enable_if< WrappedRange::is_direct >::type * = nullptr>
expected<detail::ranges::range_value_t<WrappedRange> > scn::read_char ( WrappedRange &  r)

Reads a single character from the range.

If r.begin() == r.end(), returns EOF. Dereferences the begin iterator, wrapping it in an expected if necessary. If the reading was successful, the range is advanced by a single character.

Definition at line 53 of file reader.h.

template<typename WrappedRange , typename OutputIterator , typename std::enable_if< WrappedRange::is_contiguous >::type * = nullptr>
error scn::read_into ( WrappedRange &  r,
OutputIterator &  it,
detail::ranges::range_difference_t< WrappedRange >  n 
)

Reads n characters from r into it.

If r.begin() == r.end() in the beginning or before advancing n characters, returns EOF. If r can't be advanced by n characters, the range is advanced by an indeterminate amout. If successful, the range is advanced by n characters.

Definition at line 176 of file reader.h.

template<typename WrappedRange , typename OutputIterator , typename Predicate , typename std::enable_if< WrappedRange::is_contiguous >::type * = nullptr>
error scn::read_until_space ( WrappedRange &  r,
OutputIterator &  out,
Predicate  is_space,
bool  keep_final_space 
)

Reads characters from r until a space is found (as determined by is_space) and writes them into out.

If r.begin() == r.end(), returns EOF.

Parameters
is_spacePredicate taking a character and returning a bool. true means, that the given character is a space.
keep_final_spaceWhether the final found space character is written into out and is advanced past.

Definition at line 321 of file reader.h.

template<typename WrappedRange , typename OutputIterator , typename Sentinel , typename Predicate , typename std::enable_if< WrappedRange::is_direct >::type * = nullptr>
error scn::read_until_space_ranged ( WrappedRange &  r,
OutputIterator &  out,
Sentinel  end,
Predicate  is_space,
bool  keep_final_space 
)

Reads characters from r until a space is found (as determined by is_space), or out reaches end, and writes them into out.

If r.begin() == r.end(), returns EOF.

Parameters
is_spacePredicate taking a character and returning a bool. true means, that the given character is a space.
keep_final_spaceWhether the final found space character is written into out and is advanced past.

Definition at line 414 of file reader.h.

template<typename WrappedRange , typename Predicate , typename std::enable_if< WrappedRange::is_contiguous >::type * = nullptr>
expected< span< const typename detail::extract_char_type< typename WrappedRange::iterator >::type > > scn::read_until_space_zero_copy ( WrappedRange &  r,
Predicate  is_space,
bool  keep_final_space 
)

Reads characters from r until a space is found (as determined by is_space), and returns a span into the range.

If r.begin() == r.end(), returns EOF. If the range does not satisfy contiguous_range, returns an empty span.

Parameters
is_spacePredicate taking a character and returning a bool. true means, that the given character is a space.
keep_final_spaceWhether the final found space character is included in the returned span, and is advanced past.

Definition at line 262 of file reader.h.

template<typename WrappedRange , typename std::enable_if< WrappedRange::is_contiguous >::type * = nullptr>
expected< span< const typename detail::extract_char_type< typename WrappedRange::iterator >::type > > scn::read_zero_copy ( WrappedRange &  r,
detail::ranges::range_difference_t< WrappedRange >  n 
)

Reads up to n characters from r, and returns a span into the range.

If r.begin() == r.end(), returns EOF. If the range does not satisfy contiguous_range, returns an empty span.

Let count be min(r.size(), n). Returns a span pointing to r.data() with the length count. Advances the range by count characters.

Definition at line 97 of file reader.h.

template<typename Context , typename std::enable_if< !Context::range_type::is_contiguous >::type * = nullptr>
error scn::skip_range_whitespace ( Context &  ctx)
noexcept

Reads from the range in ctx as if by repeatedly calling read_char(), until a non-space character is found (as determined by ctx.locale()), or EOF is reached.

That non-space character is then put back into the range.

Definition at line 1485 of file reader.h.