Disk ARchive  2.7.15
Full featured and portable backup and archiving tool
slice_layout.hpp
Go to the documentation of this file.
1 /*********************************************************************/
2 // dar - disk archive - a backup/restoration program
3 // Copyright (C) 2002-2024 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 //
19 // to contact the author, see the AUTHOR file
20 /*********************************************************************/
21 
25 
26 
27 #ifndef SLICE_LAYOUT_HPP
28 #define SLICE_LAYOUT_HPP
29 
30 #include <string>
31 #include <set>
32 
33 #include "../my_config.h"
34 #include "infinint.hpp"
35 #include "generic_file.hpp"
36 
37 namespace libdar
38 {
41 
42  class slice_layout
43  {
44  public:
45  slice_layout() { clear(); };
46  slice_layout(const slice_layout & ref) = default;
47  slice_layout(slice_layout && ref) noexcept = default;
48  slice_layout & operator = (const slice_layout & ref) = default;
49  slice_layout & operator = (slice_layout && ref) noexcept = default;
50  ~slice_layout() = default;
51 
52  // field still exposed (slice_layout was a struct before being a class)
53  // we keep these fields as is for now
54 
55  infinint first_size;
56  infinint other_size;
57  infinint first_slice_header;
58  infinint other_slice_header;
59  bool older_sar_than_v8;
60 
61  void read(generic_file & f);
62  void write(generic_file & f) const;
63  void clear();
64 
66 
70  void which_slice(const infinint & offset,
71  infinint & slice_num,
72  infinint & slice_offset) const;
73 
74  private:
75  static const char OLDER_THAN_V8 = '7';
76  static const char V8 = '8';
77  };
78 
80 
81 } // end of namespace
82 
83 #endif
class generic_file is defined here as well as class fichier
switch module to limitint (32 ou 64 bits integers) or infinint
libdar namespace encapsulate all libdar symbols
Definition: archive.hpp:47