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

- Main Page
- Namespaces
- Classes
- Files
- Related Pages
- Examples

- Class List
- Class Hierarchy
- Class Members

# openvrml::resource_istream Class Reference

`#include <openvrml/browser.h>`

Inherits std::istream.

List of all members.

## 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.

## 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.

## 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.