|
Disk ARchive
2.4.12
|
00001 /*********************************************************************/ 00002 // dar - disk archive - a backup/restoration program 00003 // Copyright (C) 2002-2052 Denis Corbin 00004 // 00005 // This program is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU General Public License 00007 // as published by the Free Software Foundation; either version 2 00008 // of the License, or (at your option) any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with this program; if not, write to the Free Software 00017 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 // 00019 // to contact the author : http://dar.linux.free.fr/email.html 00020 /*********************************************************************/ 00021 00025 00026 #ifndef LABEL_HPP 00027 #define LABEL_HPP 00028 00029 #include "../my_config.h" 00030 00031 #include "integers.hpp" 00032 #include "generic_file.hpp" 00033 00034 namespace libdar 00035 { 00036 00039 00040 class label 00041 { 00042 public: 00043 label(); // builds a label equal to 'zero' 00044 label(const label & ref) { copy_from(ref); }; 00045 const label & operator = (const label & ref) { copy_from(ref); return *this; }; 00046 00047 bool operator == (const label & ref) const; 00048 bool operator != (const label & ref) const { return ! ((*this) == ref); }; 00049 00050 void clear(); 00051 bool is_cleared() const; 00052 00053 void generate_internal_filename(); 00054 00055 void read(generic_file & f); 00056 void dump(generic_file & f) const; 00057 00058 void invert_first_byte() { val[0] = ~val[0]; }; 00059 00060 // avoid using these two calls, only here for backward compatibility 00061 // where the cost to move to object is really too heavy than 00062 // sticking with an char array. 00063 U_I size() const { return LABEL_SIZE; }; 00064 char *data() { return (char *)&val; }; 00065 const char *data() const { return (char *)&val; }; 00066 00067 static U_I common_size() { return LABEL_SIZE; }; 00068 00069 #ifdef LIBDAR_SPECIAL_ALLOC 00070 USE_SPECIAL_ALLOC(label); 00071 #endif 00072 private: 00073 static const U_I LABEL_SIZE = 10; 00074 00075 char val[LABEL_SIZE]; 00076 00077 void copy_from(const label & ref); 00078 }; 00079 00080 00081 extern const label label_zero; 00082 00084 00085 } // end of namespace 00086 00087 #endif
1.7.6.1