]>
Commit | Line | Data |
---|---|---|
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 | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | // For compilers that support precompilation, includes "wx.h". | |
13 | #include "wx/wxprec.h" | |
14 | ||
15 | #ifdef __BORLANDC__ | |
16 | #pragma hdrstop | |
17 | #endif | |
18 | ||
19 | #ifndef WX_PRECOMP | |
20 | #include "wx/defs.h" | |
21 | #endif | |
22 | ||
23 | #if wxUSE_STREAMS && wxUSE_PROTOCOL_FILE | |
24 | ||
25 | #include <stdio.h> | |
26 | #include "wx/wfstream.h" | |
27 | #include "wx/protocol/file.h" | |
28 | ||
29 | IMPLEMENT_DYNAMIC_CLASS(wxFileProto, wxProtocol) | |
30 | IMPLEMENT_PROTOCOL(wxFileProto, wxT("file"), NULL, false) | |
31 | ||
32 | wxFileProto::wxFileProto() | |
33 | : wxProtocol() | |
34 | { | |
35 | m_error = wxPROTO_NOERR; | |
36 | } | |
37 | ||
38 | wxFileProto::~wxFileProto() | |
39 | { | |
40 | } | |
41 | ||
42 | wxInputStream *wxFileProto::GetInputStream(const wxString& path) | |
43 | { | |
44 | wxFileInputStream *retval = new wxFileInputStream(wxURI::Unescape(path)); | |
45 | if ( retval->Ok() ) | |
46 | { | |
47 | m_error = wxPROTO_NOERR; | |
48 | ||
49 | return retval; | |
50 | } | |
51 | ||
52 | m_error = wxPROTO_NOFILE; | |
53 | delete retval; | |
54 | ||
55 | return NULL; | |
56 | } | |
57 | ||
58 | #endif // wxUSE_STREAMS && wxUSE_PROTOCOL_FILE | |
59 |