Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
XFILE::CPosixFile Class Reference

#include <PosixFile.h>

Inheritance diagram for XFILE::CPosixFile:
XFILE::IFile

Public Member Functions

 ~CPosixFile () override
 
bool Open (const CURL &url) override
 
bool OpenForWrite (const CURL &url, bool bOverWrite=false) override
 
void Close () override
 
ssize_t Read (void *lpBuf, size_t uiBufSize) override
 
ssize_t Write (const void *lpBuf, size_t uiBufSize) override
 
int64_t Seek (int64_t iFilePosition, int iWhence=SEEK_SET) override
 
int Truncate (int64_t size) override
 
int64_t GetPosition () override
 
int64_t GetLength () override
 
void Flush () override
 
int IoControl (EIoControl request, void *param) override
 
bool Delete (const CURL &url) override
 
bool Rename (const CURL &url, const CURL &urlnew) override
 
bool Exists (const CURL &url) override
 
int Stat (const CURL &url, struct __stat64 *buffer) override
 
int Stat (struct __stat64 *buffer) override
 
- Public Member Functions inherited from XFILE::IFile
 IFile ()
 
virtual ~IFile ()
 
virtual bool ReOpen (const CURL &url)
 
virtual bool ReadString (char *szLine, int iLineLength)
 
virtual int GetChunkSize ()
 
virtual double GetDownloadSpeed ()
 
virtual bool SetHidden (const CURL &url, bool hidden)
 
virtual const std::string GetProperty (XFILE::FileProperty type, const std::string &name="") const
 
virtual const std::vector< std::string > GetPropertyValues (XFILE::FileProperty type, const std::string &name="") const
 

Protected Attributes

int m_fd = -1
 
int64_t m_filePos = -1
 
int64_t m_lastDropPos = -1
 
bool m_allowWrite = false
 

Constructor & Destructor Documentation

◆ ~CPosixFile()

CPosixFile::~CPosixFile ( )
override

Member Function Documentation

◆ Close()

void CPosixFile::Close ( )
overridevirtual

Implements XFILE::IFile.

◆ Delete()

bool CPosixFile::Delete ( const CURL & url)
overridevirtual

Reimplemented from XFILE::IFile.

◆ Exists()

bool CPosixFile::Exists ( const CURL & url)
overridevirtual

Implements XFILE::IFile.

◆ Flush()

void CPosixFile::Flush ( )
overridevirtual

Reimplemented from XFILE::IFile.

◆ GetLength()

int64_t CPosixFile::GetLength ( )
overridevirtual

Implements XFILE::IFile.

◆ GetPosition()

int64_t CPosixFile::GetPosition ( )
overridevirtual

Implements XFILE::IFile.

◆ IoControl()

int CPosixFile::IoControl ( EIoControl request,
void * param )
overridevirtual

Reimplemented from XFILE::IFile.

◆ Open()

bool CPosixFile::Open ( const CURL & url)
overridevirtual

Implements XFILE::IFile.

◆ OpenForWrite()

bool CPosixFile::OpenForWrite ( const CURL & url,
bool bOverWrite = false )
overridevirtual

Reimplemented from XFILE::IFile.

◆ Read()

ssize_t CPosixFile::Read ( void * bufPtr,
size_t bufSize )
overridevirtual

Attempt to read bufSize bytes from currently opened file into buffer bufPtr.

Parameters
bufPtrpointer to buffer
bufSizesize of the buffer
Returns
number of successfully read bytes if any bytes were read and stored in buffer, zero if no bytes are available to read (end of file was reached) or undetectable error occur, -1 in case of any explicit error

Implements XFILE::IFile.

◆ Rename()

bool CPosixFile::Rename ( const CURL & url,
const CURL & urlnew )
overridevirtual

Reimplemented from XFILE::IFile.

◆ Seek()

int64_t CPosixFile::Seek ( int64_t iFilePosition,
int iWhence = SEEK_SET )
overridevirtual

Implements XFILE::IFile.

◆ Stat() [1/2]

int CPosixFile::Stat ( const CURL & url,
struct __stat64 * buffer )
overridevirtual

Fills struct __stat64 with information about file specified by url. For st_mode function will set correctly _S_IFDIR (directory) flag and may set _S_IREAD (read permission), _S_IWRITE (write permission) flags if such information is available. Function may set st_size (file size), st_atime, st_mtime, st_ctime (access, modification, creation times). Any other flags and members of __stat64 that didn't updated with actual file information will be set to zero (st_nlink can be set ether to 1 or zero).

Parameters
urlspecifies requested file
bufferpointer to __stat64 buffer to receive information about file
Returns
zero of success, -1 otherwise.

Implements XFILE::IFile.

◆ Stat() [2/2]

int CPosixFile::Stat ( struct __stat64 * buffer)
overridevirtual

Fills struct __stat64 with information about currently open file For st_mode function will set correctly _S_IFDIR (directory) flag and may set _S_IREAD (read permission), _S_IWRITE (write permission) flags if such information is available. Function may set st_size (file size), st_atime, st_mtime, st_ctime (access, modification, creation times). Any other flags and members of __stat64 that didn't updated with actual file information will be set to zero (st_nlink can be set ether to 1 or zero).

Parameters
bufferpointer to __stat64 buffer to receive information about file
Returns
zero of success, -1 otherwise.

Reimplemented from XFILE::IFile.

◆ Truncate()

int CPosixFile::Truncate ( int64_t size)
overridevirtual

Reimplemented from XFILE::IFile.

◆ Write()

ssize_t CPosixFile::Write ( const void * bufPtr,
size_t bufSize )
overridevirtual

Attempt to write bufSize bytes from buffer bufPtr into currently opened file.

Parameters
bufPtrpointer to buffer
bufSizesize of the buffer
Returns
number of successfully written bytes if any bytes were written, zero if no bytes were written and no detectable error occur, -1 in case of any explicit error

Reimplemented from XFILE::IFile.

Member Data Documentation

◆ m_allowWrite

bool XFILE::CPosixFile::m_allowWrite = false
protected

◆ m_fd

int XFILE::CPosixFile::m_fd = -1
protected

◆ m_filePos

int64_t XFILE::CPosixFile::m_filePos = -1
protected

◆ m_lastDropPos

int64_t XFILE::CPosixFile::m_lastDropPos = -1
protected

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