Loading...
Searching...
No Matches
header_flags.hpp
Go to the documentation of this file.
/*********************************************************************/
// dar - disk archive - a backup/restoration program
// Copyright (C) 2002-2026 Denis Corbin
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
// to contact the author, see the AUTHOR file
/*********************************************************************/
#ifndef HEADER_FLAGS_HPP
#define HEADER_FLAGS_HPP
#include "../my_config.h"
#include "generic_file.hpp"
namespace libdar
{
class header_flags
{
public:
header_flags(): bits(0) {};
header_flags(generic_file & f) { read(f); };
header_flags(const header_flags & ref) = default;
header_flags(header_flags && ref) noexcept = default;
header_flags & operator = (const header_flags & ref) = default;
header_flags & operator = (header_flags && ref) noexcept = default;
~header_flags() = default;
void set_bits(U_I bitfield);
void unset_bits(U_I bitfield);
bool is_set(U_I bitfield) const;
void read(generic_file & f);
void dump(generic_file & f) const;
void clear() { bits = 0; };
bool is_all_cleared() { return bits == 0; };
private:
U_I bits;
static bool has_an_lsb_set(U_I bitfield);
};
} // end of namespace
#endif
libdar::generic_file
this is the interface class from which all other data transfer classes inherit
Definition generic_file.hpp:77
generic_file.hpp
class generic_file is defined here as well as class fichier
libdar::header_flags::is_set
bool is_set(U_I bitfield) const
return true if all bits of the argument set to 1, are set in this header_flags
libdar::header_flags::bits
U_I bits
future implementation could rely on infinint for a arbitrary large bitfield
Definition header_flags.hpp:82
libdar::header_flags::unset_bits
void unset_bits(U_I bitfield)
remove all the bits set to in in the argument
libdar::header_flags::clear
void clear()
clear all flags
Definition header_flags.hpp:76
libdar::header_flags::dump
void dump(generic_file &f) const
dump the header_flags to generic_file
libdar::header_flags::is_all_cleared
bool is_all_cleared()
whether all bits are cleared
Definition header_flags.hpp:79
libdar::header_flags::set_bits
void set_bits(U_I bitfield)
add all the bits set to 1 in the argument
libdar::header_flags::read
void read(generic_file &f)
set the header_flags from a generic_file
my_config.h
include macro defined by the configure script and some specific additional ones
libdar
libdar namespace encapsulate all libdar symbols
Definition archive.hpp:47