]> git.saurik.com Git - wxWidgets.git/blob - src/common/sckfile.cpp
Improved wxDCPen/BrushChangers.
[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 <stdio.h>
25 #include "wx/wfstream.h"
26 #include "wx/protocol/file.h"
27
28 IMPLEMENT_DYNAMIC_CLASS(wxFileProto, wxProtocol)
29 IMPLEMENT_PROTOCOL(wxFileProto, wxT("file"), NULL, false)
30
31 wxFileProto::wxFileProto()
32 : wxProtocol()
33 {
34 m_error = wxPROTO_NOERR;
35 }
36
37 wxFileProto::~wxFileProto()
38 {
39 }
40
41 wxInputStream *wxFileProto::GetInputStream(const wxString& path)
42 {
43 wxFileInputStream *retval = new wxFileInputStream(wxURI::Unescape(path));
44 if ( retval->Ok() )
45 {
46 m_error = wxPROTO_NOERR;
47
48 return retval;
49 }
50
51 m_error = wxPROTO_NOFILE;
52 delete retval;
53
54 return NULL;
55 }
56
57 #endif // wxUSE_STREAMS && wxUSE_PROTOCOL_FILE