blob: 28191875a3ec84c9f24bd840fb408ff17b429c12 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#include "FileRewindInputStream.hpp"
#include <stdexcept>
using namespace std;
FileRewindInputStream::FileRewindInputStream( const URL &url )
: RewindInputStream( url ), ifstream( )
{
if( url.protocol( ) != "file" || url.host( ) != "localhost" ) {
throw runtime_error( "URL doesn't denote a local file" );
}
open( url.path( ).c_str( ), ios::binary );
}
FileRewindInputStream::~FileRewindInputStream( )
{
close( );
}
void FileRewindInputStream::rewind( )
{
ifstream::clear( );
ifstream::seekg( 0, ios::beg );
}
string FileRewindInputStream::lastErrMsg( ) const
{
// TODO: tricky to get OS-indepented error messages here
return "<TODO>";
}
|