CartoType C++ API 7.8.2, 2022-03-25
for Windows, Linux, Qt and other platforms supporting C++ development
|
#include <cartotype_stream.h>
Classes | |
class | CBuffer |
Public Member Functions | |
CFileInputStream (const std::string &aFileName, size_t aBufferSize=KDefaultBufferSize, size_t aMaxBuffers=KDefaultMaxBuffers) | |
virtual std::unique_ptr< CFileInputStream > | Copy () |
void | Read (const uint8_t *&aPointer, size_t &aLength) override |
bool | EndOfStream () const override |
void | Seek (int64_t aPosition) override |
int64_t | Position () override |
int64_t | Length () override |
std::string | Name () override |
CFileInputStream (const CFileInputStream &)=delete | |
CFileInputStream (CFileInputStream &&)=delete | |
void | operator= (const CFileInputStream &)=delete |
void | operator= (CFileInputStream &&)=delete |
Public Member Functions inherited from CartoType::MInputStream | |
virtual | ~MInputStream () |
virtual void | Read (const uint8_t *&aPointer, size_t &aLength)=0 |
virtual bool | EndOfStream () const =0 |
virtual void | Seek (int64_t aPosition)=0 |
virtual int64_t | Position ()=0 |
virtual int64_t | Length ()=0 |
virtual std::string | Name () |
Static Public Member Functions | |
static std::unique_ptr< CFileInputStream > | New (TResult &aError, const std::string &aFileName, size_t aBufferSize=KDefaultBufferSize, size_t aMaxBuffers=KDefaultMaxBuffers) |
Static Public Attributes | |
static constexpr size_t | KDefaultBufferSize = 64 * 1024 |
static constexpr size_t | KDefaultMaxBuffers = 32 |
Protected Types | |
using | CBufferList = CList< CBuffer > |
Protected Member Functions | |
virtual void | ReadBuffer (CBuffer &aBuffer, int64_t aPos) |
Protected Attributes | |
CBinaryInputFile | iFile |
CBufferList | iBuffers |
size_t | iBufferSize = KDefaultBufferSize |
int64_t | iPositionInFile = 0 |
int64_t | iLogicalPosition = 0 |
int64_t | iLength = 0 |
std::string | iName |
Input stream for a file. The user of this stream determines the buffer size that is used to read from the file.
|
protected |
A type for the data cache.
CartoType::CFileInputStream::CFileInputStream | ( | const std::string & | aFileName, |
size_t | aBufferSize = KDefaultBufferSize , |
||
size_t | aMaxBuffers = KDefaultMaxBuffers |
||
) |
Creates a CFileInputStream to read from the file aFileName. Throws an exception if the file cannot be opened.
|
virtual |
Returns a copy of this CFileInputStream.
|
overridevirtual |
Return whether the end of the stream has been reached.
Implements CartoType::MInputStream.
|
inlineoverridevirtual |
Return the number of bytes in the stream.
Implements CartoType::MInputStream.
|
inlineoverridevirtual |
Return the file name or URI associated with the stream if any. Return the empty string is there is no file name or URI.
Reimplemented from CartoType::MInputStream.
|
static |
Creates a CFileInputStream to read from the file aFileName. Returns the result in aError.
|
inlineoverridevirtual |
Return the current position.
Implements CartoType::MInputStream.
|
overridevirtual |
Read some data into a buffer owned by the MInputStream object and return a pointer to it in aPointer. Return the number of bytes of data in aLength. This function will return at least one byte if there are bytes remaining in the stream. The pointer is valid until the next call to Read.
Implements CartoType::MInputStream.
|
protectedvirtual |
Override this function to read a buffer at a certain position in the file.
|
overridevirtual |
Seek to the specified position.
Implements CartoType::MInputStream.
|
protected |
Cached data from the file.
|
protected |
The size of a buffer in bytes.
|
protected |
The file.
|
protected |
the length of the file in bytes.
|
protected |
The position in the file from the user's point of view.
|
protected |
The name of the file.
|
protected |
The physical position in the file.
|
staticconstexpr |
The default size of each buffer in bytes.
|
staticconstexpr |
The default maximum number of buffers.