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-2022 Made to Order Software Corp. All Rights Reserved 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::FilterInputStreambuf. 24 : * 25 : * This file implements the filter used to parse Zip archives. 26 : */ 27 : 28 : #include "filterinputstreambuf.hpp" 29 : 30 : #include "zipios/zipiosexceptions.hpp" 31 : 32 : 33 : namespace zipios 34 : { 35 : 36 : /** \class FilterInputStreambuf 37 : * \brief A base class to develop input stream filters. 38 : * 39 : * An input stream buffer filter is an std::streambuf that filters the 40 : * input it gets from the std::streambuf it is attached to. 41 : * 42 : * zipios::FilterInputStreambuf is a base class to derive input streambuf 43 : * filters from. 44 : */ 45 : 46 : 47 : /** \brief Initialize a filter input stream buffer. 48 : * 49 : * This constructor initializes the FilterInputStreambuf by saving 50 : * the inbuf pointer in this class. 51 : * 52 : * \param[in] inbuf The streambuf to use for input. 53 : */ 54 53063 : FilterInputStreambuf::FilterInputStreambuf(std::streambuf * inbuf) 55 53063 : : m_inbuf(inbuf) 56 : { 57 53063 : if(m_inbuf == nullptr) 58 : { 59 1 : throw InvalidStateException("FilterInputStreambuf::FilterInputStreambuf() was called with a null streambuf pointer"); 60 : } 61 53063 : } 62 : 63 : 64 : /** \brief Clean up the object. 65 : * 66 : * At this time the destructor does nothing. 67 : * 68 : * The former version would eventually delete the m_inbuf pointer. However, 69 : * here we have decided that this class did not own that pointer and thus 70 : * should not have such permissions. 71 : */ 72 53063 : FilterInputStreambuf::~FilterInputStreambuf() 73 : { 74 53063 : } 75 : 76 : 77 : } // namespace 78 : 79 : // Local Variables: 80 : // mode: cpp 81 : // indent-tabs-mode: nil 82 : // c-basic-offset: 4 83 : // tab-width: 4 84 : // End: 85 : 86 : // vim: ts=4 sw=4 et