]>
Commit | Line | Data |
---|---|---|
f4ada568 | 1 | ///////////////////////////////////////////////////////////////////////////// |
8898456d | 2 | // Name: src/common/sckfile.cpp |
f4ada568 GL |
3 | // Purpose: File protocol |
4 | // Author: Guilhem Lavaux | |
5 | // Modified by: | |
6 | // Created: 20/07/97 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 1997, 1998 Guilhem Lavaux | |
65571936 | 9 | // Licence: wxWindows licence |
f4ada568 | 10 | ///////////////////////////////////////////////////////////////////////////// |
fcc6dddd JS |
11 | |
12 | // For compilers that support precompilation, includes "wx.h". | |
13 | #include "wx/wxprec.h" | |
f4ada568 GL |
14 | |
15 | #ifdef __BORLANDC__ | |
8898456d | 16 | #pragma hdrstop |
f4ada568 GL |
17 | #endif |
18 | ||
8898456d WS |
19 | #if wxUSE_STREAMS && wxUSE_PROTOCOL_FILE |
20 | ||
fcc6dddd JS |
21 | #ifndef WX_PRECOMP |
22 | #endif | |
23 | ||
5059e05d | 24 | #include "wx/uri.h" |
3096bd2f VZ |
25 | #include "wx/wfstream.h" |
26 | #include "wx/protocol/file.h" | |
fcc6dddd | 27 | |
730b772b FM |
28 | |
29 | // ---------------------------------------------------------------------------- | |
30 | // wxFileProto | |
31 | // ---------------------------------------------------------------------------- | |
32 | ||
f4ada568 | 33 | IMPLEMENT_DYNAMIC_CLASS(wxFileProto, wxProtocol) |
d775fa82 | 34 | IMPLEMENT_PROTOCOL(wxFileProto, wxT("file"), NULL, false) |
f4ada568 GL |
35 | |
36 | wxFileProto::wxFileProto() | |
3a082780 | 37 | : wxProtocol() |
f4ada568 GL |
38 | { |
39 | } | |
40 | ||
41 | wxFileProto::~wxFileProto() | |
42 | { | |
43 | } | |
44 | ||
45 | wxInputStream *wxFileProto::GetInputStream(const wxString& path) | |
46 | { | |
3a082780 VZ |
47 | wxFileInputStream *retval = new wxFileInputStream(wxURI::Unescape(path)); |
48 | if ( retval->Ok() ) | |
49 | { | |
730b772b | 50 | m_lastError = wxPROTO_NOERR; |
3a082780 VZ |
51 | return retval; |
52 | } | |
53 | ||
730b772b | 54 | m_lastError = wxPROTO_NOFILE; |
b1755cdb | 55 | delete retval; |
3a082780 VZ |
56 | |
57 | return NULL; | |
f4ada568 | 58 | } |
35a4dab7 | 59 | |
ef0e85f3 | 60 | #endif // wxUSE_STREAMS && wxUSE_PROTOCOL_FILE |