libopenraw
memstream.hpp
1 /* -*- Mode: C++ -*- */
2 /*
3  * libopenraw - memstream.h
4  *
5  * Copyright (C) 2007-2016 Hubert Figuière
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_IO_MEMSTREAM_H_
23 #define OR_INTERNALS_IO_MEMSTREAM_H_
24 
25 #include <stddef.h>
26 #include <sys/types.h>
27 
28 #include <libopenraw/consts.h>
29 
30 #include "io/stream.hpp"
31 
32 namespace OpenRaw {
33 namespace IO {
34 
35 class MemStream
36  : public Stream
37 {
38 public:
39  MemStream(void *ptr, size_t s);
40 
41  virtual ~MemStream()
42  {}
43 
44  MemStream(const MemStream& f) = delete;
45  MemStream & operator=(const MemStream&) = delete;
46 
47  virtual or_error open() override;
48  virtual int close() override;
49  virtual int seek(off_t offset, int whence) override;
50  virtual int read(void *buf, size_t count) override;
51  virtual off_t filesize() override;
52 
53 
54 private:
55  void * m_ptr;
56  size_t m_size;
57  unsigned char * m_current;
58 };
59 
60 }
61 }
62 
63 #endif
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
virtual or_error open() override
Definition: memstream.cpp:44
virtual int seek(off_t offset, int whence) override
Definition: memstream.cpp:57
virtual int read(void *buf, size_t count) override
Definition: memstream.cpp:88
virtual int close() override
Definition: memstream.cpp:51
base virtual class for IO
Definition: stream.hpp:41