asio::read_until


Functions

template<typename SyncReadStream, typename Allocator>
std::size_t asio::read_until (SyncReadStream &s, asio::basic_streambuf< Allocator > &b, char delim)
 Read data into a streambuf until a delimiter is encountered.
template<typename SyncReadStream, typename Allocator>
std::size_t asio::read_until (SyncReadStream &s, asio::basic_streambuf< Allocator > &b, char delim, asio::error_code &ec)
 Read data into a streambuf until a delimiter is encountered.
template<typename SyncReadStream, typename Allocator>
std::size_t asio::read_until (SyncReadStream &s, asio::basic_streambuf< Allocator > &b, const std::string &delim)
 Read data into a streambuf until a delimiter is encountered.
template<typename SyncReadStream, typename Allocator>
std::size_t asio::read_until (SyncReadStream &s, asio::basic_streambuf< Allocator > &b, const std::string &delim, asio::error_code &ec)
 Read data into a streambuf until a delimiter is encountered.
template<typename SyncReadStream, typename Allocator>
std::size_t asio::read_until (SyncReadStream &s, asio::basic_streambuf< Allocator > &b, const boost::regex &expr)
 Read data into a streambuf until a regular expression is located.
template<typename SyncReadStream, typename Allocator>
std::size_t asio::read_until (SyncReadStream &s, asio::basic_streambuf< Allocator > &b, const boost::regex &expr, asio::error_code &ec)
 Read data into a streambuf until a regular expression is located.

Function Documentation

template<typename SyncReadStream, typename Allocator>
std::size_t asio::read_until ( SyncReadStream &  s,
asio::basic_streambuf< Allocator > &  b,
const boost::regex &  expr,
asio::error_code ec 
) [inline]

Read data into a streambuf until a regular expression is located.

This function is used to read data into the specified streambuf until the streambuf's get area contains some data that matches a regular expression. The call will block until one of the following conditions is true:

  • A substring of the streambuf's get area matches the regular expression.
This operation is implemented in terms of zero or more calls to the stream's read_some function. If the streambuf's get area already contains data that matches the regular expression, the function returns immediately.

Parameters:
s The stream from which the data is to be read. The type must support the SyncReadStream concept.
b A streambuf object into which the data will be read.
expr The regular expression.
ec Set to indicate what error occurred, if any.
Returns:
The number of bytes in the streambuf's get area up to and including the substring that matches the regular expression. Returns 0 if an error occurred.

Definition at line 205 of file read_until.ipp.

References asio::basic_streambuf< Allocator >::commit(), asio::basic_streambuf< Allocator >::data(), asio::placeholders::iterator, asio::basic_streambuf< Allocator >::max_size(), asio::detail::error_base< T >::not_found, asio::basic_streambuf< Allocator >::prepare(), and asio::basic_streambuf< Allocator >::size().

template<typename SyncReadStream, typename Allocator>
std::size_t asio::read_until ( SyncReadStream &  s,
asio::basic_streambuf< Allocator > &  b,
const boost::regex &  expr 
) [inline]

Read data into a streambuf until a regular expression is located.

This function is used to read data into the specified streambuf until the streambuf's get area contains some data that matches a regular expression. The call will block until one of the following conditions is true:

  • A substring of the streambuf's get area matches the regular expression.
This operation is implemented in terms of zero or more calls to the stream's read_some function. If the streambuf's get area already contains data that matches the regular expression, the function returns immediately.

Parameters:
s The stream from which the data is to be read. The type must support the SyncReadStream concept.
b A streambuf object into which the data will be read.
expr The regular expression.
Returns:
The number of bytes in the streambuf's get area up to and including the substring that matches the regular expression.
Exceptions:
asio::system_error Thrown on failure.
Example
To read data into a streambuf until a CR-LF sequence is encountered:
 asio::streambuf b;
 asio::read_until(s, b, boost::regex("\r\n"));
 std::istream is(&b);
 std::string line;
 std::getline(is, line); 

Definition at line 195 of file read_until.ipp.

References asio::placeholders::bytes_transferred, asio::read_until(), and asio::detail::throw_error().

template<typename SyncReadStream, typename Allocator>
std::size_t asio::read_until ( SyncReadStream &  s,
asio::basic_streambuf< Allocator > &  b,
const std::string &  delim,
asio::error_code ec 
) [inline]

Read data into a streambuf until a delimiter is encountered.

This function is used to read data into the specified streambuf until the streambuf's get area contains the specified delimiter. The call will block until one of the following conditions is true:

  • The get area of the streambuf contains the specified delimiter.
This operation is implemented in terms of zero or more calls to the stream's read_some function. If the streambuf's get area already contains the delimiter, the function returns immediately.

Parameters:
s The stream from which the data is to be read. The type must support the SyncReadStream concept.
b A streambuf object into which the data will be read.
delim The delimiter string.
ec Set to indicate what error occurred, if any.
Returns:
The number of bytes in the streambuf's get area up to and including the delimiter. Returns 0 if an error occurred.

Definition at line 139 of file read_until.ipp.

References asio::basic_streambuf< Allocator >::commit(), asio::basic_streambuf< Allocator >::data(), asio::placeholders::iterator, asio::basic_streambuf< Allocator >::max_size(), asio::detail::error_base< T >::not_found, asio::detail::partial_search(), asio::basic_streambuf< Allocator >::prepare(), and asio::basic_streambuf< Allocator >::size().

template<typename SyncReadStream, typename Allocator>
std::size_t asio::read_until ( SyncReadStream &  s,
asio::basic_streambuf< Allocator > &  b,
const std::string &  delim 
) [inline]

Read data into a streambuf until a delimiter is encountered.

This function is used to read data into the specified streambuf until the streambuf's get area contains the specified delimiter. The call will block until one of the following conditions is true:

  • The get area of the streambuf contains the specified delimiter.
This operation is implemented in terms of zero or more calls to the stream's read_some function. If the streambuf's get area already contains the delimiter, the function returns immediately.

Parameters:
s The stream from which the data is to be read. The type must support the SyncReadStream concept.
b A streambuf object into which the data will be read.
delim The delimiter string.
Returns:
The number of bytes in the streambuf's get area up to and including the delimiter.
Exceptions:
asio::system_error Thrown on failure.
Example
To read data into a streambuf until a newline is encountered:
 asio::streambuf b;
 asio::read_until(s, b, "\r\n");
 std::istream is(&b);
 std::string line;
 std::getline(is, line); 

Definition at line 94 of file read_until.ipp.

References asio::placeholders::bytes_transferred, asio::read_until(), and asio::detail::throw_error().

template<typename SyncReadStream, typename Allocator>
std::size_t asio::read_until ( SyncReadStream &  s,
asio::basic_streambuf< Allocator > &  b,
char  delim,
asio::error_code ec 
) [inline]

Read data into a streambuf until a delimiter is encountered.

This function is used to read data into the specified streambuf until the streambuf's get area contains the specified delimiter. The call will block until one of the following conditions is true:

  • The get area of the streambuf contains the specified delimiter.
This operation is implemented in terms of zero or more calls to the stream's read_some function. If the streambuf's get area already contains the delimiter, the function returns immediately.

Parameters:
s The stream from which the data is to be read. The type must support the SyncReadStream concept.
b A streambuf object into which the data will be read.
delim The delimiter character.
ec Set to indicate what error occurred, if any.
Returns:
The number of bytes in the streambuf's get area up to and including the delimiter. Returns 0 if an error occurred.

Definition at line 47 of file read_until.ipp.

References asio::basic_streambuf< Allocator >::commit(), asio::basic_streambuf< Allocator >::data(), asio::placeholders::iterator, asio::basic_streambuf< Allocator >::max_size(), asio::detail::error_base< T >::not_found, asio::basic_streambuf< Allocator >::prepare(), and asio::basic_streambuf< Allocator >::size().

template<typename SyncReadStream, typename Allocator>
std::size_t asio::read_until ( SyncReadStream &  s,
asio::basic_streambuf< Allocator > &  b,
char  delim 
) [inline]

Read data into a streambuf until a delimiter is encountered.

This function is used to read data into the specified streambuf until the streambuf's get area contains the specified delimiter. The call will block until one of the following conditions is true:

  • The get area of the streambuf contains the specified delimiter.
This operation is implemented in terms of zero or more calls to the stream's read_some function. If the streambuf's get area already contains the delimiter, the function returns immediately.

Parameters:
s The stream from which the data is to be read. The type must support the SyncReadStream concept.
b A streambuf object into which the data will be read.
delim The delimiter character.
Returns:
The number of bytes in the streambuf's get area up to and including the delimiter.
Exceptions:
asio::system_error Thrown on failure.
Example
To read data into a streambuf until a newline is encountered:
 asio::streambuf b;
 asio::read_until(s, b, '\n');
 std::istream is(&b);
 std::string line;
 std::getline(is, line); 

Definition at line 37 of file read_until.ipp.

References asio::placeholders::bytes_transferred, and asio::detail::throw_error().

Referenced by asio::read_until().


Generated on Sun May 25 00:20:20 2008 by  doxygen 1.5.6