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