GOG GALAXY SDK Documentation
IStorage Class Referenceabstract

The interface for managing of cloud storage files. More...

#include <IStorage.h>

Public Member Functions

virtual void FileWrite (const char *fileName, const void *data, uint32_t dataSize)=0
 Writes data into the file. More...
 
virtual uint32_t FileRead (const char *fileName, void *data, uint32_t dataSize)=0
 Reads file content into the buffer. More...
 
virtual void FileDelete (const char *fileName)=0
 Deletes the file. More...
 
virtual bool FileExists (const char *fileName)=0
 Returns if the file exists. More...
 
virtual uint32_t GetFileSize (const char *fileName)=0
 Returns the size of the file. More...
 
virtual uint32_t GetFileTimestamp (const char *fileName)=0
 Returns the timestamp of the last file modification. More...
 
virtual uint32_t GetFileCount ()=0
 Returns number of the files in the storage. More...
 
virtual const char * GetFileNameByIndex (uint32_t index)=0
 Returns name of the file. More...
 
virtual void GetFileNameCopyByIndex (uint32_t index, char *buffer, uint32_t bufferLength)=0
 Copies the name of the file to a buffer. More...
 
virtual void FileShare (const char *fileName, IFileShareListener *const listener=NULL)=0
 Uploads the file for sharing. More...
 
virtual void DownloadSharedFile (SharedFileID sharedFileID, ISharedFileDownloadListener *const listener=NULL)=0
 Downloads previously shared file. More...
 
virtual const char * GetSharedFileName (SharedFileID sharedFileID)=0
 Gets name of downloaded shared file. More...
 
virtual void GetSharedFileNameCopy (SharedFileID sharedFileID, char *buffer, uint32_t bufferLength)=0
 Copies the name of downloaded shared file to a buffer. More...
 
virtual uint32_t GetSharedFileSize (SharedFileID sharedFileID)=0
 Gets size of downloaded shared file. More...
 
virtual GalaxyID GetSharedFileOwner (SharedFileID sharedFileID)=0
 Gets the owner of downloaded shared file. More...
 
virtual uint32_t SharedFileRead (SharedFileID sharedFileID, void *data, uint32_t dataSize, uint32_t offset=0)=0
 Reads downloaded shared file content into the buffer. More...
 
virtual void SharedFileClose (SharedFileID sharedFileID)=0
 Closes downloaded shared file and frees the memory. More...
 
virtual uint32_t GetDownloadedSharedFileCount ()=0
 Returns the number of open downloaded shared files. More...
 
virtual SharedFileID GetDownloadedSharedFileByIndex (uint32_t index)=0
 Returns the ID of the open downloaded shared file. More...
 

Detailed Description

The interface for managing of cloud storage files.

Member Function Documentation

◆ DownloadSharedFile()

virtual void DownloadSharedFile ( SharedFileID  sharedFileID,
ISharedFileDownloadListener *const  listener = NULL 
)
pure virtual

Downloads previously shared file.

This call is asynchronous. Responses come to the ISharedFileDownloadListener.

Parameters
[in]sharedFileIDThe ID of the shared file.
[in]listenerThe listener for specific operation.

◆ FileDelete()

virtual void FileDelete ( const char *  fileName)
pure virtual

Deletes the file.

Parameters
[in]fileNameThe name of the file in the form of a path (see the description of FileWrite()).

◆ FileExists()

virtual bool FileExists ( const char *  fileName)
pure virtual

Returns if the file exists.

Parameters
[in]fileNameThe name of the file in the form of a path (see the description of FileWrite()).
Returns
If the file exist.

◆ FileRead()

virtual uint32_t FileRead ( const char *  fileName,
void *  data,
uint32_t  dataSize 
)
pure virtual

Reads file content into the buffer.

Parameters
[in]fileNameThe name of the file in the form of a path (see the description of FileWrite()).
[in,out]dataThe output buffer.
[in]dataSizeThe size of the output buffer.
Returns
The number of bytes written to the buffer.

◆ FileShare()

virtual void FileShare ( const char *  fileName,
IFileShareListener *const  listener = NULL 
)
pure virtual

Uploads the file for sharing.

This call is asynchronous. Responses come to the IFileShareListener.

Parameters
[in]fileNameThe name of the file in the form of a path (see the description of FileWrite()).
[in]listenerThe listener for specific operation.

◆ FileWrite()

virtual void FileWrite ( const char *  fileName,
const void *  data,
uint32_t  dataSize 
)
pure virtual

Writes data into the file.

Precondition
The name that specifies the file has to be provided in the form of a relative path that uses slashes as separators and is a valid UTF-8 string. Every part of the path must must be portable, i.e. it cannot refer to any special or restricted name on any of the supported platforms. Backslashes are not allowed. The files created using this method will be stored in GOG Galaxy internal directory and should be accessed only via Galaxy SDK methods.
Parameters
[in]fileNameThe name of the file in the form of a path (see the description of the method).
[in]dataThe data to write.
[in]dataSizeThe size of the data to write.

◆ GetDownloadedSharedFileByIndex()

virtual SharedFileID GetDownloadedSharedFileByIndex ( uint32_t  index)
pure virtual

Returns the ID of the open downloaded shared file.

Parameters
[in]indexIndex as an integer in the range of [0, number of open downloaded shared files).
Returns
The ID of the shared file.

◆ GetDownloadedSharedFileCount()

virtual uint32_t GetDownloadedSharedFileCount ( )
pure virtual

Returns the number of open downloaded shared files.

Returns
The number of open downloaded shared files.

◆ GetFileCount()

virtual uint32_t GetFileCount ( )
pure virtual

Returns number of the files in the storage.

Returns
The number of the files in the storage.

◆ GetFileNameByIndex()

virtual const char* GetFileNameByIndex ( uint32_t  index)
pure virtual

Returns name of the file.

Parameters
[in]indexIndex as an integer in the range of [0, number of files).
Returns
The name of the file.

◆ GetFileNameCopyByIndex()

virtual void GetFileNameCopyByIndex ( uint32_t  index,
char *  buffer,
uint32_t  bufferLength 
)
pure virtual

Copies the name of the file to a buffer.

Parameters
[in]indexIndex as an integer in the range of [0, number of files).
[in,out]bufferThe output buffer.
[in]bufferLengthThe size of the output buffer.

◆ GetFileSize()

virtual uint32_t GetFileSize ( const char *  fileName)
pure virtual

Returns the size of the file.

Parameters
[in]fileNameThe name of the file in the form of a path (see the description of FileWrite()).
Returns
The size of the file.

◆ GetFileTimestamp()

virtual uint32_t GetFileTimestamp ( const char *  fileName)
pure virtual

Returns the timestamp of the last file modification.

Parameters
[in]fileNameThe name of the file in the form of a path (see the description of FileWrite()).
Returns
The time of file's last modification.

◆ GetSharedFileName()

virtual const char* GetSharedFileName ( SharedFileID  sharedFileID)
pure virtual

Gets name of downloaded shared file.

Precondition
Download the file first by calling DownloadSharedFile().
Parameters
[in]sharedFileIDThe ID of the shared file.
Returns
The name of the shared file.

◆ GetSharedFileNameCopy()

virtual void GetSharedFileNameCopy ( SharedFileID  sharedFileID,
char *  buffer,
uint32_t  bufferLength 
)
pure virtual

Copies the name of downloaded shared file to a buffer.

Precondition
Download the file first by calling DownloadSharedFile().
Parameters
[in]sharedFileIDThe ID of the shared file.
[in,out]bufferThe output buffer.
[in]bufferLengthThe size of the output buffer.

◆ GetSharedFileOwner()

virtual GalaxyID GetSharedFileOwner ( SharedFileID  sharedFileID)
pure virtual

Gets the owner of downloaded shared file.

Precondition
Download the file first by calling DownloadSharedFile().
Parameters
[in]sharedFileIDThe ID of the shared file.
Returns
The owner of the shared file.

◆ GetSharedFileSize()

virtual uint32_t GetSharedFileSize ( SharedFileID  sharedFileID)
pure virtual

Gets size of downloaded shared file.

Precondition
Download the file first by calling DownloadSharedFile().
Parameters
[in]sharedFileIDThe ID of the shared file.
Returns
The size of the shared file.

◆ SharedFileClose()

virtual void SharedFileClose ( SharedFileID  sharedFileID)
pure virtual

Closes downloaded shared file and frees the memory.

The content of the file will not be available until next download.

Precondition
Download the file first by calling DownloadSharedFile().
Parameters
[in]sharedFileIDThe ID of the shared file.

◆ SharedFileRead()

virtual uint32_t SharedFileRead ( SharedFileID  sharedFileID,
void *  data,
uint32_t  dataSize,
uint32_t  offset = 0 
)
pure virtual

Reads downloaded shared file content into the buffer.

Precondition
Download the file first by calling DownloadSharedFile().
Parameters
[in]sharedFileIDThe ID of the shared file.
[in,out]dataThe output buffer.
[in]dataSizeThe size of the output buffer.
[in]offsetThe number of bytes to skip from the beginning of the file.
Returns
The number of bytes written to the buffer.