Public Member Functions | List of all members
Uri Class Referenceabstract

An abstract universal resource identifier. More...

#include <Uri.hpp>

Inheritance diagram for Uri:
[legend]

Public Member Functions

virtual ~Uri ()=default
 Destroy the URI instance. More...
 
virtual std::unique_ptr< Uriappend (const std::string &pathComponent) const =0
 Appends the path component to the supplied URI, returning a new URI. More...
 
virtual std::unique_ptr< ByteReadResourcebyteReadResource () const =0
 Get a byte read resource for the URI. More...
 
virtual std::unique_ptr< ByteWriteResourcebyteWriteResource ()=0
 Get a byte write resource for the URI. More...
 
virtual bool canReadFrom () const =0
 Can data be read from the URI via a read resource. More...
 
virtual bool canWriteTo () const =0
 Can data be written to the URI via a write resource. More...
 
virtual std::unique_ptr< Uriclone () const =0
 Clone the concrete Uri. More...
 
std::shared_ptr< UricloneToShared () const
 Clone the concrete Uri to a shared pointer. More...
 
virtual void dispatch (UriDispatcher &visitor) const =0
 Visitor pattern dispatching. More...
 
virtual size_t hashcode () const noexcept=0
 Get the URI's hash code. More...
 
virtual bool isIterable () const =0
 Does the URI have a non-recursive iterator (examples: file and zip archive URIs). More...
 
virtual bool isRecursivelyIterable () const =0
 Does the URI have a recursive iterator (examples: file and zip archive URIs). More...
 
virtual bool isRegularDirectory () const =0
 Returns true if the URI points to a file directory. More...
 
virtual bool isRegularFile () const =0
 Returns true if the URI is a regular file. More...
 
virtual std::unique_ptr< UriIteratoriterator () const =0
 Get a (non-recursive) iterator. More...
 
virtual bool operator== (const Uri &rhs) const =0
 Compare the supplied URI to the current URI. More...
 
virtual std::unique_ptr< RecursiveUriIteratorrecursiveIterator () const =0
 Get a recursive iterator. More...
 
virtual std::unique_ptr< Uriresolve (std::string_view path) const =0
 Resolve the relative or absolute path, in reference to the current URI. More...
 
virtual std::string toRawString () const =0
 Get a string representing the raw URI. More...
 
virtual std::string toUriString () const =0
 Get a string representing the URI, complete with scheme. More...
 
virtual std::unique_ptr< Utf32To8WriteResourceutf32To8WriteResource ()=0
 Get a UTF-32 to UTF-8 write resource for the URI. More...
 
virtual std::unique_ptr< Utf8To32ReadResourceutf8To32ReadResource () const =0
 Get a UTF-8 to UTF-32 read resource for the URI. More...
 

Detailed Description

An abstract universal resource identifier.

Constructor & Destructor Documentation

◆ ~Uri()

virtual ~Uri ( )
virtualdefault

Destroy the URI instance.

Member Function Documentation

◆ append()

virtual std::unique_ptr<Uri> append ( const std::string &  pathComponent) const
pure virtual

Appends the path component to the supplied URI, returning a new URI.

If the URI type does not permit appending of path components, UnsupportedOperationException is thrown.

Implemented in ZipFile, File, StringUri, Http, Https, and ZipEntry.

◆ byteReadResource()

virtual std::unique_ptr<ByteReadResource> byteReadResource ( ) const
pure virtual

Get a byte read resource for the URI.

Exceptions
NotImplementedExceptionif the URI does not support reading
ResourceExceptionif the resource could not be created

Implemented in File, ZipFile, StringUri, ZipEntry, Http, and Https.

◆ byteWriteResource()

virtual std::unique_ptr<ByteWriteResource> byteWriteResource ( )
pure virtual

Get a byte write resource for the URI.

Exceptions
NotImplementedExceptionif the URI does not support writing
ResourceExceptionif the resource could not be created

Implemented in File, ZipFile, StringUri, ZipEntry, Http, and Https.

◆ canReadFrom()

virtual bool canReadFrom ( ) const
pure virtual

Can data be read from the URI via a read resource.

Implemented in File, ZipFile, StringUri, ZipEntry, Http, and Https.

◆ canWriteTo()

virtual bool canWriteTo ( ) const
pure virtual

Can data be written to the URI via a write resource.

Implemented in File, ZipFile, StringUri, ZipEntry, Http, and Https.

◆ clone()

virtual std::unique_ptr<Uri> clone ( ) const
pure virtual

Clone the concrete Uri.

Returns
a clone of the URI

Implemented in ZipFile, File, StringUri, Http, Https, and ZipEntry.

◆ cloneToShared()

std::shared_ptr<Uri> cloneToShared ( ) const
inline

Clone the concrete Uri to a shared pointer.

Returns
a clone of the URI in a shared pointer

◆ dispatch()

virtual void dispatch ( UriDispatcher visitor) const
pure virtual

Visitor pattern dispatching.

Parameters
visitorthe visitor to visit

Implemented in File, ZipFile, StringUri, ZipEntry, Http, and Https.

◆ hashcode()

virtual size_t hashcode ( ) const
pure virtualnoexcept

Get the URI's hash code.

Returns
the hash code

Implemented in File, ZipEntry, StringUri, and Url.

◆ isIterable()

virtual bool isIterable ( ) const
pure virtual

Does the URI have a non-recursive iterator (examples: file and zip archive URIs).

Implemented in File, ZipFile, StringUri, ZipEntry, Http, and Https.

◆ isRecursivelyIterable()

virtual bool isRecursivelyIterable ( ) const
pure virtual

Does the URI have a recursive iterator (examples: file and zip archive URIs).

Implemented in File, ZipFile, StringUri, ZipEntry, Http, and Https.

◆ isRegularDirectory()

virtual bool isRegularDirectory ( ) const
pure virtual

Returns true if the URI points to a file directory.

Returns
true if the URI points to a file directory

Implemented in File, ZipFile, ZipEntry, StringUri, and Url.

◆ isRegularFile()

virtual bool isRegularFile ( ) const
pure virtual

Returns true if the URI is a regular file.

Returns
true if the URI is a regular file

Implemented in File, ZipFile, ZipEntry, StringUri, and Url.

◆ iterator()

virtual std::unique_ptr<UriIterator> iterator ( ) const
pure virtual

Get a (non-recursive) iterator.

This will throw a NotImplementedException if the URI does not have an iterator.

Implemented in File, ZipFile, StringUri, ZipEntry, Http, and Https.

◆ operator==()

virtual bool operator== ( const Uri rhs) const
pure virtual

Compare the supplied URI to the current URI.

Returns
true if the supplied URI is equal to the current URI.

Implemented in File, ZipFile, StringUri, ZipEntry, Http, and Https.

◆ recursiveIterator()

virtual std::unique_ptr<RecursiveUriIterator> recursiveIterator ( ) const
pure virtual

Get a recursive iterator.

This will throw a NotImplementedException if the URI does not have a recursive iterator.

Implemented in File, ZipFile, StringUri, ZipEntry, Http, and Https.

◆ resolve()

virtual std::unique_ptr<Uri> resolve ( std::string_view  path) const
pure virtual

Resolve the relative or absolute path, in reference to the current URI.

If the supplied path contains a scheme prefix, the URI fromString function will be called to create a new unrelated URI instance.

This method will determine the base path to use by applying the following rules.

  • If the URI path ends with a forward slash (or is a directory for file URIs), the base path is the URI path.
  • Otherwise, the rightmost path element is stripped from the URI path to form the base path.
Parameters
patha relative or absolute path, or a full URI
Returns
a new URI

Implemented in ZipFile, File, StringUri, Http, Https, and ZipEntry.

◆ toRawString()

virtual std::string toRawString ( ) const
pure virtual

Get a string representing the raw URI.

This may or may not be the same as the string returned by toUriString().

Returns
a string representing the raw URI

Implemented in File, File, StringUri, Http, Https, ZipEntry, and Url.

◆ toUriString()

virtual std::string toUriString ( ) const
pure virtual

Get a string representing the URI, complete with scheme.

Returns
a string representing the URI, complete with scheme

Implemented in File, StringUri, ZipEntry, and Url.

◆ utf32To8WriteResource()

virtual std::unique_ptr<Utf32To8WriteResource> utf32To8WriteResource ( )
pure virtual

Get a UTF-32 to UTF-8 write resource for the URI.

Exceptions
NotImplementedExceptionif the URI does not support writing
ResourceExceptionif the resource could not be created

Implemented in File, ZipFile, StringUri, ZipEntry, Http, and Https.

◆ utf8To32ReadResource()

virtual std::unique_ptr<Utf8To32ReadResource> utf8To32ReadResource ( ) const
pure virtual

Get a UTF-8 to UTF-32 read resource for the URI.

Exceptions
NotImplementedExceptionif the URI does not support reading
ResourceExceptionif the resource could not be created

Implemented in File, ZipFile, StringUri, ZipEntry, Http, and Https.


The documentation for this class was generated from the following file: