Line data Source code
1 : /*
2 : Zipios -- a small C++ library that provides easy access to .zip files.
3 :
4 : Copyright (C) 2000-2007 Thomas Sondergaard
5 : Copyright (C) 2015-2019 Made to Order Software Corporation
6 :
7 : This library is free software; you can redistribute it and/or
8 : modify it under the terms of the GNU Lesser General Public
9 : License as published by the Free Software Foundation; either
10 : version 2.1 of the License, or (at your option) any later version.
11 :
12 : This library is distributed in the hope that it will be useful,
13 : but WITHOUT ANY WARRANTY; without even the implied warranty of
14 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 : Lesser General Public License for more details.
16 :
17 : You should have received a copy of the GNU Lesser General Public
18 : License along with this library; if not, write to the Free Software
19 : Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 : */
21 :
22 : /** \file
23 : * \brief Implementation of zipios::FilterOutputStreambuf.
24 : *
25 : * This file includes the functions of the output stream buffer
26 : * filter.
27 : */
28 :
29 : #include "filteroutputstreambuf.hpp"
30 :
31 : #include "zipios/zipiosexceptions.hpp"
32 :
33 :
34 : namespace zipios
35 : {
36 :
37 :
38 : /** \class FilterOutputStreambuf
39 : * \brief A base class to develop output stream filters.
40 : *
41 : * An output stream buffer filter is an std::streambuf that filters the
42 : * output it gets from the std::streambuf it is attached to.
43 : *
44 : * FilterOutputStreambuf is a base class to derive input streambuf
45 : * filters from.
46 : */
47 :
48 :
49 : /** \brief Initialize your filter output stream buffer.
50 : *
51 : * This constructor initializes the filter by saving the outbuf buffer
52 : * pointer in it.
53 : *
54 : * \param[in] outbuf The streambuf to pass the filtered data on to.
55 : */
56 245 : FilterOutputStreambuf::FilterOutputStreambuf(std::streambuf * outbuf)
57 246 : : m_outbuf(outbuf)
58 : {
59 245 : if(m_outbuf == nullptr)
60 : {
61 1 : throw InvalidStateException("FilterOutputStreambuf was called with a null streambuf pointer");
62 : }
63 244 : }
64 :
65 :
66 : /** \brief Clean up the object.
67 : *
68 : * At this time the destructor does nothing.
69 : *
70 : * The former version would eventually delete the m_outbuf pointer. However,
71 : * here we have decided that this class did not own that pointer and thus
72 : * should not have such permissions.
73 : */
74 245 : FilterOutputStreambuf::~FilterOutputStreambuf()
75 : {
76 245 : }
77 :
78 :
79 3 : } // zipios namespace
80 :
81 : // Local Variables:
82 : // mode: cpp
83 : // indent-tabs-mode: nil
84 : // c-basic-offset: 4
85 : // tab-width: 4
86 : // End:
87 :
88 : // vim: ts=4 sw=4 et
|