![]() |
Disk ARchive
2.5.2
Full featured and portable backup and archiving tool
|
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 #include "on_pool.hpp" 00034 00035 namespace libdar 00036 { 00037 00040 00041 class label : public on_pool 00042 { 00043 public: 00044 label(); // builds a label equal to 'zero' 00045 label(const label & ref) { copy_from(ref); }; 00046 const label & operator = (const label & ref) { copy_from(ref); return *this; }; 00047 00048 bool operator == (const label & ref) const; 00049 bool operator != (const label & ref) const { return ! ((*this) == ref); }; 00050 00051 void clear(); 00052 bool is_cleared() const; 00053 00054 void generate_internal_filename(); 00055 00056 void read(generic_file & f); 00057 void dump(generic_file & f) const; 00058 00059 void invert_first_byte() { val[0] = ~val[0]; }; 00060 00061 // avoid using these two calls, only here for backward compatibility 00062 // where the cost to move to object is really too heavy than 00063 // sticking with an char array. 00064 U_I size() const { return LABEL_SIZE; }; 00065 char *data() { return (char *)&val; }; 00066 const char *data() const { return (char *)&val; }; 00067 00068 static U_I common_size() { return LABEL_SIZE; }; 00069 00070 private: 00071 static const U_I LABEL_SIZE = 10; 00072 00073 char val[LABEL_SIZE]; 00074 00075 void copy_from(const label & ref); 00076 }; 00077 00078 00079 extern const label label_zero; 00080 00082 00083 } // end of namespace 00084 00085 #endif