]>
Commit | Line | Data |
---|---|---|
f4ada568 GL |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: sckfile.cpp | |
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 | ///////////////////////////////////////////////////////////////////////////// |
14f355c2 | 11 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
f4ada568 GL |
12 | #pragma implementation "sckfile.h" |
13 | #endif | |
fcc6dddd JS |
14 | |
15 | // For compilers that support precompilation, includes "wx.h". | |
16 | #include "wx/wxprec.h" | |
f4ada568 GL |
17 | |
18 | #ifdef __BORLANDC__ | |
ce4169a4 | 19 | #pragma hdrstop |
f4ada568 GL |
20 | #endif |
21 | ||
fcc6dddd | 22 | #ifndef WX_PRECOMP |
ce4169a4 | 23 | #include "wx/defs.h" |
fcc6dddd JS |
24 | #endif |
25 | ||
ef0e85f3 | 26 | #if wxUSE_STREAMS && wxUSE_PROTOCOL_FILE |
f6bcfd97 | 27 | |
fcc6dddd | 28 | #include <stdio.h> |
3096bd2f VZ |
29 | #include "wx/wfstream.h" |
30 | #include "wx/protocol/file.h" | |
fcc6dddd | 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 | 37 | { |
3a082780 | 38 | m_error = wxPROTO_NOERR; |
f4ada568 GL |
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 | { | |
50 | m_error = wxPROTO_NOERR; | |
51 | ||
52 | return retval; | |
53 | } | |
54 | ||
55 | m_error = wxPROTO_NOFILE; | |
b1755cdb | 56 | delete retval; |
3a082780 VZ |
57 | |
58 | return NULL; | |
f4ada568 | 59 | } |
35a4dab7 | 60 | |
ef0e85f3 | 61 | #endif // wxUSE_STREAMS && wxUSE_PROTOCOL_FILE |
f6bcfd97 | 62 |