Disk ARchive  2.4.17
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules
label.hpp
Go to the documentation of this file.
1 /*********************************************************************/
2 // dar - disk archive - a backup/restoration program
3 // Copyright (C) 2002-2052 Denis Corbin
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 //
19 // to contact the author : http://dar.linux.free.fr/email.html
20 /*********************************************************************/
21 
25 
26 #ifndef LABEL_HPP
27 #define LABEL_HPP
28 
29 #include "../my_config.h"
30 
31 #include "integers.hpp"
32 #include "generic_file.hpp"
33 
34 namespace libdar
35 {
36 
39 
40  class label
41  {
42  public:
43  label(); // builds a label equal to 'zero'
44  label(const label & ref) { copy_from(ref); };
45  const label & operator = (const label & ref) { copy_from(ref); return *this; };
46 
47  bool operator == (const label & ref) const;
48  bool operator != (const label & ref) const { return ! ((*this) == ref); };
49 
50  void clear();
51  bool is_cleared() const;
52 
53  void generate_internal_filename();
54 
55  void read(generic_file & f);
56  void dump(generic_file & f) const;
57 
58  void invert_first_byte() { val[0] = ~val[0]; };
59 
60  // avoid using these two calls, only here for backward compatibility
61  // where the cost to move to object is really too heavy than
62  // sticking with an char array.
63  U_I size() const { return LABEL_SIZE; };
64  char *data() { return (char *)&val; };
65  const char *data() const { return (char *)&val; };
66 
67  static U_I common_size() { return LABEL_SIZE; };
68 
69 #ifdef LIBDAR_SPECIAL_ALLOC
70  USE_SPECIAL_ALLOC(label);
71 #endif
72  private:
73  static const U_I LABEL_SIZE = 10;
74 
75  char val[LABEL_SIZE];
76 
77  void copy_from(const label & ref);
78  };
79 
80 
81  extern const label label_zero;
82 
84 
85 } // end of namespace
86 
87 #endif
are defined here basic integer types that tend to be portable
class generic_file is defined here as well as class fichierthe generic_file interface is widely used ...
libdar namespace encapsulate all libdar symbols
Definition: archive.hpp:43