libopenraw
stream.cpp
1 /*
2  * libopenraw - stream.cpp
3  *
4  * Copyright (C) 2006-2016 Hubert Figuière
5  *
6  * This library is free software: you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public License
8  * as published by the Free Software Foundation, either version 3 of
9  * the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library. If not, see
18  * <http://www.gnu.org/licenses/>.
19  */
20 
21 
22 #include <libopenraw/consts.h>
23 
24 #include "stream.hpp"
25 #include "exception.hpp"
26 
27 namespace OpenRaw {
28 namespace IO {
29 
30 Stream::Stream(const char *filename)
31  : m_fileName(filename),
32  m_error(OR_ERROR_NONE)
33 {
34 }
35 
36 Stream::~Stream()
37 {
38 }
39 
40 uint8_t Stream::readByte() noexcept(false)
41 {
42  uint8_t theByte;
43  int r = read(&theByte, 1);
44  if (r != 1) {
45  // TODO add the error code
46  throw Internals::IOException("Stream::readByte() failed.");
47  }
48  return theByte;
49 }
50 
51 }
52 }
53 /*
54  Local Variables:
55  mode:c++
56  c-file-style:"stroustrup"
57  c-file-offsets:((innamespace . 0))
58  tab-width:2
59  c-basic-offset:2
60  indent-tabs-mode:nil
61  fill-column:80
62  End:
63 */
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 int read(void *buf, size_t count)=0
Stream(const char *filename)
Definition: stream.cpp:30