rawcontainer.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _RAWCONTAINER_H_
00025 #define _RAWCONTAINER_H_
00026
00027 #include <sys/types.h>
00028
00029 #include <libopenraw/io.h>
00030 #include <libopenraw/types.h>
00031
00032
00033 namespace OpenRaw {
00034 namespace IO {
00035 class Stream;
00036 }
00037
00038 namespace Internals {
00039
00040
00044 class RawContainer
00045 {
00046 public:
00048 typedef enum {
00049 ENDIAN_NULL = 0,
00050 ENDIAN_BIG,
00051 ENDIAN_LITTLE
00052 } EndianType;
00053
00059 RawContainer(IO::Stream *_file, off_t offset);
00061 virtual ~RawContainer();
00062
00063 IO::Stream *file()
00064 {
00065 return m_file;
00066 }
00067 EndianType endian() const
00068 {
00069 return m_endian;
00070 }
00071
00072 bool readInt8(IO::Stream *f, int8_t & v);
00073 bool readUInt8(IO::Stream *f, uint8_t & v);
00075 bool readInt16(IO::Stream *f, int16_t & v);
00077 bool readInt32(IO::Stream *f, int32_t & v);
00079 bool readUInt16(IO::Stream *f, uint16_t & v);
00081 bool readUInt32(IO::Stream *f, uint32_t & v);
00089 size_t fetchData(void *buf, const off_t offset, const size_t buf_size);
00090
00091 protected:
00092
00093 RawContainer(const RawContainer&);
00094 RawContainer & operator=(const RawContainer &);
00095
00096 void setEndian(EndianType _endian)
00097 {
00098 m_endian = _endian;
00099 }
00100
00102 IO::Stream *m_file;
00104 off_t m_offset;
00105 EndianType m_endian;
00106 };
00107
00108 }
00109 }
00110
00111
00112 #endif