osgEarth 2.1.1
|
Public Member Functions | |
URIContext () | |
URIContext (const std::string &referrer) | |
URIContext (const URIContext &rhs) | |
void | store (osgDB::Options *options) |
URIContext (const osgDB::Options *options) | |
const std::string & | referrer () const |
bool | empty () const |
URIContext | add (const URIContext &subContext) const |
URIContext | add (const std::string &subPath) const |
std::string | getOSGPath (const std::string &target) const |
Private Attributes | |
std::string | _referrer |
Friends | |
class | URI |
Context for resolving relative URIs.
This object provides "context" for a relative URI. In other words, it provides all of the information the system needs to resolve it to an absolute location from which OSG can load data.
The "referrer" is the location of an object that "points" to the object in the corresponding URI. The location conveyed by the URI will be relative to the location of its referrer. For example, a referrer of "http://server/folder/hello.xml" applied to the URI "there.jpg" will resolve to "http://server/folder/there.jpg". NOTE that referrer it not itself a location (like a folder); rather it's the object that referred to the URI being contextualized.
osgEarth::URIContext::URIContext | ( | ) | [inline] |
osgEarth::URIContext::URIContext | ( | const std::string & | referrer | ) | [inline] |
osgEarth::URIContext::URIContext | ( | const URIContext & | rhs | ) | [inline] |
URIContext::URIContext | ( | const osgDB::Options * | options | ) |
URIContext URIContext::add | ( | const URIContext & | subContext | ) | const |
Parents the input context with the current object, placing the subContext's information under it. Used to re-parent relative locations with a higher-level referrer object.
Definition at line 100 of file URI.cpp.
{ return URIContext( osgEarth::getFullPath(_referrer, sub._referrer) ); }
URIContext URIContext::add | ( | const std::string & | subPath | ) | const |
Returns a new context with the sub path appended to the current referrer path.
Definition at line 106 of file URI.cpp.
{ return URIContext(osgDB::concatPaths( _referrer, sub )); }
bool osgEarth::URIContext::empty | ( | ) | const [inline] |
std::string URIContext::getOSGPath | ( | const std::string & | target | ) | const |
creates a string suitable for passing to an osgDB::ReaderWriter implementation
Definition at line 94 of file URI.cpp.
{ return osgEarth::getFullPath( _referrer, target ); }
const std::string& osgEarth::URIContext::referrer | ( | ) | const [inline] |
void URIContext::store | ( | osgDB::Options * | options | ) |
Serializes this context to an Options structure. This is useful when passing context information to an osgDB::ReaderWriter that takes a stream as input -- the stream is anonymous, therefore this is the preferred way to communicate the context information.
Definition at line 112 of file URI.cpp.
{ if ( options ) { options->setDatabasePath( _referrer ); options->setPluginStringData( "osgEarth::URIContext::referrer", _referrer ); } }
std::string osgEarth::URIContext::_referrer [private] |