Urdl C++ Library

PrevUpHomeNext

istream

The class istream supports reading content from a specified URL.

class istream :
  public std::basic_istream< char >

Member Functions

Name

Description

close

Closes the stream.

content_length

Gets the length of the content obtained from the URL.

content_type

Gets the MIME type of the content obtained from the URL.

error

Gets the last error associated with the stream.

get_option

Gets the current value of an option that controls the behaviour of the stream.

get_options

Gets the values of all options set on the stream.

headers

Gets the protocol-specific headers obtained from the URL.

is_open

Determines whether the stream is open.

istream

Constructs an object of class istream.

open

Opens the specified URL.

open_timeout

Gets the open timeout of the stream.

Sets the open timeout of the stream.

rdbuf

Gets the underlying stream buffer.

read_timeout

Gets the read timeout of the stream.

Sets the read timeout of the stream.

set_option

Sets an option to control the behaviour of the stream.

set_options

Sets options to control the behaviour of the stream.

Remarks

The class stores an object of class istreambuf.

Currently supported URL protocols are http, https and file.

Example

To read the entire content of a resource located by a URL into a string:

urdl::istream is("http://www.boost.org/LICENSE_1_0.txt");
if (is)
{
  std::string content;
  if (std::getline(is, content, std::char_traits<char>::eof()))
  {
    ...
  }
}

Requirements

Header: <urdl/istream.hpp>

Namespace: urdl


PrevUpHomeNext