This is the documentation for Enlighten.

class Geo IffReader

class Geo::IffReader

    └>Geo::IGeoInputStream

An IffReader allows you to use an IGeoStream to read Iff format binary files easily.

It is passed an IGeoStream in its constructor and also implements IGeoStream, thus making it like an Adaptor pattern. Although the class uses the function name 'BeginFile' the underlying stream can be of any type.

Functions

Name Description
~IGeoInputStream()

Deleting a stream should behave like a close operation.

BeginFile()

Step into the main FORM chunk, extract the file type tag.

Fail()

Put the reader directly into a fail state.

GetChunkSize()

Return the size of the current chunk.

GetFileType()

Return the file type tag that was stored in IffReader::BeginFile()

GetFileVersion()

Return the file version code that was stored in IffReader::BeginFile()

GetNextChunk(bool)

The method of reading Iff files is to iterate over the chunks by calling 'GetNextChunk' until the function returns Iff::EOFTag.

GetPosition()

Wrap the IGeoStream::GetPosition function.

GetPosition()

Return the position of the read/write pointer within the stream (prototype matches ftell)

IffReader(IGeoInputStream &)

Construct an IffReader with a pre-existing IGeoStream.

IsEof()

Wrap the IGeoStream::IsEof function.

IsEof()

Is the read pointer at the end of the file (as with feof, only returns true if you have read past end)

IsOk()

Wrap the IGeoStream::IsOk function, returning status of the IffWriter also.

IsOk()

Tests if the stream is valid.

IsReaderOk()

Return status of the reader Note: Prefer to use the IGeoStream::IsOk() method.

Read(void *, size_t, size_t)

Read data (prototype matches fread). Prefer to use the templated Read methods.

Read(void *, size_t, size_t)

Wrap the IGeoStream::Read function, tracking the return code.

Read(T &)

Read a single object, returning true on success.

Read(TIter, TIter)

Read a collection of objects, returning true on success.

Read(T(&))

Read a fixed size array.

ReadImpl(T &, GeoStd::TrueType)

Read a single object, returning true on success.

ReadImpl(T &, GeoStd::FalseType)

Read a single object, returning true on success.

ReadToEnd()

Reads the stream to its end and returns the data as a char array.

SetPosition(u64)

Wrap the IGeoStream::SetPosition function, be careful when jumping around inside IffReader.

SetPosition(Geo::u64)

Set the position of the read/write pointer within the stream (prototype matches fseek)


virtual Geo::IGeoInputStream::~IGeoInputStream


public: virtual ~IGeoInputStream()


Deleting a stream should behave like a close operation.


bool Geo::IffReader::BeginFile


public: bool BeginFile()


Step into the main FORM chunk, extract the file type tag.

From there, read the first chunk (which should be VERS) and then the version code. Leaves the IffReader ready to iterate on


void Geo::IffReader::Fail


public: void Fail()


Put the reader directly into a fail state.


size_t Geo::IffReader::GetChunkSize


public: size_t GetChunkSize() const


Return the size of the current chunk.


u32 Geo::IffReader::GetFileType


public: u32 GetFileType() const


Return the file type tag that was stored in IffReader::BeginFile()


s32 Geo::IffReader::GetFileVersion


public: s32 GetFileVersion() const


Return the file version code that was stored in IffReader::BeginFile()


u32 Geo::IffReader::GetNextChunk


public: u32 GetNextChunk
(
    bool stepIntoChunk
)


The method of reading Iff files is to iterate over the chunks by calling 'GetNextChunk' until the function returns Iff::EOFTag.

stepIntoChunk Chunks are usually on the same level, but if you wish to arrange them in a hierarchy the reader will have to pass 'true' for this parameter when first looking for child chunks.When the list of child chunks is exhausted, the function will return EOFTag. If stepIntoChunk is set to true and an EOFTag is returned, GetNextChunk has to be called again with stepIntoChunk set to false to actually proceed reading the file.


virtual u64 Geo::IffReader::GetPosition


public: virtual u64 GetPosition() const


Wrap the IGeoStream::GetPosition function.


virtual Geo::u64 Geo::IGeoInputStream::GetPosition


public: Geo::u64 GetPosition() const


Return the position of the read/write pointer within the stream (prototype matches ftell)


Geo::IffReader::IffReader


public: IffReader
(
    IGeoInputStream & stream
)


Construct an IffReader with a pre-existing IGeoStream.


virtual bool Geo::IffReader::IsEof


public: virtual bool IsEof() const


Wrap the IGeoStream::IsEof function.


virtual bool Geo::IGeoInputStream::IsEof


public: bool IsEof() const


Is the read pointer at the end of the file (as with feof, only returns true if you have read past end)


virtual bool Geo::IffReader::IsOk


public: virtual bool IsOk() const


Wrap the IGeoStream::IsOk function, returning status of the IffWriter also.


virtual bool Geo::IGeoInputStream::IsOk


public: bool IsOk() const


Tests if the stream is valid.


bool Geo::IffReader::IsReaderOk


public: bool IsReaderOk() const


Return status of the reader Note: Prefer to use the IGeoStream::IsOk() method.


virtual size_t Geo::IGeoInputStream::Read


public: size_t Read
(
    void * pData,
    size_t size,
    size_t count
)


Read data (prototype matches fread). Prefer to use the templated Read methods.


virtual size_t Geo::IffReader::Read


public: virtual size_t Read
(
    void * pData,
    size_t size,
    size_t count
)


Wrap the IGeoStream::Read function, tracking the return code.


GEO_FORCE_INLINE bool Geo::IGeoInputStream::Read


public: GEO_FORCE_INLINE bool Read
(
    T & object
)


Read a single object, returning true on success.

There must either be a ReadObject overload for T, or T be considered blittable (see IsBlittable<T>).


bool Geo::IGeoInputStream::Read


public: bool Read
(
    TIter begin,
    TIter end
)


Read a collection of objects, returning true on success.

Object must be considered blittable (see IsBlittable<T>). Note that the storage must have been pre-allocated as it will write directly to the iterators provided. Given that we do not have the STL-style 'back-inserter' classes, for GeoArrays you should use the ReadArray helper function.


bool Geo::IGeoInputStream::Read


public: bool Read
(
    T(&) a
)


Read a fixed size array.


bool Geo::IGeoInputStream::ReadImpl


public: bool ReadImpl
(
    T & object,
    GeoStd::TrueType
)


Read a single object, returning true on success.

There must either be a ReadObject overload for T, or T be considered blittable (see IsBlittable<T>).


bool Geo::IGeoInputStream::ReadImpl


public: bool ReadImpl
(
    T & object,
    GeoStd::FalseType
)


Read a single object, returning true on success.

There must either be a ReadObject overload for T, or T be considered blittable (see IsBlittable<T>).


virtual Geo::GeoArray<char> Geo::IGeoInputStream::ReadToEnd


public: virtual Geo::GeoArray< char > ReadToEnd()


Reads the stream to its end and returns the data as a char array.


virtual bool Geo::IffReader::SetPosition


public: virtual bool SetPosition
(
    u64 pos
)


Wrap the IGeoStream::SetPosition function, be careful when jumping around inside IffReader.


virtual bool Geo::IGeoInputStream::SetPosition


public: bool SetPosition
(
    Geo::u64 pos
)


Set the position of the read/write pointer within the stream (prototype matches fseek)