26 #ifndef HEADER_VERSION_HPP
27 #define HEADER_VERSION_HPP
29 #include "../my_config.h"
41 const U_I VERSION_FLAG_SAVED_EA_ROOT = 0x80;
42 const U_I VERSION_FLAG_SAVED_EA_USER = 0x40;
43 const U_I VERSION_FLAG_SCRAMBLED = 0x20;
44 const U_I VERSION_FLAG_SEQUENCE_MARK = 0x10;
45 const U_I VERSION_FLAG_INITIAL_OFFSET = 0x08;
46 const U_I VERSION_FLAG_HAS_AN_EXTENDED_SIZE = 0x01;
47 const U_I VERSION_SIZE = 3;
48 const U_I HEADER_CRC_SIZE = 2;
74 f.
read(&algo_zip,
sizeof(algo_zip));
77 f.
read((
char *)&flag, 1);
80 if((flag & VERSION_FLAG_INITIAL_OFFSET) != 0)
81 initial_offset.read(f);
90 if((edition == empty_archive_version()))
91 throw Erange(
"header_version::read", gettext(
"Consistency check failed for archive header"));
94 crc *coh = create_crc_from_file(f);
100 if(
typeid(*coh) !=
typeid(*ctrl))
102 if(coh->get_size() != ctrl->get_size())
108 throw Erange(
"header_version::read", gettext(
"Consistency check failed for archive header"));
119 if(initial_offset == 0)
139 if(initial_offset != 0)
140 flag |= VERSION_FLAG_INITIAL_OFFSET;
142 flag &= ~VERSION_FLAG_INITIAL_OFFSET;
148 f.
write(&algo_zip,
sizeof(algo_zip));
150 f.
write((
char *)&flag, 1);
151 if(initial_offset != 0)
152 initial_offset.dump(f);
class generic_file is defined here as well as class fichierthe generic_file interface is widely used ...
U_I read(char *a, U_I size)
read data from the generic_file
crc * get_crc()
get CRC of the transfered date since last reset
switch module to limitint (32 ou 64 bits integers) or infinint
exception used to signal range error
this is the interface class from which all other data transfer classes inherit
void write(const char *a, U_I size)
write data to the generic_file
class archive_version that rules which archive format to follow
void reset_crc(const infinint &width)
reset CRC on read or writen data
the arbitrary large positive integer class
class archive_version manages the version of the archive format
virtual infinint get_position()=0
get the current read/write position
libdar namespace encapsulate all libdar symbols