Home | Download | Screen shots | Discussion | Documentation
--- | --- | --- | --- | ---

# openvrml::resource_istream Class Reference

An abstract input stream for network resources. More...

`#include <openvrml/browser.h>`

Inherits std::istream.

List of all members.

## Public Member Functions
virtual | ~resource_istream ()=0
| Destroy.
const std::string | url () const throw ( std::bad_alloc )
| Get the URL associated with the stream.
const std::string | type () const throw ( std::bad_alloc )
| Get the MIME content type associated with the stream.
bool | data_available () const throw ()
| Indicates whether data is available to be read from the stream.
## Protected Member Functions
| resource_istream (std::streambuf *streambuf)
| Construct.
## Private Member Functions
virtual const std::string | do_url () const =0 throw ( std::bad_alloc )
| Get the URL associated with the stream.
virtual const std::string | do_type () const =0 throw ( std::bad_alloc )
| Get the MIME content type associated with the stream.
virtual bool | do_data_available () const =0 throw ()
| Indicates whether data is available to be read from the stream.

## Detailed Description

An abstract input stream for network resources.

`resource_istream` inherits `std::istream`, adding functions to get the URI and the MIME content type associated with the stream. Users of the library must provide an implementation of this class, to be returned from `openvrml::resource_fetcher::do_get_resource`.

See also:
  openvrml::resource_fetcher::do_get_resource(const std::string &)

Examples:

  sdl_viewer.cpp.

## Constructor & Destructor Documentation

openvrml::resource_istream::~resource_istream | ( |  | ) | `[pure virtual]`

Destroy.

openvrml::resource_istream::resource_istream | ( | std::streambuf * | streambuf | ) | `[explicit, protected]`

Construct.

Parameters:

  `[in]` | streambuf | a stream buffer.

## Member Function Documentation

const std::string openvrml::resource_istream::url | ( |  | ) | const throw ( std::bad_alloc )

Get the URL associated with the stream.

This function delegates to `do_url`.

Returns:
  the URL associated with the stream.

Exceptions:

  | std::bad_alloc | if memory allocation fails.

const std::string openvrml::resource_istream::type | ( |  | ) | const throw ( std::bad_alloc )

Get the MIME content type associated with the stream.

This function delegates to `do_type`.

Returns:
  the MIME content type associated with the stream.

bool openvrml::resource_istream::data_available | ( |  | ) | const throw ()

Indicates whether data is available to be read from the stream.

This function delegates to `do_data_available`.

Returns:
  `true` if there is data in the stream buffer to be read; `false` otherwise.

const std::string openvrml::resource_istream::do_url | ( |  | ) | const throw ( std::bad_alloc )`[private, pure virtual]`

Get the URL associated with the stream.

Returns:
  the URL associated with the stream.

const std::string openvrml::resource_istream::do_type | ( |  | ) | const throw ( std::bad_alloc )`[private, pure virtual]`

Get the MIME content type associated with the stream.

Returns:
  the MIME content type associated with the stream.

bool openvrml::resource_istream::do_data_available | ( |  | ) | const throw ()`[private, pure virtual]`

Indicates whether data is available to be read from the stream.

Returns:
  `true` if there is data in the stream buffer to be read; `false` otherwise.