header.hpp
Go to the documentation of this file.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 const char EXTENSION_TLV = 'T';
00047
00048 const U_32 SAUV_MAGIC_NUMBER = 123;
00049
00050 typedef U_32 magic_number;
00051 typedef char label[LABEL_SIZE];
00052
00053 extern void label_copy(label & left, const label & right);
00054 extern bool header_label_is_equal(const label &a, const label &b);
00055 extern void header_generate_internal_filename(label & ret);
00056
00057 struct header
00058 {
00059 magic_number magic;
00060 label internal_name;
00061 char flag;
00062 char extension;
00063 infinint size_ext;
00064
00065 header();
00066 header(const header & ref) { copy_from(ref); };
00067 struct header & operator = (const header & ref) { copy_from(ref); return *this; };
00068
00069 void read(generic_file & f);
00070 void write(generic_file & f);
00071 void read(user_interaction & dialog, S_I fd);
00072 void write(user_interaction & dialog, S_I fd);
00073
00074 static U_I size() { return sizeof(magic_number) + sizeof(label) + 2*sizeof(char); };
00075 void copy_from(const header & ref);
00076 };
00077
00078 }
00079
00080 #endif