1/////////////////////////////////////////////////////////////////////////////
2// Name:        src/common/archive.cpp
3// Purpose:     Streams for archive formats
4// Author:      Mike Wetherell
5// RCS-ID:      $Id: archive.cpp 42508 2006-10-27 09:53:38Z MW $
6// Copyright:   (c) Mike Wetherell
7// Licence:     wxWindows licence
8/////////////////////////////////////////////////////////////////////////////
9
10// For compilers that support precompilation, includes "wx.h".
11#include "wx/wxprec.h"
12
13#ifdef __BORLANDC__
14    #pragma hdrstop
15#endif
16
17#if wxUSE_STREAMS && wxUSE_ARCHIVE_STREAMS
18
19#include "wx/archive.h"
20
21IMPLEMENT_ABSTRACT_CLASS(wxArchiveEntry, wxObject)
22IMPLEMENT_ABSTRACT_CLASS(wxArchiveClassFactory, wxFilterClassFactoryBase)
23
24
25/////////////////////////////////////////////////////////////////////////////
26// wxArchiveInputStream
27
28wxArchiveInputStream::wxArchiveInputStream(wxInputStream& stream,
29                                           wxMBConv& conv)
30  : wxFilterInputStream(stream),
31    m_conv(conv)
32{
33}
34
35wxArchiveInputStream::wxArchiveInputStream(wxInputStream *stream,
36                                           wxMBConv& conv)
37  : wxFilterInputStream(stream),
38    m_conv(conv)
39{
40}
41
42
43/////////////////////////////////////////////////////////////////////////////
44// wxArchiveOutputStream
45
46wxArchiveOutputStream::wxArchiveOutputStream(wxOutputStream& stream,
47                                             wxMBConv& conv)
48  : wxFilterOutputStream(stream),
49    m_conv(conv)
50{
51}
52
53wxArchiveOutputStream::wxArchiveOutputStream(wxOutputStream *stream,
54                                             wxMBConv& conv)
55  : wxFilterOutputStream(stream),
56    m_conv(conv)
57{
58}
59
60
61/////////////////////////////////////////////////////////////////////////////
62// wxArchiveEntry
63
64void wxArchiveEntry::SetNotifier(wxArchiveNotifier& notifier)
65{
66    UnsetNotifier();
67    m_notifier = &notifier;
68    m_notifier->OnEntryUpdated(*this);
69}
70
71wxArchiveEntry& wxArchiveEntry::operator=(const wxArchiveEntry& WXUNUSED(e))
72{
73    m_notifier = NULL;
74    return *this;
75}
76
77
78/////////////////////////////////////////////////////////////////////////////
79// wxArchiveClassFactory
80
81wxArchiveClassFactory *wxArchiveClassFactory::sm_first = NULL;
82
83void wxArchiveClassFactory::Remove()
84{
85    if (m_next != this)
86    {
87        wxArchiveClassFactory **pp = &sm_first;
88
89        while (*pp != this)
90            pp = &(*pp)->m_next;
91
92        *pp = m_next;
93
94        m_next = this;
95    }
96}
97
98#endif // wxUSE_STREAMS && wxUSE_ARCHIVE_STREAMS
99