Disk ARchive 2.7.16
Full featured and portable backup and archiving tool
header_flags.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#ifndef HEADER_FLAGS_HPP
27#define HEADER_FLAGS_HPP
28
29#include "../my_config.h"
30#include "generic_file.hpp"
31
32namespace libdar
33{
34
37
39
50 {
51 public:
52 header_flags(): bits(0) {};
53 header_flags(generic_file & f) { read(f); };
54 header_flags(const header_flags & ref) = default;
55 header_flags(header_flags && ref) noexcept = default;
56 header_flags & operator = (const header_flags & ref) = default;
57 header_flags & operator = (header_flags && ref) noexcept = default;
58 ~header_flags() = default;
59
61 void set_bits(U_I bitfield);
62
64 void unset_bits(U_I bitfield);
65
67 bool is_set(U_I bitfield) const;
68
70 void read(generic_file & f);
71
73 void dump(generic_file & f) const;
74
76 void clear() { bits = 0; };
77
79 bool is_all_cleared() { return bits == 0; };
80
81 private:
82 U_I bits;
83
84 static bool has_an_lsb_set(U_I bitfield);
85 };
86
87} // end of namespace
88
89#endif
this is the interface class from which all other data transfer classes inherit
manages the flag field used for now in the archive header
class generic_file is defined here as well as class fichier
bool is_set(U_I bitfield) const
return true if all bits of the argument set to 1, are set in this header_flags
U_I bits
future implementation could rely on infinint for a arbitrary large bitfield
void unset_bits(U_I bitfield)
remove all the bits set to in in the argument
void clear()
clear all flags
void dump(generic_file &f) const
dump the header_flags to generic_file
bool is_all_cleared()
whether all bits are cleared
void set_bits(U_I bitfield)
add all the bits set to 1 in the argument
void read(generic_file &f)
set the header_flags from a generic_file
libdar namespace encapsulate all libdar symbols
Definition: archive.hpp:47