IoHandlerInterface Class Reference

#include <iohandler.h>

Inheritance diagram for IoHandlerInterface:

Detailed Description

The IoHandler class offers some I/O functionality for filenames. This handler needs to be implemented for each scheme.

Public Member Functions

MAXON_METHOD const IdGetUrlScheme () const
 
MAXON_METHOD Result< void > SetSystemPath (UrlInterface &url, const String &systemPath) const
 
MAXON_METHOD Result< StringGetSystemPath (const UrlInterface &url) const
 
MAXON_METHOD Result< void > AppendUrl (UrlInterface &url, const String &name) const
 
MAXON_METHOD Result< void > AppendUrl (UrlInterface &url, const Url &relativeUrl) const
 
MAXON_METHOD Result< void > RemoveUrl (UrlInterface &url) const
 
MAXON_METHOD Result< IoConnectionRef > OpenConnection (const Url &name) const
 
MAXON_METHOD Result< UrlNormalize (const Url &url, NORMALIZEFLAGS flags) const
 
MAXON_METHOD Result< UrlIoNormalize (const Url &url, NORMALIZEFLAGS flags) const
 

Static Public Member Functions

static MAXON_METHOD IoHandler GetHandlerForScheme (const UrlScheme &scheme)
 

Private Member Functions

 MAXON_INTERFACE (IoHandlerInterface, MAXON_REFERENCE_CONST, "net.maxon.interface.iohandler")
 

Member Function Documentation

◆ MAXON_INTERFACE()

MAXON_INTERFACE ( IoHandlerInterface  ,
MAXON_REFERENCE_CONST  ,
"net.maxon.interface.iohandler"   
)
private

◆ GetUrlScheme()

MAXON_METHOD const Id& GetUrlScheme ( ) const

Returns the url scheme to use in Urls for this handler (such as "file" if this is the IoHandler for the file system).

Returns
Url scheme of this handler.

◆ SetSystemPath()

MAXON_METHOD Result<void> SetSystemPath ( UrlInterface url,
const String systemPath 
) const

Converts an OS- or handler-specific system path to a Url.

Parameters
[out]urlThe url that will be filled.
[in]systemPathThe path.
Returns
OK on success.

◆ GetSystemPath()

MAXON_METHOD Result<String> GetSystemPath ( const UrlInterface url) const

Translates a Url to a OS- or handler-specific system path.

Parameters
[in]urlThe Url.
Returns
The generated path.

◆ AppendUrl() [1/2]

MAXON_METHOD Result<void> AppendUrl ( UrlInterface url,
const String name 
) const

Appends the given file name to the url.

Parameters
[in,out]urlThe Url.
[in]nameA file name to add.
Returns
OK on success.

◆ AppendUrl() [2/2]

MAXON_METHOD Result<void> AppendUrl ( UrlInterface url,
const Url relativeUrl 
) const

Appends the given relative url to the url.

Parameters
[in,out]urlThe Url.
[in]relativeUrlThe Url to be added.
Returns
OK on success.

◆ RemoveUrl()

MAXON_METHOD Result<void> RemoveUrl ( UrlInterface url) const

Removes the last part of the given url and returns the parent url.

Parameters
[in,out]urlThe Url.
Returns
OK on success.

◆ OpenConnection()

MAXON_METHOD Result<IoConnectionRef> OpenConnection ( const Url name) const

Opens a connection and returns the specified IoConnectionRef handler for this type of protocol.

Parameters
[in]nameUrl of the connection to open.
Returns
Pointer to a specialized IoConnectionRef.

◆ Normalize()

MAXON_METHOD Result<Url> Normalize ( const Url url,
NORMALIZEFLAGS  flags 
) const

Return a normalized a url. Does not involve any Io operation and is just syntax based. If nothing needs to be normalized the same path is returned.

Parameters
[in]flagsFlags to define type of normalization.
Returns
The normalized url. In case of a normalization error *this is returned.

◆ IoNormalize()

MAXON_METHOD Result<Url> IoNormalize ( const Url url,
NORMALIZEFLAGS  flags 
) const

Return a normalized a url. If the normalized url is a link, the IoHandler can resolve it (if supported). E.g. the file:/// handler resolves symbolic links, where the http:// handler does not resolve llinks.

Parameters
[in]flagsFlags to define type of normalization.
Returns
The normalized and resolved url. In case of a normalization error *this is returned.

◆ GetHandlerForScheme()

static MAXON_METHOD IoHandler GetHandlerForScheme ( const UrlScheme scheme)
static

Returns the IoHandler which is responsible for the given scheme. The IoHandler is searched for at the IoHandlers registry.

Parameters
[in]schemeThe Url scheme for which the matching IoHandler shall be found.
Returns
The matching IoHandler, or a null reference.