Toggle navigation
libopenraw
Main
Projects
libopenraw
Exempi
Raw Thumbnailer
File Formats
All
Canon CR2
Canon CR3
Canon CRW
Fujfilm
Nikon
Olympus
Panasonic
Pentax
Blog
Development
libopenraw
0.3.7
lib
io
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
*/
OpenRaw::IO::Stream::Stream
Stream(const char *filename)
Construct the stream.
Definition:
stream.cpp:30
OpenRaw::IO::Stream::read
virtual int read(void *buf, size_t count)=0
read in the file. Semantics are similar to POSIX read()
OpenRaw::IO::Stream::readByte
uint8_t readByte() noexcept(false)
Read a single byte.
Definition:
stream.cpp:40
OpenRaw::Internals::IOException
IO exception.
Definition:
exception.hpp:65
OR_ERROR_NONE
@ OR_ERROR_NONE
Definition:
consts.h:43
OpenRaw
Global namespace for libopenraw.
Definition:
arwfile.cpp:29