]> git.saurik.com Git - wxWidgets.git/blob - src/common/sckfile.cpp
Changed the ultimate fall-back popup window classes: wxMSW now uses wxFrame, wxMAC...
[wxWidgets.git] / src / common / sckfile.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/common/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 #if wxUSE_STREAMS && wxUSE_PROTOCOL_FILE
20
21 #ifndef WX_PRECOMP
22 #endif
23
24 #include "wx/uri.h"
25 #include "wx/wfstream.h"
26 #include "wx/protocol/file.h"
27
28
29 // ----------------------------------------------------------------------------
30 // wxFileProto
31 // ----------------------------------------------------------------------------
32
33 IMPLEMENT_DYNAMIC_CLASS(wxFileProto, wxProtocol)
34 IMPLEMENT_PROTOCOL(wxFileProto, wxT("file"), NULL, false)
35
36 wxFileProto::wxFileProto()
37 : wxProtocol()
38 {
39 }
40
41 wxFileProto::~wxFileProto()
42 {
43 }
44
45 wxInputStream *wxFileProto::GetInputStream(const wxString& path)
46 {
47 wxFileInputStream *retval = new wxFileInputStream(wxURI::Unescape(path));
48 if ( retval->Ok() )
49 {
50 m_lastError = wxPROTO_NOERR;
51 return retval;
52 }
53
54 m_lastError = wxPROTO_NOFILE;
55 delete retval;
56
57 return NULL;
58 }
59
60 #endif // wxUSE_STREAMS && wxUSE_PROTOCOL_FILE