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

Functions in this category return a scan_result<Range, error>. More...

Functions

template<typename Range , typename String , typename CharT >
auto scn::getline (Range &&r, String &str, CharT until) -> decltype(detail::getline_impl(std::declval< decltype(detail::wrap(std::forward< Range >(r)))& >(), str, until))
 Read the range in r into str until until is found. More...
 
template<typename Range , typename String , typename CharT = typename detail::extract_char_type<detail::ranges::iterator_t< detail::range_wrapper_for_t<Range>>>::type>
auto scn::getline (Range &&r, String &str) -> decltype(getline(std::forward< Range >(r), str, detail::ascii_widen< CharT >('\n')))
 Equivalent to getline with the last parameter set to '\n' with the appropriate character type. More...
 
template<typename Range , typename CharT >
auto scn::ignore_until (Range &&r, CharT until) -> decltype(detail::ignore_until_impl(std::declval< decltype(detail::wrap(std::forward< Range >(r)))& >(), until))
 Advances the beginning of r until until is found. More...
 
template<typename Range , typename CharT >
auto scn::ignore_until_n (Range &&r, detail::ranges::range_difference_t< Range > n, CharT until) -> decltype(detail::ignore_until_n_impl(std::declval< decltype(detail::wrap(std::forward< Range >(r)))& >(), n, until))
 Advances the beginning of r until until is found, or the beginning has been advanced n times. More...
 
template<typename Range , typename Container , typename CharT >
auto scn::scan_list (Range &&r, Container &c, CharT separator) -> detail::scan_result_for_range_t< Range, wrapped_error >
 Reads values repeatedly from r and writes them into c. More...
 

Detailed Description

Functions in this category return a scan_result<Range, error>.

It has the following member functions:

Function Documentation

template<typename Range , typename String , typename CharT >
auto scn::getline ( Range &&  r,
String &  str,
CharT  until 
) -> decltype(detail::getline_impl( std::declval<decltype(detail::wrap(std::forward<Range>(r)))&>(), str, until))

Read the range in r into str until until is found.

r and str must share character types, which must be CharT.

If str is convertible to a basic_string_view:

  • And if r is a contiguous_range:
    • str is set to point inside r with the appropriate length
  • if not, returns an error

Otherwise, clears str by calling str.clear(), and then reads the range into str as if by repeatedly calling str.push_back. str.reserve is also required to be present.

Definition at line 417 of file scan.h.

template<typename Range , typename String , typename CharT = typename detail::extract_char_type<detail::ranges::iterator_t< detail::range_wrapper_for_t<Range>>>::type>
auto scn::getline ( Range &&  r,
String &  str 
) -> decltype( getline(std::forward<Range>(r), str, detail::ascii_widen<CharT>('\n')))

Equivalent to getline with the last parameter set to '\n' with the appropriate character type.

In other words, reads r into str until '\n' is found.

The character type is determined by r.

Definition at line 441 of file scan.h.

template<typename Range , typename CharT >
auto scn::ignore_until ( Range &&  r,
CharT  until 
) -> decltype(detail::ignore_until_impl( std::declval<decltype(detail::wrap(std::forward<Range>(r)))&>(), until))

Advances the beginning of r until until is found.

The character type of r must be CharT.

Definition at line 557 of file scan.h.

template<typename Range , typename CharT >
auto scn::ignore_until_n ( Range &&  r,
detail::ranges::range_difference_t< Range >  n,
CharT  until 
) -> decltype(detail::ignore_until_n_impl( std::declval<decltype(detail::wrap(std::forward<Range>(r)))&>(), n, until))

Advances the beginning of r until until is found, or the beginning has been advanced n times.

The character type of r must be CharT.

Definition at line 581 of file scan.h.

template<typename Range , typename Container , typename CharT >
auto scn::scan_list ( Range &&  r,
Container &  c,
CharT  separator 
) -> detail::scan_result_for_range_t<Range, wrapped_error>

Reads values repeatedly from r and writes them into c.

The values read are of type Container::value_type, and they are written into c using c.push_back. The values must be separated by whitespace, and by a separator character separator, if specified. If separator == 0, no separator character is expected.

Definition at line 610 of file scan.h.