zipios  2.2.0
Zipios – a small C++ library that provides easy access to .zip files.
directoryentry.cpp
Go to the documentation of this file.
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 
30 
32 
33 #include "zipios_common.hpp"
34 
35 
36 namespace zipios
37 {
38 
58 DirectoryEntry::DirectoryEntry(FilePath const & filename, std::string const & comment)
59  : FileEntry(filename, comment)
60 {
62  if(m_valid)
63  {
66  }
67 }
68 
69 
81 {
82  return DirectoryEntry::pointer_t(new DirectoryEntry(*this));
83 }
84 
85 
93 {
94 }
95 
96 
110 bool DirectoryEntry::isEqual(FileEntry const & file_entry) const
111 {
112  DirectoryEntry const * const de(dynamic_cast<DirectoryEntry const * const>(&file_entry));
113  if(de == nullptr)
114  {
115  return false;
116  }
117  return FileEntry::isEqual(file_entry);
118 }
119 
120 
121 } // zipios namespace
122 
123 // Local Variables:
124 // mode: cpp
125 // indent-tabs-mode: nil
126 // c-basic-offset: 4
127 // tab-width: 4
128 // End:
129 
130 // vim: ts=4 sw=4 et
The zipios namespace includes the Zipios library definitions.
Definition: backbuffer.cpp:35
Various exceptions used throughout the Zipios library, all based on zipios::Exception.
bool isRegular() const
Check whether the file is a regular file.
Definition: filepath.cpp:374
DirectoryEntry(FilePath const &filename, std::string const &comment=std::string())
Initialize a DirectoryEntry object.
virtual bool isEqual(FileEntry const &file_entry) const override
Compare two file entries for equality.
std::time_t lastModificationTime() const
Get the last modification time of the file.
Definition: filepath.cpp:487
FilePath m_filename
Definition: fileentry.hpp:132
virtual bool isEqual(FileEntry const &file_entry) const
Compare two file entries for equality.
Definition: fileentry.cpp:431
virtual pointer_t clone() const override
Create a copy of the DirectoryEntry.
Define the zipios::DirectoryEntry class.
bool isDirectory() const
Check whether the file is a directory.
Definition: filepath.cpp:388
size_t fileSize() const
Get the size of the file.
Definition: filepath.cpp:470
A FileEntry represents an entry in a FileCollection.
Definition: fileentry.hpp:75
Handle a file path and name and its statistics.
Definition: filepath.hpp:46
virtual ~DirectoryEntry() override
Clean up a DirectoryEntry object.
Various functions used throughout the library.
A file entry that does not use compression.
size_t m_uncompressed_size
Definition: fileentry.hpp:134
std::shared_ptr< FileEntry > pointer_t
Definition: fileentry.hpp:78