libopenraw
rawcontainer.hpp
1 /* -*- Mode: C++ -*- */
2 /*
3  * libopenraw - rawcontainer.h
4  *
5  * Copyright (C) 2006-2016 Hubert Figuiere
6  *
7  * This library is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * as published by the Free Software Foundation, either version 3 of
10  * the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library. If not, see
19  * <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef OR_INTERNALS_RAWCONTAINER_H_
23 #define OR_INTERNALS_RAWCONTAINER_H_
24 
25 #include <stddef.h>
26 #include <stdint.h>
27 #include <sys/types.h>
28 
29 #include "io/stream.hpp"
30 
31 namespace OpenRaw {
32 
33 namespace Internals {
34 
38 class RawContainer {
39 public:
41  typedef enum {
42  ENDIAN_NULL = 0,
45  } EndianType;
46 
52  RawContainer(const IO::Stream::Ptr &_file, off_t offset);
54  virtual ~RawContainer();
55 
56  const IO::Stream::Ptr &file() { return m_file; }
57  EndianType endian() const { return m_endian; }
58  off_t offset() const { return m_offset; }
59 
60  bool readInt8(const IO::Stream::Ptr &f, int8_t &v);
61  bool readUInt8(const IO::Stream::Ptr &f, uint8_t &v);
63  bool readInt16(const IO::Stream::Ptr &f, int16_t &v);
65  bool readInt32(const IO::Stream::Ptr &f, int32_t &v);
67  bool readUInt16(const IO::Stream::Ptr &f, uint16_t &v);
69  bool readUInt32(const IO::Stream::Ptr &f, uint32_t &v);
77  size_t fetchData(void *buf, off_t offset, size_t buf_size);
78 
79 protected:
80  RawContainer(const RawContainer &);
81  RawContainer &operator=(const RawContainer &);
82 
83  void setEndian(EndianType _endian) { m_endian = _endian; }
84 
86  IO::Stream::Ptr m_file;
88  off_t m_offset;
89  EndianType m_endian;
90 };
91 }
92 }
93 
94 #endif
size_t fetchData(void *buf, off_t offset, size_t buf_size)
CIFF is the container for CRW files. It is an attempt from Canon to make this a standard. I guess it failed.
Definition: arwfile.cpp:30
bool readUInt32(const IO::Stream::Ptr &f, uint32_t &v)
RawContainer(const IO::Stream::Ptr &_file, off_t offset)
bool readUInt16(const IO::Stream::Ptr &f, uint16_t &v)
bool readInt32(const IO::Stream::Ptr &f, int32_t &v)
bool readInt16(const IO::Stream::Ptr &f, int16_t &v)