CartoType C++ API 8.8-7-gb35e4dc71
for Windows, Linux, Qt and other platforms supporting C++ development
Classes | Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | List of all members
CartoTypeCore::FileInputStreamBase Class Referenceabstract

#include <cartotype_stream.h>

Inheritance diagram for CartoTypeCore::FileInputStreamBase:
CartoTypeCore::InputStream CartoTypeCore::FileInputStream

Classes

class  CBuffer
 

Public Member Functions

void StreamRead (const uint8_t *&aPointer, size_t &aLength) override
 
bool StreamEnd () const override
 
void StreamSeek (int64_t aPosition) override
 
int64_t StreamPosition () override
 
int64_t StreamLength () override
 
std::string StreamName () override
 
 FileInputStreamBase (const FileInputStreamBase &)=delete
 
 FileInputStreamBase (FileInputStreamBase &&)=delete
 
void operator= (const FileInputStreamBase &)=delete
 
void operator= (FileInputStreamBase &&)=delete
 
- Public Member Functions inherited from CartoTypeCore::InputStream
virtual ~InputStream ()
 
virtual std::unique_ptr< InputStreamCopy ()=0
 
virtual int64_t StreamLength ()=0
 
virtual std::string StreamName ()
 
void Seek (int64_t aPosition)
 
int64_t Position () const
 
bool EndOfData () const
 
uint8_t ReadUint8 ()
 
uint16_t ReadUint16 ()
 
uint16_t ReadUint16LE ()
 
uint32_t ReadUint32 ()
 
uint32_t ReadUint32LE ()
 
uint64_t ReadUint40 ()
 
int64_t ReadFilePos ()
 
int64_t ReadFilePosWithDegreeSquare ()
 
int32_t FilePosBytes () const
 
void SetFilePosBytes (int32_t aBytes)
 
uint32_t ReadUintOfSize (int32_t aSize)
 
uint32_t ReadUintOfSizeLE (int32_t aSize)
 
uint64_t ReadUint ()
 
int64_t ReadInt ()
 
uint32_t ReadUintMax32 ()
 
int32_t ReadIntMax32 ()
 
float ReadFloat ()
 
float ReadFloatLE ()
 
double ReadDouble ()
 
double ReadDoubleLE ()
 
void ReadLine (uint8_t *aBuffer, size_t aMaxBytes, size_t &aActualBytes)
 
void ReadBytes (uint8_t *aBuffer, size_t aMaxBytes, size_t &aActualBytes)
 
void Read (const uint8_t *&aPointer, size_t &aLength)
 
String ReadNullTerminatedString ()
 
String ReadUtf8StringWithLength ()
 
std::string ReadUtf8StringWithLengthToStdString ()
 
std::string ReadUtf8StringToStdString ()
 
String ReadString (size_t *aBytesRead=nullptr)
 
void SkipUtf8String (size_t *aBytesRead=nullptr)
 
void Skip (int64_t aBytes)
 
const uint8_t * Read (size_t aBytes)
 
uint64_t ReadUint48 ()
 
uint64_t ReadUint56 ()
 

Static Public Attributes

static constexpr size_t KDefaultBufferSize = 64 * 1024
 
static constexpr size_t KDefaultMaxBuffers = 32
 

Protected Types

using CBufferList = std::list< CBuffer >
 

Protected Member Functions

void Construct (size_t aBufferSize, size_t aMaxBuffers)
 
virtual void ReadBuffer (CBuffer &aBuffer, int64_t aPos)=0
 

Protected Attributes

CBufferList iBuffers
 
size_t iBufferSize = KDefaultBufferSize
 
int64_t iLogicalPosition = 0
 
int64_t iLength = 0
 
std::string iName
 

Detailed Description

The base class for file input stream classes.

Member Typedef Documentation

◆ CBufferList

A type for the data cache.

Member Function Documentation

◆ Construct()

void CartoTypeCore::FileInputStreamBase::Construct ( size_t  aBufferSize,
size_t  aMaxBuffers 
)
protected

Constructs a FileInputStreamBase object given a buffer size and a maximum number of buffers.

◆ ReadBuffer()

virtual void CartoTypeCore::FileInputStreamBase::ReadBuffer ( CBuffer aBuffer,
int64_t  aPos 
)
protectedpure virtual

Override this function to read a buffer at a certain position in the file.

Implemented in CartoTypeCore::FileInputStream.

◆ StreamEnd()

bool CartoTypeCore::FileInputStreamBase::StreamEnd ( ) const
overridevirtual

Returns whether the end of the stream has been reached.

Implements CartoTypeCore::InputStream.

◆ StreamLength()

int64_t CartoTypeCore::FileInputStreamBase::StreamLength ( )
inlineoverridevirtual

Returns the number of bytes in the stream.

Implements CartoTypeCore::InputStream.

◆ StreamName()

std::string CartoTypeCore::FileInputStreamBase::StreamName ( )
inlineoverridevirtual

Returns 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 CartoTypeCore::InputStream.

◆ StreamPosition()

int64_t CartoTypeCore::FileInputStreamBase::StreamPosition ( )
inlineoverridevirtual

Returns the current position.

Implements CartoTypeCore::InputStream.

◆ StreamRead()

void CartoTypeCore::FileInputStreamBase::StreamRead ( const uint8_t *&  aPointer,
size_t &  aLength 
)
overridevirtual

Reads some data into a buffer owned by the InputStream object and returns a pointer to it in aPointer. Returns 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 CartoTypeCore::InputStream.

◆ StreamSeek()

void CartoTypeCore::FileInputStreamBase::StreamSeek ( int64_t  aPosition)
overridevirtual

Seeks to the specified position.

Implements CartoTypeCore::InputStream.

Member Data Documentation

◆ iBuffers

CBufferList CartoTypeCore::FileInputStreamBase::iBuffers
protected

Cached data from the file.

◆ iBufferSize

size_t CartoTypeCore::FileInputStreamBase::iBufferSize = KDefaultBufferSize
protected

The size of a buffer in bytes.

◆ iLength

int64_t CartoTypeCore::FileInputStreamBase::iLength = 0
protected

the length of the file in bytes.

◆ iLogicalPosition

int64_t CartoTypeCore::FileInputStreamBase::iLogicalPosition = 0
protected

The position in the file from the user's point of view.

◆ iName

std::string CartoTypeCore::FileInputStreamBase::iName
protected

The name of the file.

◆ KDefaultBufferSize

constexpr size_t CartoTypeCore::FileInputStreamBase::KDefaultBufferSize = 64 * 1024
staticconstexpr

The default size of each buffer in bytes.

◆ KDefaultMaxBuffers

constexpr size_t CartoTypeCore::FileInputStreamBase::KDefaultMaxBuffers = 32
staticconstexpr

The default maximum number of buffers.


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