zipios: Make local copy compatible with external package
This commit is contained in:
@@ -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 ;-)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user