2 #include "zipios++/zipios-config.h"
4 #include "zipios++/meta-iostreams.h"
15 std::istream& operator>> ( std::istream &is, ZipLocalEntry &zlh ) {
25 if ( zlh.signature != readUint32( is ) ) {
27 is.setstate ( std::ios::failbit ) ;
31 zlh.extract_version = readUint16( is ) ;
32 zlh.gp_bitfield = readUint16( is ) ;
33 zlh.compress_method = readUint16( is ) ;
34 zlh.last_mod_ftime = readUint16( is ) ;
35 zlh.last_mod_fdate = readUint16( is ) ;
36 zlh.crc_32 = readUint32( is ) ;
37 zlh.compress_size = readUint32( is ) ;
38 zlh.uncompress_size = readUint32( is ) ;
39 zlh.filename_len = readUint16( is ) ;
40 zlh.extra_field_len = readUint16( is ) ;
43 readByteSeq( is, zlh.filename, zlh.filename_len ) ;
44 readByteSeq( is, zlh.extra_field, zlh.extra_field_len ) ;
52 std::istream& operator>> ( std::istream &is, DataDescriptor & ) {
57 std::istream& operator>> ( std::istream &is, ZipCDirEntry &zcdh ) {
62 if ( zcdh.signature != readUint32( is ) ) {
64 is.setstate ( std::ios::failbit ) ;
68 zcdh.writer_version = readUint16( is ) ;
69 zcdh.extract_version = readUint16( is ) ;
70 zcdh.gp_bitfield = readUint16( is ) ;
71 zcdh.compress_method = readUint16( is ) ;
72 zcdh.last_mod_ftime = readUint16( is ) ;
73 zcdh.last_mod_fdate = readUint16( is ) ;
74 zcdh.crc_32 = readUint32( is ) ;
75 zcdh.compress_size = readUint32( is ) ;
76 zcdh.uncompress_size = readUint32( is ) ;
77 zcdh.filename_len = readUint16( is ) ;
78 zcdh.extra_field_len = readUint16( is ) ;
79 zcdh.file_comment_len = readUint16( is ) ;
80 zcdh.disk_num_start = readUint16( is ) ;
81 zcdh.intern_file_attr = readUint16( is ) ;
82 zcdh.extern_file_attr = readUint32( is ) ;
83 zcdh.rel_offset_loc_head = readUint32( is ) ;
86 readByteSeq( is, zcdh.filename, zcdh.filename_len ) ;
87 readByteSeq( is, zcdh.extra_field, zcdh.extra_field_len ) ;
88 readByteSeq( is, zcdh.file_comment, zcdh.file_comment_len ) ;
95 std::ostream &operator<< ( std::ostream &os,
const ZipLocalEntry &zlh ) {
99 writeUint32( zlh.signature , os ) ;
100 writeUint16( zlh.extract_version, os ) ;
101 writeUint16( zlh.gp_bitfield , os ) ;
102 writeUint16( zlh.compress_method, os ) ;
103 writeUint16( zlh.last_mod_ftime , os ) ;
104 writeUint16( zlh.last_mod_fdate , os ) ;
105 writeUint32( zlh.crc_32 , os ) ;
106 writeUint32( zlh.compress_size , os ) ;
107 writeUint32( zlh.uncompress_size, os ) ;
108 writeUint16( zlh.filename_len , os ) ;
109 writeUint16( zlh.extra_field_len, os ) ;
113 writeByteSeq( os, zlh.filename ) ;
114 writeByteSeq( os, zlh.extra_field ) ;
119 std::ostream &operator<< ( std::ostream &os,
const ZipCDirEntry &zcdh ) {
123 writeUint32( zcdh.signature , os ) ;
124 writeUint16( zcdh.writer_version , os ) ;
125 writeUint16( zcdh.extract_version , os ) ;
126 writeUint16( zcdh.gp_bitfield , os ) ;
127 writeUint16( zcdh.compress_method , os ) ;
128 writeUint16( zcdh.last_mod_ftime , os ) ;
129 writeUint16( zcdh.last_mod_fdate , os ) ;
130 writeUint32( zcdh.crc_32 , os ) ;
131 writeUint32( zcdh.compress_size , os ) ;
132 writeUint32( zcdh.uncompress_size , os ) ;
133 writeUint16( zcdh.filename_len , os ) ;
134 writeUint16( zcdh.extra_field_len , os ) ;
135 writeUint16( zcdh.file_comment_len , os ) ;
136 writeUint16( zcdh.disk_num_start , os ) ;
137 writeUint16( zcdh.intern_file_attr , os ) ;
138 writeUint32( zcdh.extern_file_attr , os ) ;
139 writeUint32( zcdh.rel_offset_loc_head, os ) ;
142 writeByteSeq( os, zcdh.filename ) ;
143 writeByteSeq( os, zcdh.extra_field ) ;
144 writeByteSeq( os, zcdh.file_comment ) ;
149 std::ostream &operator<< ( std::ostream &os,
const EndOfCentralDirectory &eocd ) {
153 writeUint32( eocd.signature , os ) ;
154 writeUint16( eocd.disk_num , os ) ;
155 writeUint16( eocd.cdir_disk_num , os ) ;
156 writeUint16( eocd.cdir_entries , os ) ;
157 writeUint16( eocd.cdir_tot_entries, os ) ;
158 writeUint32( eocd.cdir_size , os ) ;
159 writeUint32( eocd.cdir_offset , os ) ;
160 writeUint16( eocd.zip_comment_len , os ) ;
162 writeByteSeq( os, eocd.zip_comment ) ;
Header file that defines OutputStringStream.
Header file that defines I/O functions for the header structures defined in ziphead.h.
Header file containing miscellaneous small functions.