CartoType C++ API 7.8.2, 2022-03-25
for Windows, Linux, Qt and other platforms supporting C++ development
Public Member Functions | Static Public Member Functions | List of all members
CartoType::CSimpleFileInputStream Class Reference

#include <cartotype_stream.h>

Inheritance diagram for CartoType::CSimpleFileInputStream:

Public Member Functions

 CSimpleFileInputStream (const std::string &aFileName, size_t aBufferSize=64 *1024)
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
- 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< CSimpleFileInputStreamNew (TResult &aError, const std::string &aFileName, size_t aBufferSize=64 *1024)

Detailed Description

A simple file input stream that does not use seek when reading sequentially. If the first part of the filename, before any extensions, is '-', it reads from standard input.

Constructor & Destructor Documentation

◆ CSimpleFileInputStream()

CartoType::CSimpleFileInputStream::CSimpleFileInputStream ( const std::string &  aFilename,
size_t  aBufferSize = 64 * 1024 

Creates a CSimpleFileInputStream to read from the file aFileName. Throws an exception if the file cannot be opened.

Creates a stream to read from the file aFilename, optionally supplying a buffer size in bytes.

Member Function Documentation

◆ EndOfStream()

bool CartoType::CSimpleFileInputStream::EndOfStream ( ) const

Return whether the end of the stream has been reached.

Implements CartoType::MInputStream.

◆ Length()

int64_t CartoType::CSimpleFileInputStream::Length ( )

Return the number of bytes in the stream.

Implements CartoType::MInputStream.

◆ Name()

std::string CartoType::CSimpleFileInputStream::Name ( )

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.

◆ New()

std::unique_ptr< CSimpleFileInputStream > CartoType::CSimpleFileInputStream::New ( TResult aError,
const std::string &  aFileName,
size_t  aBufferSize = 64 * 1024 

Creates a CSimpleFileInputStream to read from the file aFileName. Returns the result in aError.

◆ Position()

int64_t CartoType::CSimpleFileInputStream::Position ( )

Return the current position.

Implements CartoType::MInputStream.

◆ Read()

void CartoType::CSimpleFileInputStream::Read ( const uint8_t *&  aPointer,
size_t &  aLength 

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.

◆ Seek()

void CartoType::CSimpleFileInputStream::Seek ( int64_t  aPosition)

Seek to the specified position.

Implements CartoType::MInputStream.

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