libSBML C++ API  5.20.2
SBMLUri Class Reference

Detailed Description

comp Utility class for handling URIs.

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.

This class implements functionality for parsing URIs and extracting information about them.

See also
SBMLResolver
SBMLFileResolver
Examples
SBMLHttpResolverExample.cpp.

Public Member Functions

SBMLUriclone () const
 Creates and returns a deep copy of this SBMLUri object. More...
 
const std::string & getHost () const
 Returns the host portion of the stored URI. More...
 
const std::string & getPath () const
 Returns the path and filename portion of the stored URI. More...
 
const std::string & getQuery () const
 Returns the query portion of the stored URI. More...
 
const std::string & getScheme () const
 Returns the scheme of the stored URI. More...
 
const std::string & getUri () const
 Returns the full stored URI, after replacing backslashes with slashes. More...
 
SBMLUrioperator= (const SBMLUri &rhs)
 Assignment operator for SBMLUri. More...
 
SBMLUrioperator= (const std::string &uri)
 Assignment operator for SBMLUri. More...
 
SBMLUri relativeTo (const std::string &uri) const
 Constructs a new URI relative to this object and the given URI. More...
 
 SBMLUri (const SBMLUri &orig)
 Copy constructor. More...
 
 SBMLUri (const std::string &uri)
 Creates a new SBMLUri from the given string URI. More...
 
virtual ~SBMLUri ()
 Destroy this SBMLUri object. More...
 

Private Member Functions

void parse (const std::string &uri)
 

Private Attributes

std::string mHost
 
std::string mPath
 
std::string mQuery
 
std::string mScheme
 
std::string mUri
 

Constructor & Destructor Documentation

◆ SBMLUri() [1/2]

SBMLUri::SBMLUri ( const std::string &  uri)

Creates a new SBMLUri from the given string URI.

◆ SBMLUri() [2/2]

SBMLUri::SBMLUri ( const SBMLUri orig)

Copy constructor.

Creates a copy of an SBMLUri object.

Parameters
origthe SBMLUri object to copy.

◆ ~SBMLUri()

SBMLUri::~SBMLUri ( )
virtual

Destroy this SBMLUri object.

Member Function Documentation

◆ clone()

SBMLUri * SBMLUri::clone ( ) const

Creates and returns a deep copy of this SBMLUri object.

Returns
a (deep) copy of this SBMLFileResolver object.

◆ getHost()

const std::string & SBMLUri::getHost ( ) const

Returns the host portion of the stored URI.

For a scheme such as "http", this method returns the part of the URI after "http://" and before the next "/" character. URIs with file or URN schemes have no host; in that case, this method returns an empty string.

Returns
the host of the URI, or an empty string in the case of files or URNs schemes that do not possess a host portion.

◆ getPath()

const std::string & SBMLUri::getPath ( ) const

Returns the path and filename portion of the stored URI.

This method returns the text after the scheme, colon, and host (if present), and before the next "?" character. The result may be an empty string for some URIs.

Returns
the path of the URI (i.e., the full filename with path).

◆ getQuery()

const std::string & SBMLUri::getQuery ( ) const

Returns the query portion of the stored URI.

The equery portion of a URI is the text after a filename, starting with the character "?". For many URIs, this is an empty string.

Returns
the query of the URI (i.e., the part after the full filename with path).

◆ getScheme()

const std::string & SBMLUri::getScheme ( ) const

Returns the scheme of the stored URI.

The scheme of the URI is the text before the first colon character. Typical examples of what this might return are the strings "file" or "http". If the current URI does not have a scheme, this method returns an empty string.

Returns
the parsed scheme, such as "http", or an empty string if no scheme exists for the current URI.

◆ getUri()

const std::string & SBMLUri::getUri ( ) const

Returns the full stored URI, after replacing backslashes with slashes.

Returns
the original URI, with backslashes replaced with slashes.
Examples
SBMLHttpResolverExample.cpp.

◆ operator=() [1/2]

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

Assignment operator for SBMLUri.

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

◆ operator=() [2/2]

SBMLUri & SBMLUri::operator= ( const std::string &  uri)

Assignment operator for SBMLUri.

Allows parsing of the given string.

Parameters
urithe URI to parse.

◆ parse()

void SBMLUri::parse ( const std::string &  uri)
private

◆ relativeTo()

SBMLUri SBMLUri::relativeTo ( const std::string &  uri) const

Constructs a new URI relative to this object and the given URI.

For example,

SBMLUri("c:\\test")->relativeTo("test.xml");
SBMLUri(const std::string &uri)
Creates a new SBMLUri from the given string URI.
Definition: SBMLUri.cpp:51

would construct a new file URI, with path c:/test/test.xml.

Parameters
uria URI to be added to this object.
Returns
the resulting new URI.

Member Data Documentation

◆ mHost

std::string SBMLUri::mHost
private

◆ mPath

std::string SBMLUri::mPath
private

◆ mQuery

std::string SBMLUri::mQuery
private

◆ mScheme

std::string SBMLUri::mScheme
private

◆ mUri

std::string SBMLUri::mUri
private