DUDS
Distributed Update of Data from Something
duds::ui::graphics::BppImageArchiveSequence Class Reference

Provides an input iterator to a sequence of named bit-per-pixel images read from an input stream. More...

#include <BppImageArchiveSequence.hpp>

Inheritance diagram for duds::ui::graphics::BppImageArchiveSequence:
Collaboration diagram for duds::ui::graphics::BppImageArchiveSequence:

Classes

class  iterator
 An input iterator that will parse and supply image data from the stream. More...
 

Public Member Functions

 BppImageArchiveSequence (std::istream &str)
 Constructs the sequence parser to use the stream str. More...
 
iterator begin ()
 Parses the first image in the stream and returns an iterator to that data. More...
 
void readHeader ()
 Parses the headers used in BppImageArchive files. More...
 

Static Public Member Functions

static constexpr iterator end ()
 Returns the end iterator. More...
 

Public Attributes

friend iterator
 

Protected Member Functions

 BppImageArchiveSequence ()=default
 Only use when a derived class will set is. More...
 

Protected Attributes

std::pair< std::string, BppImageSptrderef
 Stores the last parsed image data. More...
 
std::istream * is
 The stream which contains image data. More...
 

Detailed Description

Provides an input iterator to a sequence of named bit-per-pixel images read from an input stream.

Author
Jeff Jackowski

Definition at line 21 of file BppImageArchiveSequence.hpp.

Constructor & Destructor Documentation

◆ BppImageArchiveSequence() [1/2]

duds::ui::graphics::BppImageArchiveSequence::BppImageArchiveSequence ( )
protecteddefault

Only use when a derived class will set is.

◆ BppImageArchiveSequence() [2/2]

duds::ui::graphics::BppImageArchiveSequence::BppImageArchiveSequence ( std::istream &  str)
inline

Constructs the sequence parser to use the stream str.

Parameters
strThe stream that will provide the image data. It must remain valid (useable object, not error-free) during the life span of this object.

Definition at line 46 of file BppImageArchiveSequence.hpp.

Member Function Documentation

◆ begin()

BppImageArchiveSequence::iterator duds::ui::graphics::BppImageArchiveSequence::begin ( )

Parses the first image in the stream and returns an iterator to that data.

This function must only be called once on a specific object. It does not parse any headers, like the one used for bit-per-pixel image archive files. To parse headers, call readHeaders() first.

Precondition
begin() has not yet been called on this object.
Postcondition
begin() must not be called again on this object.
Exceptions
ImageArchiveStreamTruncatedErrorThe first image has incomplete data.

Definition at line 16 of file BppImageArchiveSequence.cpp.

Referenced by duds::ui::graphics::BppImageArchive::load(), and duds::ui::graphics::BppFont::load().

◆ end()

static constexpr iterator duds::ui::graphics::BppImageArchiveSequence::end ( )
inlinestatic

Returns the end iterator.

Definition at line 140 of file BppImageArchiveSequence.hpp.

Referenced by duds::ui::graphics::BppImageArchive::load(), and duds::ui::graphics::BppFont::load().

◆ readHeader()

void duds::ui::graphics::BppImageArchiveSequence::readHeader ( )

Parses the headers used in BppImageArchive files.

The parsed data includes a version number that is currently ignored, but could be used in the future to allow the image data format to change.

Exceptions
ImageNotArchiveStreamErrorThe stream does not have an image archive stream.
ImageArchiveStreamTruncatedErrorThe stream appears to have an incomplete copy of the archive stream. Any images fully read prior to the error will be available.
ImageArchiveUnsupportedVersionErrorThe software does not support the claimed archive version.

Definition at line 74 of file BppImageArchiveSequence.cpp.

Referenced by duds::ui::graphics::BppImageArchiveFile::BppImageArchiveFile(), end(), duds::ui::graphics::BppImageArchive::load(), and duds::ui::graphics::BppFont::load().

Member Data Documentation

◆ deref

std::pair<std::string, BppImageSptr> duds::ui::graphics::BppImageArchiveSequence::deref
protected

Stores the last parsed image data.

It is placed here instead of the iterator to allow the iterator class to have a simple constructor, a trivial destructor, and only one small member. Without this, the end iterator cannot be a constexpr object.

Definition at line 34 of file BppImageArchiveSequence.hpp.

Referenced by duds::ui::graphics::BppImageArchiveSequence::iterator::image(), duds::ui::graphics::BppImageArchiveSequence::iterator::name(), duds::ui::graphics::BppImageArchiveSequence::iterator::operator*(), and duds::ui::graphics::BppImageArchiveSequence::iterator::operator->().

◆ is

std::istream* duds::ui::graphics::BppImageArchiveSequence::is
protected

The stream which contains image data.

It might not be owned by this object.

Definition at line 27 of file BppImageArchiveSequence.hpp.

Referenced by duds::ui::graphics::BppImageArchiveFile::BppImageArchiveFile(), duds::ui::graphics::BppImageArchiveSequence::iterator::operator++(), and readHeader().

◆ iterator


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