libopenraw
stream.cpp
1 /*
2  * libopenraw - iostream.h
3  *
4  * Copyright (C) 2006-2007 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 "stream.h"
23 #include "exception.h"
24 
25 namespace OpenRaw {
26  namespace IO {
27 
28  Stream::Stream(const char *filename)
29  : m_fileName(filename),
30  m_error(OR_ERROR_NONE)
31  {
32  }
33 
34  Stream::~Stream()
35  {
36  }
37 
38  uint8_t Stream::readByte() throw(Internals::IOException)
39  {
40  uint8_t theByte;
41  int r = read(&theByte, 1);
42  if (r != 1) {
43  // TODO add the error code
44  throw Internals::IOException("Stream::readByte() failed.");
45  }
46  return theByte;
47  }
48  }
49 }
50 
51 
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:33
virtual int read(void *buf, size_t count)=0
Stream(const char *filename)
Definition: stream.cpp:28