3 Copyright 2007 Antoine Chavasse <a.chavasse@gmail.com>
5 This file is part of Fail.
7 Fail is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License version 3
9 as published by the Free Software Foundation.
11 Fail 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
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef FAIL_FBF_READER_OBJS_H
20 #define FAIL_FBF_READER_OBJS_H
24 namespace fail
{ namespace fbf
26 template< class EndianessPolicy
> GenericPointer BaseReader
< EndianessPolicy
>::
27 ReadOBJS( buffered_stream_type
& Stream
)
29 const char objs
[] = { 'O', 'B', 'J', 'S' };
32 Stream
.read( chunkid
, sizeof( chunkid
) );
34 while( memcmp( objs
, chunkid
, sizeof( chunkid
) ) )
36 uint32_t size
= Stream
.readU32();
37 Stream
.seek( Stream
.tell() + size
);
38 if( Stream
.read( chunkid
, sizeof( chunkid
) ) != sizeof( chunkid
) )
41 std::cout
<< "FBF reader: OBJS chunk not found\n";
45 uint32_t size
= Stream
.readU32();
47 Impl::ReadContext
< buffered_stream_type
> rct( Stream
);
48 GenericPointer pObj
= rct
.readObject();