Gnash
0.8.10
|
A StreamProvider makes IOChannels available to the core on request. More...
#include <StreamProvider.h>
Public Member Functions | |
StreamProvider (const URL &original, const URL &base, std::auto_ptr< NamingPolicy > np=std::auto_ptr< NamingPolicy >(new NamingPolicy)) | |
Construct a StreamProvider. | |
virtual | ~StreamProvider () |
virtual std::auto_ptr< IOChannel > | getStream (const URL &url, bool namedCacheFile=false) const |
Returned stream ownership is transferred to caller. | |
virtual std::auto_ptr< IOChannel > | getStream (const URL &url, const std::string &postdata, bool namedCacheFile=false) const |
Get a stream from the response of a POST operation. | |
virtual std::auto_ptr< IOChannel > | getStream (const URL &url, const std::string &postdata, const NetworkAdapter::RequestHeaders &headers, bool namedCacheFile=false) const |
void | setNamingPolicy (std::auto_ptr< NamingPolicy > np) |
Set the NamingPolicy for cache files. | |
const NamingPolicy & | namingPolicy () const |
Return the currently selected policy for converting URL to filename. | |
bool | allow (const URL &url) const |
Check whether access to a URL is allowed. | |
const URL & | baseURL () const |
The base URL that should be used to resolve all relative URLs. |
A StreamProvider makes IOChannels available to the core on request.
The current functions of this class are: 1. Inform users whether a connection to a certain URL is allowed. 2. Make a connection and return an IOChannel (this performs a separate access check).
The class should in future also: 3. Take relative URLs and resolve them against the base URL. TODO: this class should become an abstract interface.
gnash::StreamProvider::StreamProvider | ( | const URL & | original, |
const URL & | base, | ||
std::auto_ptr< NamingPolicy > | np = std::auto_ptr<NamingPolicy>(new NamingPolicy) |
||
) |
Construct a StreamProvider.
virtual gnash::StreamProvider::~StreamProvider | ( | ) | [inline, virtual] |
bool gnash::StreamProvider::allow | ( | const URL & | url | ) | const |
Check whether access to a URL is allowed.
This is used by the core to check whether a connection can be made before trying to make it. It's useful currently for some functions to decide what to return.
url | The url to check |
Referenced by gnash::NetConnection_as::validateURL(), gnash::NetConnection_as::connect(), and getStream().
const URL& gnash::StreamProvider::baseURL | ( | ) | const [inline] |
The base URL that should be used to resolve all relative URLs.
TODO: drop this if possible and handle all resolution in this class.
Referenced by gnash::Gui::takeScreenShot(), gnash::movie_root::getURL(), gnash::MovieClip::loadVariables(), gnash::MovieLoader::loadMovie(), gnash::NetConnection_as::validateURL(), gnash::NetConnection_as::connect(), gnash::NetConnection_as::getStream(), gnash::SharedObjectLibrary::SharedObjectLibrary(), and gnash::SharedObjectLibrary::getLocal().
std::auto_ptr< IOChannel > gnash::StreamProvider::getStream | ( | const URL & | url, |
bool | namedCacheFile = false |
||
) | const [virtual] |
Returned stream ownership is transferred to caller.
On error NULL is returned Derive from this for a CachingStreamProvider
References gnash::URL::protocol(), path, gnash::URL::path(), gnash::makeFileChannel(), allow(), _, gnash::NetworkAdapter::makeStream(), gnash::URL::str(), namingPolicy(), and url.
Referenced by gnash::NetConnection_as::getStream(), and getStream().
std::auto_ptr< IOChannel > gnash::StreamProvider::getStream | ( | const URL & | url, |
const std::string & | postdata, | ||
bool | namedCacheFile = false |
||
) | const [virtual] |
Get a stream from the response of a POST operation.
Returned stream ownership is transferred to caller.
On error NULL is returned Derive from this for a CachingStreamProvider
url | The url to post to. |
postdata | Post data in url-encoded form. |
References gnash::URL::protocol(), _, path, gnash::URL::path(), gnash::makeFileChannel(), allow(), gnash::NetworkAdapter::makeStream(), gnash::URL::str(), namingPolicy(), and url.
std::auto_ptr< IOChannel > gnash::StreamProvider::getStream | ( | const URL & | url, |
const std::string & | postdata, | ||
const NetworkAdapter::RequestHeaders & | headers, | ||
bool | namedCacheFile = false |
||
) | const [virtual] |
References gnash::URL::protocol(), _, getStream(), allow(), gnash::NetworkAdapter::makeStream(), gnash::URL::str(), namingPolicy(), and url.
const NamingPolicy& gnash::StreamProvider::namingPolicy | ( | ) | const [inline] |
Return the currently selected policy for converting URL to filename.
References assert.
Referenced by getStream().
void gnash::StreamProvider::setNamingPolicy | ( | std::auto_ptr< NamingPolicy > | np | ) | [inline] |
Set the NamingPolicy for cache files.
This is only used when cache file naming is requested in getStream() This StreamProvider owns the NamingPolicy instance.