IoConnectionInterface Class Reference

#include <ioconnection.h>

Inheritance diagram for IoConnectionInterface:

Detailed Description

The connection interface a given Url. This connection needs to be implemented for each protocol.

See also
UrlScheme.

Public Member Functions

MAXON_METHOD const UrlGetUrl () const
 
MAXON_METHOD Result< IoBrowseRef > GetBrowseIterator (GETBROWSEITERATORFLAGS flags)
 
MAXON_METHOD Result< InputStreamRef > OpenInputStream (OPENSTREAMFLAGS flags=OPENSTREAMFLAGS::NONE)
 
MAXON_METHOD Result< OutputStreamRef > OpenOutputStream (OPENSTREAMFLAGS flags=OPENSTREAMFLAGS::NONE)
 
MAXON_METHOD Result< InOutputStreamRef > OpenInOutputStream (OPENSTREAMFLAGS flags=OPENSTREAMFLAGS::NONE)
 
MAXON_METHOD Result< Int64GetContentLength ()
 
MAXON_METHOD IODETECT IoDetect () const
 
MAXON_METHOD Result< IOATTRIBUTESIoGetAttributes () const
 
MAXON_METHOD Result< void > IoSetAttributes (IOATTRIBUTES flags, IOATTRIBUTES mask)
 
MAXON_METHOD Result< UniversalDateTimeIoGetTime (IOTIMEMODE mode) const
 
MAXON_METHOD Result< void > IoSetTime (IOTIMEMODE mode, const UniversalDateTime &dateTime)
 
MAXON_METHOD Result< void > IoDelete (Bool force)
 
MAXON_METHOD Result< void > IoCreateDirectory (Bool createParents, BaseArray< Url > *createdDirs=nullptr)
 
MAXON_METHOD Result< void > IoCopyFile (const Url &destName, Bool overwrite, Bool removeReadOnly)
 
MAXON_METHOD Result< void > IoMove (const Url &destName)
 
MAXON_METHOD Result< void > IoRename (const Url &newName)
 
MAXON_METHOD Result< void > IoGetFreeVolumeSpace (Int64 &availableBytes, Int64 &totalBytes) const
 
MAXON_METHOD Result< void > IoShowInOS (IOSHOWINOSFLAGS flags) const
 

Private Member Functions

 MAXON_INTERFACE (IoConnectionInterface, MAXON_REFERENCE_NORMAL, "net.maxon.interface.ioconnection")
 

Member Function Documentation

◆ MAXON_INTERFACE()

MAXON_INTERFACE ( IoConnectionInterface  ,
MAXON_REFERENCE_NORMAL  ,
"net.maxon.interface.ioconnection"   
)
private

◆ GetUrl()

MAXON_METHOD const Url& GetUrl ( ) const

Returns the corresponding Url connected to the IoConnectionRef.

Returns
Returns the name of the connection.

◆ GetBrowseIterator()

MAXON_METHOD Result<IoBrowseRef> GetBrowseIterator ( GETBROWSEITERATORFLAGS  flags)

Returns a IoBrowseInterface class to browse through all children of an Url. The return value needs to be checked against nullptr.

Parameters
[in]flagsSee GETBROWSEITERATORFLAGS.
Returns
IoBrowseInterface.

◆ OpenInputStream()

MAXON_METHOD Result<InputStreamRef> OpenInputStream ( OPENSTREAMFLAGS  flags = OPENSTREAMFLAGS::NONE)

Opens an InputStreamRef for the given connection. With this kind of streams it's only possible to read from it.

Parameters
[in]flagsSee OPENSTREAMFLAGS for details.
Returns
A pointer to the input stream. the pointer must be freed by ObjectInterface::Free(). The return value needs to be checked against nullptr.

◆ OpenOutputStream()

MAXON_METHOD Result<OutputStreamRef> OpenOutputStream ( OPENSTREAMFLAGS  flags = OPENSTREAMFLAGS::NONE)

Opens an OutputStreamRef for the given connection. With this kind of streams it's only possible to write to it.

Parameters
[in]flagsSee OPENSTREAMFLAGS for details.
Returns
Pointer to the output stream. the pointer must be freed by ObjectInterface::Free(). The return value needs to be checked against nullptr.

◆ OpenInOutputStream()

MAXON_METHOD Result<InOutputStreamRef> OpenInOutputStream ( OPENSTREAMFLAGS  flags = OPENSTREAMFLAGS::NONE)

Opens an InOutputStreamRef which can read/write for the given connection.

Parameters
[in]flagsSee OPENSTREAMFLAGS for details.
Returns
Pointer to the inoutputstream. The pointer must be freed by ObjectInterface::Free(). The return value needs to be checked against nullptr.

◆ GetContentLength()

MAXON_METHOD Result<Int64> GetContentLength ( )

Returns length of the content.

Returns
The effective size in bytes of the IoConnectionInterface (e.g. filesize).

◆ IoDetect()

MAXON_METHOD IODETECT IoDetect ( ) const

Detects the type of the Url. This allows to check if a file or directory exists.

◆ IoGetAttributes()

MAXON_METHOD Result<IOATTRIBUTES> IoGetAttributes ( ) const

Returns the file attributes.

Returns
IOATTRIBUTES of the files.

◆ IoSetAttributes()

MAXON_METHOD Result<void> IoSetAttributes ( IOATTRIBUTES  flags,
IOATTRIBUTES  mask 
)

Modify the file attributes.

Parameters
[in]flagsFlags to set/clear.
[in]maskMask with all flags to be changed.
Returns
OK on success.

◆ IoGetTime()

MAXON_METHOD Result<UniversalDateTime> IoGetTime ( IOTIMEMODE  mode) const

Returns the DateTime of the current file. the time is in local time.

Parameters
[in]modeIOTIMEMODE of the requested time.
Returns
Returns the DateTime or an error.

◆ IoSetTime()

MAXON_METHOD Result<void> IoSetTime ( IOTIMEMODE  mode,
const UniversalDateTime dateTime 
)

Modifies the DateTime of the current file. the time is in local time.

Parameters
[in]modeIOTIMEMODE of the requested time.
[in]dateTimeNew datetime for the file.
Returns
True is the operation was successful.

◆ IoDelete()

MAXON_METHOD Result<void> IoDelete ( Bool  force)

Deletes the file physically on the medium.

Parameters
[in]forceTrue tries to deletes the file/directory even if the file/directory has read only flags set.
Returns
True if the file/directory could be removed successfully.

◆ IoCreateDirectory()

MAXON_METHOD Result<void> IoCreateDirectory ( Bool  createParents,
BaseArray< Url > *  createdDirs = nullptr 
)

Creates a new directory. The function returns false if the directory already exists.

Parameters
[in]createParentsCheck if parent directory exists and if not create them recursively.
[out]createdDirsAn array that will contain all newly created subdirectories in the order in which they were created. If this parameter is nullptr it will be ignored.
Returns
True if the directory could be created successfully.

◆ IoCopyFile()

MAXON_METHOD Result<void> IoCopyFile ( const Url destName,
Bool  overwrite,
Bool  removeReadOnly 
)

Copies a file to a different location, the path must exist otherwise the function returns an error.

Parameters
[in]destNameDestination name for the copy operation.
[in]overwriteTrue to allow overwriting destName file if it was already there.
[in]removeReadOnlyTrue to remove the read only flag on the newly created copy.
Returns
OK on success.

◆ IoMove()

MAXON_METHOD Result<void> IoMove ( const Url destName)

Moves a file or directory (including hierarchy) to a different location, the path must exist otherwise the function returns an error. If the destName file or directory does already exist the function returns with an error. Moving a file or directory on the same partition will perform without a temporary copy.

Parameters
[in]destNameDestination name for the move operation.
Returns
OK on success.

◆ IoRename()

MAXON_METHOD Result<void> IoRename ( const Url newName)

Renames a file or directory. The newName must not be the name of an existing file or directory.

Parameters
[in]newNameDestination name for the move operation.
Returns
OK on success.

◆ IoGetFreeVolumeSpace()

MAXON_METHOD Result<void> IoGetFreeVolumeSpace ( Int64 availableBytes,
Int64 totalBytes 
) const

Calculates the free space on a volume. The Url can point to a volume or directory.

Parameters
[out]availableBytesThe number of available bytes on the volume.
[out]totalBytesThe total size of the volume in bytes.
Returns
OK on success.

◆ IoShowInOS()

MAXON_METHOD Result<void> IoShowInOS ( IOSHOWINOSFLAGS  flags) const

Opens or shows the file in the systems explorer (desktop/finder). Under windows that would be on the desktop/explorer. Under OSX this would be the Finder. Depending on the url scheme this could also open another browser.

Parameters
[in]flagsFlags to define how to show/open that file.
Returns
OK on success.