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

Generic interface for the RAW file container. More...

#include <rawcontainer.hpp>

Inheritance diagram for OpenRaw::Internals::RawContainer:
OpenRaw::Internals::CIFFContainer OpenRaw::Internals::IfdFileContainer OpenRaw::Internals::IsoMediaContainer OpenRaw::Internals::JfifContainer OpenRaw::Internals::RafContainer OpenRaw::Internals::RafMetaContainer OpenRaw::Internals::MRWContainer OpenRaw::Internals::OrfContainer OpenRaw::Internals::Rw2Container

Public Types

enum  EndianType { ENDIAN_NULL = 0 , ENDIAN_BIG , ENDIAN_LITTLE }
 Define the endian of the container. More...
 

Public Member Functions

 RawContainer (const IO::Stream::Ptr &_file, off_t offset)
 
virtual ~RawContainer ()
 
const IO::Stream::Ptrfile () const
 
EndianType endian () const
 
off_t offset () const
 
virtual int exifOffsetCorrection () const
 
bool skip (off_t offset)
 
Option< int8_t > readInt8 (const IO::Stream::Ptr &f) const
 
Option< uint8_t > readUInt8 (const IO::Stream::Ptr &f) const
 
Option< int16_t > readInt16 (const IO::Stream::Ptr &f, EndianType endian) const
 Read an int16 following the m_endian set.
 
Option< int32_t > readInt32 (const IO::Stream::Ptr &f, EndianType endian) const
 Read an int32 following the m_endian set.
 
Option< uint16_t > readUInt16 (const IO::Stream::Ptr &f, EndianType endian) const
 Read an uint16 following the m_endian set.
 
size_t readUInt16Array (const IO::Stream::Ptr &f, std::vector< uint16_t > &v, size_t count) const
 Read an array of uint16 following the m_endian set. More...
 
Option< uint32_t > readUInt32 (const IO::Stream::Ptr &f, EndianType endian) const
 Read an uint32 following the m_endian set.
 
size_t fetchData (void *buf, off_t offset, size_t buf_size) const
 Fetch the data chunk from the file. More...
 
off_t size () const
 Return the effective size of the container.
 

Protected Member Functions

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

Protected Attributes

IO::Stream::Ptr m_file
 The file handle.
 
off_t m_offset
 The offset from the beginning of the file.
 
EndianType m_endian
 

Detailed Description

Generic interface for the RAW file container.

Definition at line 40 of file rawcontainer.hpp.

Member Enumeration Documentation

◆ EndianType

Define the endian of the container.

Enumerator
ENDIAN_NULL 

no endian found: means invalid file

ENDIAN_BIG 

big endian found

ENDIAN_LITTLE 

little endian found

Definition at line 43 of file rawcontainer.hpp.

Constructor & Destructor Documentation

◆ RawContainer()

OpenRaw::Internals::RawContainer::RawContainer ( const IO::Stream::Ptr _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 37 of file rawcontainer.cpp.

References m_file.

◆ ~RawContainer()

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

destructor

Definition at line 47 of file rawcontainer.cpp.

References m_file.

Member Function Documentation

◆ fetchData()

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

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 203 of file rawcontainer.cpp.

References m_file.

Referenced by OpenRaw::Internals::MRWFile::_getRawData(), OpenRaw::RawFile::_getThumbnail(), OpenRaw::Internals::MRW::DataBlock::DataBlock(), OpenRaw::Internals::CIFF::RecordEntry::fetchData(), OpenRaw::Internals::NefFile::isCompressed(), OpenRaw::Internals::CIFF::RecordEntry::readFrom(), and OpenRaw::Internals::MRW::DataBlock::string_val().

◆ readUInt16Array()

size_t OpenRaw::Internals::RawContainer::readUInt16Array ( const IO::Stream::Ptr f,
std::vector< uint16_t > &  v,
size_t  count 
) const

Read an array of uint16 following the m_endian set.

Parameters
vthe vector to fill. Will be resized if too small.
countthe number of elements to read
Returns
the number of element read. count if success.

Return the number of element read.

Definition at line 106 of file rawcontainer.cpp.

References ENDIAN_LITTLE, and ENDIAN_NULL.


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