]> git.saurik.com Git - wxWidgets.git/blob - src/common/sckfile.cpp
Polish translations update from Grzegorz Zlotowicz.
[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 // Copyright: (c) 1997, 1998 Guilhem Lavaux
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
13
14 #ifdef __BORLANDC__
15 #pragma hdrstop
16 #endif
17
18 #if wxUSE_STREAMS && wxUSE_PROTOCOL_FILE
19
20 #ifndef WX_PRECOMP
21 #endif
22
23 #include "wx/uri.h"
24 #include "wx/wfstream.h"
25 #include "wx/protocol/file.h"
26
27
28 // ----------------------------------------------------------------------------
29 // wxFileProto
30 // ----------------------------------------------------------------------------
31
32 IMPLEMENT_DYNAMIC_CLASS(wxFileProto, wxProtocol)
33 IMPLEMENT_PROTOCOL(wxFileProto, wxT("file"), NULL, false)
34
35 wxFileProto::wxFileProto()
36 : wxProtocol()
37 {
38 }
39
40 wxFileProto::~wxFileProto()
41 {
42 }
43
44 wxInputStream *wxFileProto::GetInputStream(const wxString& path)
45 {
46 wxFileInputStream *retval = new wxFileInputStream(wxURI::Unescape(path));
47 if ( retval->IsOk() )
48 {
49 m_lastError = wxPROTO_NOERR;
50 return retval;
51 }
52
53 m_lastError = wxPROTO_NOFILE;
54 delete retval;
55
56 return NULL;
57 }
58
59 #endif // wxUSE_STREAMS && wxUSE_PROTOCOL_FILE