Go to the documentation of this file.
65 #ifndef IOINTERFACEFILE_H
66 #define IOINTERFACEFILE_H
108 bool isOpen()
const override;
XsResultValue flushFileBuffers()
Flushes the buffers of a specified file and causes all buffered data to be written to a file.
XsResultValue setWritePosition(XsFilePos pos=-1)
Set the new absolute write position.
void gotoWrite()
Change from reading to writing mode.
XsResultValue open(const XsString &filename, bool createNew, bool readOnly)
Open a file.
A list of uint8_t values.
XsString getFileName() const
Return the filename that was last successfully opened.
bool isReadOnly() const
Return whether the file is read-only or not.
XsResultValue getName(XsString &filename) const
Retrieve the filename that was last successfully opened.
XsResultValue flushData() override
Flush all data in the buffers to and from the device.
XsResultValue m_lastResult
The last result of an operation.
XsResultValue appendData(const XsByteArray &bdata)
Write data to the end of the file.
XsFilePos m_writePos
The last write position in the file.
XsTimeStamp getFileDate() const
Return the creation date of the file.
XsResultValue insertData(XsFilePos start, const XsByteArray &data)
Insert the given data into the file.
The low-level file communication class.
XsResultValue deleteData(XsFilePos start, XsFilePos length)
Delete the given data from the file.
void gotoRead()
Change from writing to reading mode.
XsFilePos getReadPosition() const
Return the current read position.
XsFile * m_handle
The file handle, also indicates if the file is open or not.
XsFilePos m_readPos
The last read position in the file.
XsResultValue setReadPosition(XsFilePos pos)
Set the new absolute read position.
XsResultValue
Xsens result values.
static const XsFilePos m_fileBlockSize
The default file block size.
XsFilePos getFileSize() const
Return the size of the file.
XsResultValue readDataBlocks(XsFilePos blockCount, XsByteArray &data)
This function will read blocks of data aligned to m_fileBlockSize.
XSENS_DISABLE_COPY(IoInterfaceFile)
XsResultValue reserve(XsFilePos minSize)
Make sure the file is at least minSize bytes big.
XsResultValue closeFile()
Close the file.
XsFilePos getWritePosition() const
Return the current write position.
bool m_readOnly
Indicates if the file was opened in read-only mode.
XsString m_filename
Contains the name of the file that was last successfully opened.
XsResultValue find(const XsByteArray &data, XsFilePos &pos)
Find a string of bytes in the file.
XsResultValue readTerminatedData(XsFilePos maxLength, unsigned char terminator, XsByteArray &bdata)
Read data from the file and put it into the data buffer.
XsResultValue getLastResult() const override
Return the result code of the last operation.
Encapsulates a file, providing a platform independent interface.
XsResultValue close() override
Close the file, overrides IoInterface::close().
An abstract IO interface.
XsResultValue writeData(const XsByteArray &data, XsFilePos *written=nullptr) override
Write the data contained in data to the device.
XsFilePos m_fileSize
Contains the size of the file.
bool isOpen() const override
Return whether the file is open or not.
bool m_reading
Indicates whether the last operation was a read or write operation.
XsResultValue readData(XsFilePos maxLength, XsByteArray &data) override
Read at most maxLength bytes from the device into data.
int64_t XsFilePos
The type that is used for positioning inside a file.
A 0-terminated managed string of characters.
XsResultValue create(const XsString &filename)
Create an empty file.
This class contains method to set, retrieve and compare timestamps.
XsResultValue closeAndDelete()
Close the file and delete it.