osgEarth 2.1.1
Public Member Functions | Private Attributes | Friends

osgEarth::URIContext Class Reference

List of all members.

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

Detailed Description

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.

Definition at line 49 of file URI.


Constructor & Destructor Documentation

osgEarth::URIContext::URIContext ( ) [inline]

Creates an empty context.

Definition at line 53 of file URI.

{ }

Here is the caller graph for this function:

osgEarth::URIContext::URIContext ( const std::string &  referrer) [inline]

Creates a context that specifies a referring object.

Definition at line 56 of file URI.

osgEarth::URIContext::URIContext ( const URIContext rhs) [inline]

Copy constructor.

Definition at line 59 of file URI.

: _referrer(rhs._referrer) { }
URIContext::URIContext ( const osgDB::Options options)

Creates a context from the serialized version in an Options structure (see above)

Definition at line 121 of file URI.cpp.

{
    if ( options )
    {
        _referrer = options->getPluginStringData( "osgEarth::URIContext::referrer" );
    }
}

Member Function Documentation

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) );
}

Here is the call graph for this function:

Here is the caller graph for this function:

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 ));
}

Here is the call graph for this function:

bool osgEarth::URIContext::empty ( ) const [inline]

True if the context is empty

Definition at line 73 of file URI.

{ return _referrer.empty(); }
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 );
}

Here is the call graph for this function:

Here is the caller graph for this function:

const std::string& osgEarth::URIContext::referrer ( ) const [inline]

Returns the referring object.

Definition at line 70 of file URI.

{ return _referrer; }

Here is the caller graph for this function:

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 );
    }
}

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class URI [friend]

Definition at line 86 of file URI.


Member Data Documentation

std::string osgEarth::URIContext::_referrer [private]

Definition at line 87 of file URI.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines