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
zipios::DirectoryEntry::isEqual
virtual bool isEqual(FileEntry const &file_entry) const override
Compare two file entries for equality.
Definition: directoryentry.cpp:110
directoryentry.hpp
Define the zipios::DirectoryEntry class.
zipios::FileEntry::m_valid
bool m_valid
Definition: fileentry.hpp:142
zipios::FileEntry::m_uncompressed_size
size_t m_uncompressed_size
Definition: fileentry.hpp:134
zipios::FileEntry
A FileEntry represents an entry in a FileCollection.
Definition: fileentry.hpp:76
zipiosexceptions.hpp
Various exceptions used throughout the Zipios library, all based on zipios::Exception.
zipios::FileEntry::m_filename
FilePath m_filename
Definition: fileentry.hpp:132
zipios_common.hpp
Various functions used throughout the library.
zipios::DirectoryEntry::~DirectoryEntry
virtual ~DirectoryEntry() override
Clean up a DirectoryEntry object.
Definition: directoryentry.cpp:92
zipios::FileEntry::pointer_t
std::shared_ptr< FileEntry > pointer_t
Definition: fileentry.hpp:78
zipios::FilePath::fileSize
size_t fileSize() const
Get the size of the file.
Definition: filepath.cpp:470
zipios::FilePath
Handle a file path and name and its statistics.
Definition: filepath.hpp:47
zipios::FilePath::lastModificationTime
std::time_t lastModificationTime() const
Get the last modification time of the file.
Definition: filepath.cpp:487
zipios::FileEntry::isEqual
virtual bool isEqual(FileEntry const &file_entry) const
Compare two file entries for equality.
Definition: fileentry.cpp:431
zipios::DirectoryEntry::clone
virtual pointer_t clone() const override
Create a copy of the DirectoryEntry.
Definition: directoryentry.cpp:80
zipios::DirectoryEntry::DirectoryEntry
DirectoryEntry(FilePath const &filename, std::string const &comment=std::string())
Initialize a DirectoryEntry object.
Definition: directoryentry.cpp:58
zipios::FilePath::isDirectory
bool isDirectory() const
Check whether the file is a directory.
Definition: filepath.cpp:388
zipios::FilePath::isRegular
bool isRegular() const
Check whether the file is a regular file.
Definition: filepath.cpp:374
zipios::FileEntry::m_unix_time
time_t m_unix_time
Definition: fileentry.hpp:135
zipios::DirectoryEntry
A file entry that does not use compression.
Definition: directoryentry.hpp:43
zipios
The zipios namespace includes the Zipios library definitions.
Definition: backbuffer.cpp:36