asio 0.3.8rc3 Home | Reference | Tutorial | Examples | Design
Reference Class Hierarchy | Class Index | Member Index

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,
char  delim 
)

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:

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); 

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.

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:

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.

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.

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:

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); 

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.

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:

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.

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.

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:

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); 

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.

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:

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.

asio 0.3.8rc3 Home | Reference | Tutorial | Examples | Design