daeURI Class Reference

#include <daeURI.h>

List of all members.

Public Types

enum  ResolveState {
  uri_empty, uri_loaded, uri_pending, uri_success,
  uri_failed_unsupported_protocol, uri_failed_file_not_found, uri_failed_id_not_found, uri_failed_invalid_id,
  uri_resolve_local, uri_resolve_relative, uri_resolve_absolute, uri_failed_invalid_reference,
  uri_failed_externalization, uri_failed_missing_container, uri_failed_external_document
}

Public Member Functions

void authority (const std::string &authority)
const std::string & authority () const
void copyFrom (const daeURI &from)
 daeURI (DAE &dae, daeElement &container, const std::string &uriString="")
 daeURI (daeElement &container, const std::string &uriString="")
 daeURI (const daeURI &constructFromURI)
 daeURI (const daeURI &baseURI, const std::string &URIString)
 daeURI (DAE &dae, const std::string &URIString, daeBool nofrag=false)
 daeURI (DAE &dae)
void fragment (const std::string &fragment)
const std::string & fragment () const
daeString getAuthority () const
daeElementgetContainer () const
DAEgetDAE () const
daeElementRef getElement () const
daeString getFragment () const
daeString getID () const
daeString getOriginalURI () const
daeBool getPath (daeChar *dest, daeInt size) const
daeString getPath () const
daeString getProtocol () const
daeString getQuery () const
daeDocumentgetReferencedDocument () const
daeString getScheme () const
ResolveState getState () const
daeString getURI () const
void id (const std::string &id)
const std::string & id () const
daeBool isExternalReference () const
int makeRelativeTo (const daeURI *uri)
daeURIoperator= (const std::string &uri)
daeURIoperator= (const daeURI &other)
bool operator== (const daeURI &other) const
const std::string & originalStr () const
void path (const std::string &dir, const std::string &baseName, const std::string &ext)
void path (const std::string &path)
const std::string & path () const
void pathComponents (std::string &dir, std::string &baseName, std::string &ext) const
void pathDir (const std::string &dir)
std::string pathDir () const
void pathExt (const std::string &ext)
std::string pathExt () const
void pathFile (const std::string &file)
std::string pathFile () const
void pathFileBase (const std::string &baseName)
std::string pathFileBase () const
void print ()
void query (const std::string &query)
const std::string & query () const
void resolveElement ()
void scheme (const std::string &scheme)
const std::string & scheme () const
void set (const std::string &scheme, const std::string &authority, const std::string &path, const std::string &query, const std::string &fragment, const daeURI *baseURI=NULL)
void set (const std::string &uriStr, const daeURI *baseURI=NULL)
void setContainer (daeElement *container)
void setState (ResolveState newState)
void setURI (daeString uriStr, const daeURI *baseURI=NULL)
const std::string & str () const
void validate (const daeURI *baseURI=NULL)
 ~daeURI ()

Static Public Member Functions

static void normalizeURIPath (char *path)

Private Member Functions

void initialize ()
daeElementinternalResolveElement () const
void reset ()

Private Attributes

std::string _authority
std::string _fragment
std::string _path
std::string _query
std::string _scheme
daeElementcontainer
DAEdae
std::string originalURIString
std::string uriString

Detailed Description

The daeURI is a simple class designed to aid in the parsing and resolution of URI references inside COLLADA elements. A daeURI is created for every anyURL and IDREF in the COLLADA schema. For example, the <instance> element has the url= attribute of type anyURL, and the <controller> element has the target= attribute of type IDREF. The daeURI class contains a URI string; the set() method breaks the string into its components including scheme, authority, path (directory), and fragment. It also has the capability to attempt to resolve this reference into a daeElement, through the method resolveElement(). If a daeURI is stored within a daeElement, it fills its container field to point to the containing element.

The main API on the daeURI, resolveElement(), uses a daeURIResolver to search for the daeElement inside a daeDatabase.

URIs are resolved hierarchically, where each URI is resolved based on the following criteria via itself and its element's base URI, which represents the URI of the document that contains the element, retrieved by daeElement::getBaseURI(). If no base URI is provided, then the application URI is used as a base.

The URI resolution order for the COLLADA DOM is as follows:

Definition of Absolute URI: For the purposes of the COLLADA DOM, a URI is considered absolute if it starts by specifying a scheme. For example,

Definition at line 61 of file daeURI.h.


Member Enumeration Documentation

An enum describing the status of the URI resolution process. This is pretty much entirely useless now. Just use the various accessors to query the state of the uri.

Enumerator:
uri_empty 

No URI specified

uri_loaded 

URI specified but unresolved

uri_pending 

Resolution pending

uri_success 

Resolution successful

uri_failed_unsupported_protocol 

Failure due to unsupported URI scheme

uri_failed_file_not_found 

Failure because the file was not found

uri_failed_id_not_found 

Failure because the fragment was not found

uri_failed_invalid_id 

Failure due to an invalid fragment

uri_resolve_local 

A flag specifying that the URI should be resolved locally to its own document

uri_resolve_relative 

A flag specifying that the URI should be resolved using this relative URI

uri_resolve_absolute 

A flag specifying that the URI should be resolved using this absolute URI

uri_failed_invalid_reference 

Failure due to an invalid reference

uri_failed_externalization 

Failure due to an external error

uri_failed_missing_container 

Failure due to missing document

uri_failed_external_document 

Failure because automatic loading of a document is turned off

Definition at line 72 of file daeURI.h.


Constructor & Destructor Documentation

daeURI::daeURI ( DAE dae  ) 

Constructs a daeURI object that contains no URI reference.

Parameters:
dae The DAE associated with this daeURI. current working directory.
daeURI::~daeURI (  ) 

Destructor

daeURI::daeURI ( DAE dae,
const std::string &  URIString,
daeBool  nofrag = false 
)

Constructs a daeURI object from a URI passed in as a string.

Parameters:
dae The DAE associated with this daeURI.
URIString Passed to set() automatically.
nofrag If true, the fragment part of the URI is stripped off before construction.
daeURI::daeURI ( const daeURI baseURI,
const std::string &  URIString 
)

Constructs a daeURI object using a baseURI and a uriString. Calls set(URIString), and validate(baseURI).

Parameters:
baseURI Base URI to resolve against.
URIString String designating this URI.
daeURI::daeURI ( const daeURI constructFromURI  ) 

Constructs a daeURI object based on a simple copy from an existing daeURI.

Parameters:
constructFromURI URI to copy into this one.
daeURI::daeURI ( daeElement container,
const std::string &  uriString = "" 
)

Constructs a daeURI given a container element and a URI string.

Parameters:
container The container element.
uriString the URI string.
daeURI::daeURI ( DAE dae,
daeElement container,
const std::string &  uriString = "" 
)

Member Function Documentation

void daeURI::authority ( const std::string &  authority  ) 
const std::string& daeURI::authority (  )  const
void daeURI::copyFrom ( const daeURI from  ) 

Copies the URI specified in from into this. Performs a simple copy without validating the URI.

Parameters:
from URI to copy from.
void daeURI::fragment ( const std::string &  fragment  ) 
const std::string& daeURI::fragment (  )  const
daeString daeURI::getAuthority (  )  const
daeElement* daeURI::getContainer (  )  const [inline]

Gets a pointer to the daeElement that contains this URI.

Returns:
Returns the pointer to the containing daeElmement.

Definition at line 267 of file daeURI.h.

DAE* daeURI::getDAE (  )  const

Gets the DAE objects associated with this daeURI.

Returns:
Returns a pointer to the associated DAE. This will never return null.
daeElementRef daeURI::getElement (  )  const

Gets the element that this URI resolves to in memory.

Returns:
Returns a ref to the element.
daeString daeURI::getFragment (  )  const
daeString daeURI::getID (  )  const
daeString daeURI::getOriginalURI (  )  const
daeBool daeURI::getPath ( daeChar dest,
daeInt  size 
) const
daeString daeURI::getPath (  )  const
daeString daeURI::getProtocol (  )  const
daeString daeURI::getQuery (  )  const
daeDocument* daeURI::getReferencedDocument (  )  const
daeString daeURI::getScheme (  )  const
ResolveState daeURI::getState (  )  const
daeString daeURI::getURI (  )  const
void daeURI::id ( const std::string &  id  ) 
const std::string& daeURI::id (  )  const
void daeURI::initialize (  )  [private]

Provides a shared initialization for all constructors

daeElement* daeURI::internalResolveElement (  )  const [private]
daeBool daeURI::isExternalReference (  )  const

Gets if this URI resolves to an element that is not contained in the same document as the URI.

Returns:
Returns true if the URI references an external element. False otherwise.
int daeURI::makeRelativeTo ( const daeURI uri  ) 

Makes the "originalURI" in this URI relative to some other uri

Parameters:
uri the URI to make "this" relative to.
Note:
this is experimental and not fully tested, please don't use in critical code yet.
static void daeURI::normalizeURIPath ( char *  path  )  [static]

Performs RFC2396 path normalization.

Parameters:
path Path to be normalized.
daeURI& daeURI::operator= ( const std::string &  uri  ) 
daeURI& daeURI::operator= ( const daeURI other  ) 
bool daeURI::operator== ( const daeURI other  )  const [inline]

Comparison operator.

Returns:
Returns true if URI's are equal.

Definition at line 305 of file daeURI.h.

const std::string& daeURI::originalStr (  )  const
void daeURI::path ( const std::string &  dir,
const std::string &  baseName,
const std::string &  ext 
)
void daeURI::path ( const std::string &  path  ) 
const std::string& daeURI::path (  )  const
void daeURI::pathComponents ( std::string &  dir,
std::string &  baseName,
std::string &  ext 
) const
void daeURI::pathDir ( const std::string &  dir  ) 
std::string daeURI::pathDir (  )  const
void daeURI::pathExt ( const std::string &  ext  ) 
std::string daeURI::pathExt (  )  const
void daeURI::pathFile ( const std::string &  file  ) 
std::string daeURI::pathFile (  )  const
void daeURI::pathFileBase ( const std::string &  baseName  ) 
std::string daeURI::pathFileBase (  )  const
void daeURI::print (  ) 

Outputs all components of this URI to stderr. Useful for debugging URIs, this outputs each part of the URI separately.

void daeURI::query ( const std::string &  query  ) 
const std::string& daeURI::query (  )  const
void daeURI::reset (  )  [private]

Resets this URI; frees all string references and returns state to empty.

void daeURI::resolveElement (  ) 
void daeURI::scheme ( const std::string &  scheme  ) 
const std::string& daeURI::scheme (  )  const
void daeURI::set ( const std::string &  scheme,
const std::string &  authority,
const std::string &  path,
const std::string &  query,
const std::string &  fragment,
const daeURI baseURI = NULL 
)
void daeURI::set ( const std::string &  uriStr,
const daeURI baseURI = NULL 
)
void daeURI::setContainer ( daeElement container  ) 

Sets the pointer to the daeElement that contains this URI.

Parameters:
cont Pointer to the containing daeElmement.
void daeURI::setState ( ResolveState  newState  ) 
void daeURI::setURI ( daeString  uriStr,
const daeURI baseURI = NULL 
)
const std::string& daeURI::str (  )  const
void daeURI::validate ( const daeURI baseURI = NULL  ) 

Member Data Documentation

std::string daeURI::_authority [private]

authority component

Definition at line 118 of file daeURI.h.

std::string daeURI::_fragment [private]

fragment component

Definition at line 124 of file daeURI.h.

std::string daeURI::_path [private]

path component

Definition at line 120 of file daeURI.h.

std::string daeURI::_query [private]

query component

Definition at line 122 of file daeURI.h.

std::string daeURI::_scheme [private]

scheme component

Definition at line 116 of file daeURI.h.

Pointer to the element that owns this URI

Definition at line 126 of file daeURI.h.

DAE* daeURI::dae [mutable, private]

Definition at line 107 of file daeURI.h.

std::string daeURI::originalURIString [private]

Original URI before resolution

Definition at line 113 of file daeURI.h.

std::string daeURI::uriString [private]

Resolved version of the URI

Definition at line 110 of file daeURI.h.


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


colladadom
Author(s): Du Hung Hou, Khronos.org, Marcus Barnes, Greg Corson, Herbert Law, Sebastian Schwarz, Steven Thomas, John Hsu (ros package), Tim Field (ros package)
autogenerated on Fri Jan 11 09:29:16 2013