libopenraw
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
OpenRaw::Internals::RawContainer Class Reference

#include <rawcontainer.h>

Inheritance diagram for OpenRaw::Internals::RawContainer:
OpenRaw::Internals::CIFFContainer OpenRaw::Internals::IFDFileContainer OpenRaw::Internals::JFIFContainer OpenRaw::Internals::MRWContainer OpenRaw::Internals::OrfContainer

Public Types

enum  EndianType { ENDIAN_NULL = 0, ENDIAN_BIG, ENDIAN_LITTLE }
 

Public Member Functions

 RawContainer (IO::Stream *_file, off_t offset)
 
virtual ~RawContainer ()
 
IO::Streamfile ()
 
EndianType endian () const
 
bool readInt8 (IO::Stream *f, int8_t &v)
 
bool readUInt8 (IO::Stream *f, uint8_t &v)
 
bool readInt16 (IO::Stream *f, int16_t &v)
 
bool readInt32 (IO::Stream *f, int32_t &v)
 
bool readUInt16 (IO::Stream *f, uint16_t &v)
 
bool readUInt32 (IO::Stream *f, uint32_t &v)
 
size_t fetchData (void *buf, const off_t offset, const size_t buf_size)
 

Protected Member Functions

 RawContainer (const RawContainer &)
 
RawContaineroperator= (const RawContainer &)
 
void setEndian (EndianType _endian)
 

Protected Attributes

IO::Streamm_file
 
off_t m_offset
 
EndianType m_endian
 

Detailed Description

Generic interface for the RAW file container

Definition at line 44 of file rawcontainer.h.

Member Enumeration Documentation

define the endian of the container

Enumerator
ENDIAN_BIG 

no endian found: means invalid file

ENDIAN_LITTLE 

big endian found little endian found

Definition at line 48 of file rawcontainer.h.

Constructor & Destructor Documentation

OpenRaw::Internals::RawContainer::RawContainer ( IO::Stream _file,
off_t  offset 
)
Parameters
filethe stream to read from
offsetthe offset since starting the beginning of the file for the container

Definition at line 38 of file rawcontainer.cpp.

References m_file, OpenRaw::IO::Stream::open(), and OpenRaw::IO::Stream::seek().

OpenRaw::Internals::RawContainer::~RawContainer ( )
virtual

destructor

Definition at line 48 of file rawcontainer.cpp.

References OpenRaw::IO::Stream::close(), and m_file.

Member Function Documentation

size_t OpenRaw::Internals::RawContainer::fetchData ( void *  buf,
const off_t  offset,
const size_t  buf_size 
)

Fetch the data chunk from the file

Parameters
bufthe buffer to load into
offsetthe offset
buf_sizethe size of the data to fetch
Returns
the size retrieved, <= buf_size likely equal

Definition at line 178 of file rawcontainer.cpp.

References m_file, OpenRaw::IO::Stream::read(), and OpenRaw::IO::Stream::seek().

Referenced by OpenRaw::Internals::MRWFile::_getRawData(), OpenRaw::Internals::IFDFile::_getRawDataFromDir(), OpenRaw::Internals::MRWFile::_getThumbnail(), OpenRaw::Internals::MRW::DataBlock::DataBlock(), OpenRaw::Internals::CIFF::RecordEntry::fetchData(), OpenRaw::Internals::NEFFile::isCompressed(), and OpenRaw::Internals::IFDEntry::loadData().

bool OpenRaw::Internals::RawContainer::readInt16 ( IO::Stream f,
int16_t &  v 
)

Read an int16 following the m_endian set

Definition at line 77 of file rawcontainer.cpp.

References ENDIAN_LITTLE, and OpenRaw::IO::Stream::read().

Referenced by OpenRaw::Internals::IFDDir::load(), and OpenRaw::Internals::IFDDir::nextIFD().

bool OpenRaw::Internals::RawContainer::readInt32 ( IO::Stream f,
int32_t &  v 
)
bool OpenRaw::Internals::RawContainer::readUInt16 ( IO::Stream f,
uint16_t &  v 
)
bool OpenRaw::Internals::RawContainer::readUInt32 ( IO::Stream f,
uint32_t &  v 
)

Member Data Documentation

IO::Stream* OpenRaw::Internals::RawContainer::m_file
protected
off_t OpenRaw::Internals::RawContainer::m_offset
protected

the offset from the beginning of the file

Definition at line 104 of file rawcontainer.h.


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