Disk ARchive 2.7.16
Full featured and portable backup and archiving tool
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
libdar::header Class Reference

this class manages the header of each slice More...

#include <header.hpp>

+ Collaboration diagram for libdar::header:

Public Member Functions

 header (const header &ref)
 
 header (header &&ref) noexcept
 
headeroperator= (const header &ref)
 
headeroperator= (header &&ref) noexcept
 
void read (user_interaction &ui, generic_file &f, bool lax=false)
 
void write (user_interaction &, generic_file &f) const
 
magic_number & get_set_magic ()
 
labelget_set_internal_name ()
 
char & get_set_flag ()
 
labelget_set_data_name ()
 
bool get_first_slice_size (infinint &size) const
 
void set_first_slice_size (const infinint &size)
 
void unset_first_slice_size ()
 
bool get_slice_size (infinint &size) const
 
void set_slice_size (const infinint &size)
 
void unset_slice_size ()
 
bool is_old_header () const
 
void set_format_07_compatibility ()
 

Static Public Member Functions

static U_I min_size ()
 minimal size of a header in an archive More...
 

Private Member Functions

void nullifyptr () noexcept
 
void copy_from (const header &ref)
 
void move_from (header &&ref) noexcept
 
void free_pointers ()
 
void fill_from (user_interaction &ui, const tlv_list &list)
 
tlv_list build_tlv_list (user_interaction &ui) const
 

Private Attributes

magic_number magic
 constant string for all Dar archives More...
 
label internal_name
 constant string for all slices of a given archive (computed based on date and pid) More...
 
label data_name
 constant string for a set of data (constant with dar_xform, used to link isolated catalogue to its original data) More...
 
char flag
 whether slice is the last of the archive or not More...
 
infinintfirst_size
 size of the first slice More...
 
infinintslice_size
 size of slices (except first slice if specified else and last if not fulfilled) More...
 
bool old_header
 true if the header has been read from an old archive (before release 2.4.0, format 07 and below) and if true when writing, create an old slice header (compatible with format 07). More...
 

Detailed Description

this class manages the header of each slice

this class was a struct before release 2.4.0, now promoted to a class it hides the fields and uses TLV to store the fields in the archive. This makes the header easier to extend by adding new fields, while letting a chance for the old implementation to be able to use more recent archives the main use of TLV is to handle optional fields easily.

Definition at line 65 of file header.hpp.

Constructor & Destructor Documentation

◆ header() [1/2]

libdar::header::header ( const header ref)
inline

Definition at line 71 of file header.hpp.

◆ header() [2/2]

libdar::header::header ( header &&  ref)
inlinenoexcept

Definition at line 72 of file header.hpp.

◆ ~header()

libdar::header::~header ( )
inline

Definition at line 75 of file header.hpp.

Member Function Documentation

◆ get_set_data_name()

label & libdar::header::get_set_data_name ( )
inline

Definition at line 99 of file header.hpp.

◆ get_set_flag()

char & libdar::header::get_set_flag ( )
inline

Definition at line 98 of file header.hpp.

◆ get_set_internal_name()

label & libdar::header::get_set_internal_name ( )
inline

Definition at line 97 of file header.hpp.

◆ get_set_magic()

magic_number & libdar::header::get_set_magic ( )
inline

Definition at line 96 of file header.hpp.

◆ is_old_header()

bool libdar::header::is_old_header ( ) const
inline

Definition at line 109 of file header.hpp.

◆ min_size()

static U_I libdar::header::min_size ( )
inlinestatic

minimal size of a header in an archive

Returns
min size of a header once stored in an archive
Note
since release 2.4.0 the header used for each slice is exactly the same. before this release the header of the first slice might be bigger, it was known that the size of the other header was "min_size" this let dar be able to find the proper slice for a given position. For compatibility with older DAR format, it is thus important to not change the value returned by this class method. This call is only used when reading archive generated by old versions of dar < 2.4.0. (aka archive format <= 7)

Definition at line 91 of file header.hpp.

◆ nullifyptr()

void libdar::header::nullifyptr ( )
inlineprivatenoexcept

Definition at line 121 of file header.hpp.

◆ operator=() [1/2]

header & libdar::header::operator= ( const header ref)
inline

Definition at line 73 of file header.hpp.

◆ operator=() [2/2]

header & libdar::header::operator= ( header &&  ref)
inlinenoexcept

Definition at line 74 of file header.hpp.

◆ set_format_07_compatibility()

void libdar::header::set_format_07_compatibility ( )
inline

Definition at line 110 of file header.hpp.

◆ unset_first_slice_size()

void libdar::header::unset_first_slice_size ( )
inline

Definition at line 103 of file header.hpp.

◆ unset_slice_size()

void libdar::header::unset_slice_size ( )
inline

Definition at line 107 of file header.hpp.

Member Data Documentation

◆ data_name

label libdar::header::data_name
private

constant string for a set of data (constant with dar_xform, used to link isolated catalogue to its original data)

Definition at line 115 of file header.hpp.

◆ first_size

infinint* libdar::header::first_size
private

size of the first slice

Definition at line 117 of file header.hpp.

◆ flag

char libdar::header::flag
private

whether slice is the last of the archive or not

Definition at line 116 of file header.hpp.

◆ internal_name

label libdar::header::internal_name
private

constant string for all slices of a given archive (computed based on date and pid)

Definition at line 114 of file header.hpp.

◆ magic

magic_number libdar::header::magic
private

constant string for all Dar archives

Definition at line 113 of file header.hpp.

◆ old_header

bool libdar::header::old_header
private

true if the header has been read from an old archive (before release 2.4.0, format 07 and below) and if true when writing, create an old slice header (compatible with format 07).

Definition at line 119 of file header.hpp.

◆ slice_size

infinint* libdar::header::slice_size
private

size of slices (except first slice if specified else and last if not fulfilled)

Definition at line 118 of file header.hpp.


The documentation for this class was generated from the following file: