libSBML C++ API  5.20.2
SBMLFileResolver Class Reference
Inheritance diagram for SBMLFileResolver:
[legend]

Detailed Description

comp Resolves documents stored on a file system.

This class of objects is defined by libSBML only and has no direct equivalent in terms of SBML components. It is a class used in the implementation of extra functionality provided by libSBML.

In SBML, resolvers come into play with the SBML Level 3 Hierarchical Model Composition package (“comp”); this package includes features that allow a model to be composed from pieces that are external to a given SBML document, which implies the need to be able to identify and locate those external pieces. The identifiers used in “comp” are URIs (Uniform Resource Identifiers).

SBMLFileResolver is a class implementing the ability to resolve URIs to files. It works on the local file system only. It can resolve relative and absolute paths, and directories to be searched can be specified using the methods SBMLFileResolver::setAdditionalDirs(), SBMLFileResolver::addAdditionalDir() and SBMLFileResolver::clearAdditionalDirs().

See also
SBMLResolver
SBMLUri

Public Member Functions

virtual void addAdditionalDir (const std::string &dir)
 Adds a directory to the list of directories to search for files to resolve. More...
 
virtual void clearAdditionalDirs ()
 Removes the list of directories to search for files to resolve. More...
 
virtual SBMLFileResolverclone () const
 Creates and returns a deep copy of this SBMLFileResolver object. More...
 
SBMLFileResolveroperator= (const SBMLFileResolver &rhs)
 Assignment operator for SBMLFileResolver. More...
 
virtual SBMLDocumentresolve (const std::string &uri, const std::string &baseUri="") const
 Resolves the document for the given URI. More...
 
virtual SBMLUriresolveUri (const std::string &uri, const std::string &baseUri="") const
 Resolves the full URI for a given URI without actually reading the document. More...
 
 SBMLFileResolver ()
 Creates a new SBMLFileResolver object. More...
 
 SBMLFileResolver (const SBMLFileResolver &c)
 Copy constructor. More...
 
virtual void setAdditionalDirs (const std::vector< std::string > &dirs)
 Sets the list of directories in which to search for files to resolve. More...
 
virtual ~SBMLFileResolver ()
 Destroy this SBMLFileResolver object. More...
 

Constructor & Destructor Documentation

◆ SBMLFileResolver() [1/2]

SBMLFileResolver::SBMLFileResolver ( )

Creates a new SBMLFileResolver object.

◆ SBMLFileResolver() [2/2]

SBMLFileResolver::SBMLFileResolver ( const SBMLFileResolver c)

Copy constructor.

Creates a copy of an SBMLFileResolver object.

Parameters
cthe SBMLFileResolver object to copy.

◆ ~SBMLFileResolver()

SBMLFileResolver::~SBMLFileResolver ( )
virtual

Destroy this SBMLFileResolver object.

Member Function Documentation

◆ addAdditionalDir()

void SBMLFileResolver::addAdditionalDir ( const std::string &  dir)
virtual

Adds a directory to the list of directories to search for files to resolve.

Parameters
dirthe directory to add.
See also
clearAdditionalDirs()
setAdditionalDirs()

◆ clearAdditionalDirs()

void SBMLFileResolver::clearAdditionalDirs ( )
virtual

Removes the list of directories to search for files to resolve.

After this method is called, SBMLFileResolver::resolve(const std::string &uri, const std::string& baseUri) will only search absolute or relative directories. New directories can be added using SBMLFileResolver::addAdditionalDir() or setAdditionalDirs().

See also
addAdditionalDir()
setAdditionalDirs()

◆ clone()

SBMLFileResolver * SBMLFileResolver::clone ( ) const
virtual

Creates and returns a deep copy of this SBMLFileResolver object.

Returns
a (deep) copy of this SBMLFileResolver object.

Reimplemented from SBMLResolver.

◆ operator=()

SBMLFileResolver & SBMLFileResolver::operator= ( const SBMLFileResolver rhs)

Assignment operator for SBMLFileResolver.

Parameters
rhsthe object whose values are used as the basis of the assignment.

◆ resolve()

SBMLDocument * SBMLFileResolver::resolve ( const std::string &  uri,
const std::string &  baseUri = "" 
) const
virtual

Resolves the document for the given URI.

Parameters
urithe URI to the target document.
baseUribase URI, in case the URI is a relative one.
Returns
the document, if this resolver can resolve the document or NULL.

Reimplemented from SBMLResolver.

◆ resolveUri()

SBMLUri * SBMLFileResolver::resolveUri ( const std::string &  uri,
const std::string &  baseUri = "" 
) const
virtual

Resolves the full URI for a given URI without actually reading the document.

Parameters
urithe URI to the target document.
baseUribase URI, in case the URI is a relative one.
Returns
the full URI to the document, if this resolver can resolve the document or NULL.

Reimplemented from SBMLResolver.

◆ setAdditionalDirs()

void SBMLFileResolver::setAdditionalDirs ( const std::vector< std::string > &  dirs)
virtual

Sets the list of directories in which to search for files to resolve.

Unlike the similar SBMLFileResolver::addAdditionalDir(), this method replaces any current list of search directories with the given list of dirs.

Parameters
dirsa vector of strings which contain directories.
See also
addAdditionalDir()
clearAdditionalDirs()