H3D API
2.4.1
|
This abstract interface is inherited by all nodes that contain data located on the World Wide Web, such as AudioClip, ImageTexture and Inline. More...
#include <H3D/X3DUrlObject.h>
Public Types | |
enum | LoadStatus { INIT , LOADED , LOADING , FAILED } |
The load status of the given url. More... | |
Public Member Functions | |
X3DUrlObject (Inst< MFString > _url=0) | |
Constructor. | |
virtual LoadStatus | loadStatus () |
The loadStatus function returns the status of the loading of the current urls in order to be used with the LoadSensor node. | |
virtual H3DFloat | loadProgress () |
The loadProgress() functions returns a value between 0 and 1 indicating how much of the current url has been loaded. More... | |
void | setURLUsed (const string &_url_used) |
Set the url that is currently loaded. | |
const string & | getURLUsed () |
Get the url that is currently loaded. | |
void | setURLBase (const string &_url_base) |
Set the url base address. | |
const string & | getURLBase () |
Get the current url base address. | |
string | resolveURLAsFile (const string &url, bool *is_tmp_file=NULL) |
Get the url as a local file. | |
string | resolveURLAsString (const string &url) |
Get the content of the URL as a string. | |
bool | removeTmpFile (const string &file) |
Remove a tmpfile with the given name. More... | |
Public Attributes | |
H3DUniquePtr< MFString > | url |
The urls in decreasing order of preference. | |
Protected Member Functions | |
string | resolveURL (const string &_url, bool return_contents, bool *is_tmp_file=NULL) |
Helper function for resolveURLAs*() functions. | |
void | addInlinePrefix (const string &s) |
Add a inline prefix that this node supports. | |
int | getInlinedContentOffset (const std::string &url) |
If the URL contains any inline prefix, return the index of the start of the inlined content. More... | |
Protected Attributes | |
string | url_used |
If loadStatus() returns LOADED this string should contain the url that is loaded. More... | |
string | url_base |
The base URL for urls in this url object. More... | |
list< string > | supported_inline_prefixes |
A list of inline prefixes that are supported by this url object. More... | |
This abstract interface is inherited by all nodes that contain data located on the World Wide Web, such as AudioClip, ImageTexture and Inline.
All url fields can hold multiple string values. The strings in these fields indicate multiple locations to search for data in decreasing order of preference. If the browser cannot locate or interpret the data specified by the first location, it shall try the second and subsequent locations in order until a location containing interpretable data is encountered. X3D browsers only have to interpret a single string. If no interpretable locations are found, the node type defines the resultant default behaviour.
|
protected |
If the URL contains any inline prefix, return the index of the start of the inlined content.
Otherwise (if there is no inline prefix) return 0
Referenced by resolveURL().
|
inlinevirtual |
The loadProgress() functions returns a value between 0 and 1 indicating how much of the current url has been loaded.
1 means that the file has been sucessfully loaded. The only requirement of this function is that if the url has been successfully loaded the function returns 1.
Referenced by H3D::LoadSensor::traverseSG().
bool X3DUrlObject::removeTmpFile | ( | const string & | file | ) |
Remove a tmpfile with the given name.
Returns true on success, or false if no such file exists or the removal failed.
References H3DUtil::ResourceResolver::releaseTmpFileName().
|
protected |
A list of inline prefixes that are supported by this url object.
E.g. "glsl", "python", etc
Referenced by addInlinePrefix().
|
protected |
The base URL for urls in this url object.
All relative paths will start from this. Will be set to ResourceResolver::getBaseURL() when created.
Referenced by resolveURL().
|
protected |
If loadStatus() returns LOADED this string should contain the url that is loaded.
All subclasses of X3DUrlObject should set this when successfully loaded a file.
Referenced by H3D::ShaderPart::loadStatus().