00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00028
00029
00030 #ifndef HEADER_HPP
00031 #define HEADER_HPP
00032
00033 #include "../my_config.h"
00034 #include "infinint.hpp"
00035 #include "generic_file.hpp"
00036 #include "user_interaction.hpp"
00037
00038 namespace libdar
00039 {
00040 const unsigned int LABEL_SIZE = 10;
00041
00042 const char FLAG_NON_TERMINAL = 'N';
00043 const char FLAG_TERMINAL = 'T';
00044 const char EXTENSION_NO = 'N';
00045 const char EXTENSION_SIZE = 'S';
00046
00047 const U_32 SAUV_MAGIC_NUMBER = 123;
00048
00049 typedef U_32 magic_number;
00050 typedef char label[LABEL_SIZE];
00051
00052 extern void label_copy(label & left, const label & right);
00053 extern bool header_label_is_equal(const label &a, const label &b);
00054 extern void header_generate_internal_filename(label & ret);
00055
00056 struct header
00057 {
00058 magic_number magic;
00059 label internal_name;
00060 char flag;
00061 char extension;
00062 infinint size_ext;
00063
00064 header();
00065 header(const header & ref) { copy_from(ref); };
00066 struct header & operator = (const header & ref) { copy_from(ref); return *this; };
00067
00068 void read(generic_file & f);
00069 void write(generic_file & f);
00070 void read(user_interaction & dialog, S_I fd);
00071 void write(user_interaction & dialog, S_I fd);
00072
00073 static U_I size() { return sizeof(magic_number) + sizeof(label) + 2*sizeof(char); };
00074 void copy_from(const header & ref);
00075 };
00076
00077 }
00078
00079 #endif