From 84ea2f10e6d16407d40d61e39d16d3cb019f5b8d Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 6 Sep 2022 10:19:33 +0200 Subject: [PATCH] zipios: Make local copy compatible with external package --- src/zipios++/fcoll.cpp | 24 ------------------------ src/zipios++/fcoll.h | 34 ++++++++++++++++++++++++++++------ src/zipios++/ziphead.cpp | 30 ------------------------------ src/zipios++/ziphead.h | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 61 insertions(+), 60 deletions(-) diff --git a/src/zipios++/fcoll.cpp b/src/zipios++/fcoll.cpp index cc5c94d174..a0a3cefda0 100644 --- a/src/zipios++/fcoll.cpp +++ b/src/zipios++/fcoll.cpp @@ -11,30 +11,6 @@ namespace zipios { using std::find_if ; -FileCollection::FileCollection( const FileCollection &src ) - : _filename( src._filename ), - _valid ( src._valid ) -{ - _entries.reserve( src._entries.size() ) ; - Entries::const_iterator it ; - for ( it = src._entries.begin() ; it != src._entries.end() ; ++it ) - _entries.push_back( (*it)->clone() ) ; -} - -const FileCollection &FileCollection::operator= ( const FileCollection &src ) { - if ( this != &src ) { - _filename = src._filename ; - _valid = src._valid ; - _entries.clear() ; - _entries.reserve( src._entries.size() ) ; - - Entries::const_iterator it ; - for ( it = src._entries.begin() ; it != src._entries.end() ; ++it ) - _entries.push_back( (*it)->clone() ) ; - } - return *this ; -} - // FIXME: make InvalidStateException message customized for // subclasses. maybe make an InvalidStateException factory ;-) diff --git a/src/zipios++/fcoll.h b/src/zipios++/fcoll.h index b97e239949..9793191c49 100644 --- a/src/zipios++/fcoll.h +++ b/src/zipios++/fcoll.h @@ -27,18 +27,14 @@ public: _valid ( false ) {} /** Copy constructor. */ - FileCollection( const FileCollection &src ) ; + inline FileCollection( const FileCollection &src ) ; /** Copy assignment operator. */ - const FileCollection &operator= ( const FileCollection &src ) ; + inline const FileCollection &operator= ( const FileCollection &src ) ; /** Closes the FileCollection. */ virtual void close() = 0 ; - enum MatchPath { - IGN, - MATCH - } ; /** \anchor fcoll_entries_anchor Returns a vector of const pointers to the entries in the FileCollection. @@ -47,6 +43,7 @@ public: @throw InvalidStateException Thrown if the collection is invalid. */ virtual ConstEntries entries() const ; + enum MatchPath { IGNORE, MATCH } ; /** \anchor fcoll_getentry_anchor Returns a ConstEntryPointer to a FileEntry object for the entry @@ -119,6 +116,30 @@ protected: // Inline methods // +FileCollection::FileCollection( const FileCollection &src ) + : _filename( src._filename ), + _valid ( src._valid ) +{ + _entries.reserve( src._entries.size() ) ; + Entries::const_iterator it ; + for ( it = src._entries.begin() ; it != src._entries.end() ; ++it ) + _entries.push_back( (*it)->clone() ) ; +} + +const FileCollection &FileCollection::operator= ( const FileCollection &src ) { + if ( this != &src ) { + _filename = src._filename ; + _valid = src._valid ; + _entries.clear() ; + _entries.reserve( src._entries.size() ) ; + + Entries::const_iterator it ; + for ( it = src._entries.begin() ; it != src._entries.end() ; ++it ) + _entries.push_back( (*it)->clone() ) ; + } + return *this ; +} + inline ostream & operator<< (ostream &os, const FileCollection& collection) { os << "collection '" << collection.getName() << "' {" ; ConstEntries entries = collection.entries(); @@ -134,6 +155,7 @@ inline ostream & operator<< (ostream &os, const FileCollection& collection) { return os; } + } // namespace #endif diff --git a/src/zipios++/ziphead.cpp b/src/zipios++/ziphead.cpp index 0fab5854ce..cadc52bd12 100644 --- a/src/zipios++/ziphead.cpp +++ b/src/zipios++/ziphead.cpp @@ -54,36 +54,6 @@ bool operator== ( const ZipLocalEntry &zlh, const ZipCDirEntry &ze ) { const uint32 ZipLocalEntry::signature = 0x04034b50 ; -// Commented because same as default... -//ZipCDirEntry &ZipCDirEntry::operator=( const class ZipCDirEntry &src ) { - //writer_version = src.writer_version ; - //extract_version = src.extract_version ; - //gp_bitfield = src.gp_bitfield ; - //compress_method = src.compress_method ; - //last_mod_ftime = src.last_mod_ftime ; - //last_mod_fdate = src.last_mod_fdate ; - //crc_32 = src.crc_32 ; - //compress_size = src.compress_size ; - //uncompress_size = src.uncompress_size ; - //filename_len = src.filename_len ; - //extra_field_len = src.extra_field_len ; - //file_comment_len = src.file_comment_len ; - //disk_num_start = src.disk_num_start ; - //intern_file_attr = src.intern_file_attr ; - //extern_file_attr = src.extern_file_attr ; - //rel_offset_loc_head = src.rel_offset_loc_head ; - - //filename = src.filename ; - //extra_field = src.extra_field ; - //file_comment = src.file_comment ; - - //return *this ; -//} - -bool EndOfCentralDirectory::checkSignature ( uint32 sig ) const { - return signature == sig ; -} - void ZipLocalEntry::setDefaultExtract() { extract_version = 20 ; // version number } diff --git a/src/zipios++/ziphead.h b/src/zipios++/ziphead.h index c87309a69e..d52d4b47b5 100644 --- a/src/zipios++/ziphead.h +++ b/src/zipios++/ziphead.h @@ -212,6 +212,39 @@ inline bool operator!= ( const ZipCDirEntry &ze, const ZipLocalEntry &zlh ) { // Inline member functions +// Commented because same as default... +#if 0 +ZipCDirEntry &ZipCDirEntry::operator=( const class ZipCDirEntry &src ) { + writer_version = src.writer_version ; + extract_version = src.extract_version ; + gp_bitfield = src.gp_bitfield ; + compress_method = src.compress_method ; + last_mod_ftime = src.last_mod_ftime ; + last_mod_fdate = src.last_mod_fdate ; + crc_32 = src.crc_32 ; + compress_size = src.compress_size ; + uncompress_size = src.uncompress_size ; + filename_len = src.filename_len ; + extra_field_len = src.extra_field_len ; + file_comment_len = src.file_comment_len ; + disk_num_start = src.disk_num_start ; + intern_file_attr = src.intern_file_attr ; + extern_file_attr = src.extern_file_attr ; + rel_offset_loc_head = src.rel_offset_loc_head ; + + filename = src.filename ; + extra_field = src.extra_field ; + file_comment = src.file_comment ; + + return *this ; +} +#endif + +bool EndOfCentralDirectory::checkSignature ( uint32 sig ) const { + return signature == sig ; +} + + } // namespace #endif