| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: xmlbinz.cpp |
| 3 | // Purpose: wxXmlIOHandlerBinZ |
| 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 | #ifdef __GNUG__ |
| 12 | // nothing, already in xml.cpp |
| 13 | #endif |
| 14 | |
| 15 | // For compilers that support precompilation, includes "wx.h". |
| 16 | #include "wx/wxprec.h" |
| 17 | |
| 18 | #ifdef __BORLANDC__ |
| 19 | #pragma hdrstop |
| 20 | #endif |
| 21 | |
| 22 | #include "wx/datstrm.h" |
| 23 | #include "wx/log.h" |
| 24 | #include "wx/zstream.h" |
| 25 | |
| 26 | #include "wx/xrc/xmlio.h" |
| 27 | |
| 28 | #if wxUSE_ZLIB |
| 29 | |
| 30 | |
| 31 | |
| 32 | bool wxXmlIOHandlerBinZ::CanLoad(wxInputStream& stream) |
| 33 | { |
| 34 | bool canread; |
| 35 | canread = (ReadHeader(stream) == wxT("XMLBINZ")); |
| 36 | stream.SeekI(-9, wxFromCurrent); |
| 37 | return canread; |
| 38 | } |
| 39 | |
| 40 | |
| 41 | |
| 42 | bool wxXmlIOHandlerBinZ::Save(wxOutputStream& stream, const wxXmlDocument& doc) |
| 43 | { |
| 44 | WriteHeader(stream, "XMLBINZ"); |
| 45 | wxZlibOutputStream costr(stream, 9); |
| 46 | return wxXmlIOHandlerBin::Save(costr, doc); |
| 47 | } |
| 48 | |
| 49 | |
| 50 | |
| 51 | bool wxXmlIOHandlerBinZ::Load(wxInputStream& stream, wxXmlDocument& doc) |
| 52 | { |
| 53 | ReadHeader(stream); |
| 54 | wxZlibInputStream costr(stream); |
| 55 | return wxXmlIOHandlerBin::Load(costr, doc); |
| 56 | } |
| 57 | |
| 58 | |
| 59 | #endif |