IoConnectionInterface Class Reference IO

#include <ioconnection.h>

Inheritance diagram for IoConnectionInterface:

详细描述

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

另请参阅
UrlScheme .

公共成员函数

const MAXON_METHOD Url GetUrl () 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 < Int64 GetContentLength ()
MAXON_METHOD IODETECT   IoDetect () const
MAXON_METHOD Result < IOATTRIBUTES IoGetAttributes () const
MAXON_METHOD Result < void >  IoSetAttributes ( IOATTRIBUTES flags, IOATTRIBUTES mask)
MAXON_METHOD Result < UniversalDateTime IoGetTime ( 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
  MAXON_OBSERVABLE_STATIC ( Bool , ObservableErrorOpenFile,(const Url &url, OPENSTREAMFLAGS flags), ObservableCombinerRunAllBoolUntilFalse)

私有成员函数

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

成员函数文档编制

◆  MAXON_INTERFACE()

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

◆  GetUrl()

const MAXON_METHOD Url & GetUrl ( ) const

Returns the corresponding Url connected to the IoConnectionRef.

返回
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.

参数
[in] flags See GETBROWSEITERATORFLAGS.
返回
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.

参数
[in] flags See OPENSTREAMFLAGS for details.
返回
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.

参数
[in] flags See OPENSTREAMFLAGS for details.
返回
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.

参数
[in] flags See OPENSTREAMFLAGS for details.
返回
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.

返回
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.

返回
IOATTRIBUTES of the files.

◆  IoSetAttributes()

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

Modify the file attributes.

参数
[in] flags Flags to set/clear.
[in] mask Mask with all flags to be changed.
返回
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.

参数
[in] mode IOTIMEMODE of the requested time.
返回
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.

参数
[in] mode IOTIMEMODE of the requested time.
[in] dateTime New datetime for the file.
返回
True is the operation was successful.

◆  IoDelete()

MAXON_METHOD Result <void> IoDelete ( Bool   force )

Deletes the file physically on the medium.

参数
[in] force True tries to deletes the file/directory even if the file/directory has read only flags set.
返回
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.

参数
[in] createParents Check if parent directory exists and if not create them recursively.
[out] createdDirs An 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.
返回
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.

参数
[in] destName Destination name for the copy operation.
[in] overwrite True to allow overwriting destName file if it was already there.
[in] removeReadOnly True to remove the read only flag on the newly created copy.
返回
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.

参数
[in] destName Destination name for the move operation.
返回
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.

参数
[in] newName Destination name for the move operation.
返回
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.

参数
[out] availableBytes The number of available bytes on the volume.
[out] totalBytes The total size of the volume in bytes.
返回
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.

参数
[in] flags Flags to define how to show/open that file.
返回
OK on success.

◆  MAXON_OBSERVABLE_STATIC()

MAXON_OBSERVABLE_STATIC ( Bool   ,
ObservableErrorOpenFile  ,
(const Url &url, OPENSTREAMFLAGS flags)  ,
ObservableCombinerRunAllBoolUntilFalse   
)

Invokes the observer(s) with the url and open flags if writing a file failed to call open. return true to continue calling handlers, false to stop.