]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: xmlio.h | |
3 | // Purpose: wxXmlIOHandler - XML I/O classes | |
4 | // Author: Vaclav Slavik | |
5 | // Created: 2000/07/24 | |
6 | // RCS-ID: $Id$ | |
7 | // Copyright: (c) 2000 Vaclav Slavik | |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _WX_XMLIO_H_ | |
12 | #define _WX_XMLIO_H_ | |
13 | ||
14 | #ifdef __GNUG__ | |
15 | #pragma interface "xmlio.h" | |
16 | #endif | |
17 | ||
18 | #include "wx/defs.h" | |
19 | #include "wx/string.h" | |
20 | #include "wx/xml/xml.h" | |
21 | ||
22 | ||
23 | class WXDLLEXPORT wxXmlIOHandlerExpat : public wxXmlIOHandler | |
24 | { | |
25 | public: | |
26 | virtual wxXmlIOType GetType() { return wxXML_IO_EXPAT; } | |
27 | virtual bool CanLoad(wxInputStream& stream); | |
28 | virtual bool CanSave() { return FALSE; } | |
29 | ||
30 | virtual bool Load(wxInputStream& stream, wxXmlDocument& doc); | |
31 | virtual bool Save(wxOutputStream& stream, const wxXmlDocument& doc) { return FALSE; } | |
32 | }; | |
33 | ||
34 | ||
35 | class WXDLLEXPORT wxXmlIOHandlerWriter : public wxXmlIOHandler | |
36 | { | |
37 | public: | |
38 | virtual wxXmlIOType GetType() { return wxXML_IO_TEXT_OUTPUT; } | |
39 | virtual bool CanLoad(wxInputStream& stream) { return FALSE; } | |
40 | virtual bool CanSave() { return TRUE; } | |
41 | ||
42 | virtual bool Load(wxInputStream& stream, wxXmlDocument& doc) { return FALSE; } | |
43 | virtual bool Save(wxOutputStream& stream, const wxXmlDocument& doc); | |
44 | }; | |
45 | ||
46 | ||
47 | class WXDLLEXPORT wxXmlIOHandlerBin : public wxXmlIOHandler | |
48 | { | |
49 | public: | |
50 | wxXmlIOHandlerBin() {} | |
51 | ||
52 | virtual wxXmlIOType GetType() { return wxXML_IO_BIN; } | |
53 | virtual bool CanLoad(wxInputStream& stream); | |
54 | virtual bool CanSave() { return TRUE; } | |
55 | ||
56 | virtual bool Load(wxInputStream& stream, wxXmlDocument& doc); | |
57 | virtual bool Save(wxOutputStream& stream, const wxXmlDocument& doc); | |
58 | ||
59 | protected: | |
60 | wxString ReadHeader(wxInputStream& stream); | |
61 | void WriteHeader(wxOutputStream& stream, const wxString& header); | |
62 | }; | |
63 | ||
64 | ||
65 | ||
66 | #if wxUSE_ZLIB | |
67 | ||
68 | class WXDLLEXPORT wxXmlIOHandlerBinZ : public wxXmlIOHandlerBin | |
69 | { | |
70 | public: | |
71 | wxXmlIOHandlerBinZ() {} | |
72 | ||
73 | virtual wxXmlIOType GetType() { return wxXML_IO_BINZ; } | |
74 | virtual bool CanLoad(wxInputStream& stream); | |
75 | ||
76 | virtual bool Load(wxInputStream& stream, wxXmlDocument& doc); | |
77 | virtual bool Save(wxOutputStream& stream, const wxXmlDocument& doc); | |
78 | }; | |
79 | ||
80 | #endif | |
81 | ||
82 | ||
83 | #endif // _WX_XMLIO_H_ |