LCOV - code coverage report
Current view: top level - src - zipendofcentraldirectory.hpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 1 100.0 %
Date: 2015-05-05 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : #pragma once
       2             : #ifndef ENDOFCENTRALDIRECTORY_HPP
       3             : #define ENDOFCENTRALDIRECTORY_HPP
       4             : 
       5             : /*
       6             :   Zipios++ - a small C++ library that provides easy access to .zip files.
       7             : 
       8             :   Copyright (C) 2000-2007  Thomas Sondergaard
       9             :   Copyright (C) 2015  Made to Order Software Corporation
      10             : 
      11             :   This library is free software; you can redistribute it and/or
      12             :   modify it under the terms of the GNU Lesser General Public
      13             :   License as published by the Free Software Foundation; either
      14             :   version 2 of the License, or (at your option) any later version.
      15             : 
      16             :   This library is distributed in the hope that it will be useful,
      17             :   but WITHOUT ANY WARRANTY; without even the implied warranty of
      18             :   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      19             :   Lesser General Public License for more details.
      20             : 
      21             :   You should have received a copy of the GNU Lesser General Public
      22             :   License along with this library; if not, write to the Free Software
      23             :   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
      24             : */
      25             : 
      26             : /** \file
      27             :  * \brief Declaration of the zipios::ZipEndOfCentralDirectory class.
      28             :  *
      29             :  * This file contains the class used to handle the "end of central directory"
      30             :  * information found in a Zip archive.
      31             :  *
      32             :  * It includes the necessary functions to read and write the central
      33             :  * directory and local header fields in a Zip archive.
      34             :  */
      35             : 
      36             : #include "zipios_common.hpp"
      37             : 
      38             : #include <string>
      39             : 
      40             : 
      41             : namespace zipios
      42             : {
      43             : 
      44             : 
      45         664 : class ZipEndOfCentralDirectory
      46             : {
      47             : public:
      48             :                         ZipEndOfCentralDirectory(std::string const& zip_comment = "");
      49             : 
      50             :     size_t              getCentralDirectorySize() const;
      51             :     size_t              getCount() const;
      52             :     offset_t            getOffset() const;
      53             :     void                setCentralDirectorySize(size_t size);
      54             :     void                setCount(size_t c);
      55             :     void                setOffset(offset_t new_offset);
      56             : 
      57             :     bool                read(::zipios::buffer_t const& buf, size_t pos);
      58             :     void                write(std::ostream& os);
      59             : 
      60             : private:
      61             :     // some of the fields found in a Zip archive ZipEndOfCentralDirectory
      62             :     size_t              m_central_directory_entries = 0;
      63             :     size_t              m_central_directory_size = 0;
      64             :     offset_t            m_central_directory_offset = 0;
      65             :     std::string         m_zip_comment;
      66             : };
      67             : 
      68             : 
      69             : } // zipios namespace
      70             : 
      71             : // Local Variables:
      72             : // mode: cpp
      73             : // indent-tabs-mode: nil
      74             : // c-basic-offset: 4
      75             : // tab-width: 4
      76             : // End:
      77             : 
      78             : // vim: ts=4 sw=4 et
      79             : #endif

Generated by: LCOV version 1.10