Loading...
Searching...
No Matches
cat_entree.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 CAT_ENTREE_HPP
#define CAT_ENTREE_HPP
#include "../my_config.h"
extern "C"
{
} // end extern "C"
#include "infinint.hpp"
#include "user_interaction.hpp"
#include "pile.hpp"
#include "escape.hpp"
#include "archive_version.hpp"
#include "proto_compressor.hpp"
#include "pile_descriptor.hpp"
#include "smart_pointer.hpp"
#include "entree_stats.hpp"
#include "list_entry.hpp"
#include "slice_layout.hpp"
#include <memory>
namespace libdar
{
class cat_etoile;
class cat_entree
{
public :
static cat_entree *read(const std::shared_ptr<user_interaction> & dialog,
const smart_pointer<pile_descriptor> & f,
const archive_version & reading_ver,
entree_stats & stats,
std::map <infinint, cat_etoile *> & corres,
compression default_algo,
bool lax,
bool only_detruit,
bool small);
cat_entree(saved_status val): xsaved(val) {};
cat_entree(const smart_pointer<pile_descriptor> & pdesc, bool small, saved_status val);
// copy constructor is fine as we only copy the address of pointers
cat_entree(const cat_entree & ref) = default;
// move constructor
cat_entree(cat_entree && ref) noexcept = default;
// assignment operator is fine too for the same reason
cat_entree & operator = (const cat_entree & ref) = default;
// move assignment operator
cat_entree & operator = (cat_entree && ref) = default;
virtual ~cat_entree() noexcept(false) {};
virtual bool operator == (const cat_entree & ref) const = 0;
bool operator != (const cat_entree & ref) const { return ! (*this == ref); };
bool same_as(const cat_entree & ref) const { return true; };
void dump(const pile_descriptor & pdesc, bool small) const;
void specific_dump(const pile_descriptor & pdesc, bool small) const { inherited_dump(pdesc, small); };
virtual void post_constructor(const pile_descriptor & pdesc) {};
virtual unsigned char signature() const = 0;
virtual std::string get_description() const = 0;
virtual cat_entree *clone() const = 0;
virtual void change_location(const smart_pointer<pile_descriptor> & pdesc);
saved_status get_saved_status() const { return xsaved; };
void set_saved_status(saved_status x) { xsaved = x; };
void set_list_entry(const slice_layout *sly,
bool fetch_ea,
list_entry & ent) const;
protected:
virtual void inherited_dump(const pile_descriptor & pdesc, bool small) const;
pile *get_pile() const { return pdesc.is_null() ? nullptr : pdesc->stack; };
proto_compressor *get_compressor_layer() const { return pdesc.is_null() ? nullptr : pdesc->compr; };
escape *get_escape_layer() const { return pdesc.is_null() ? nullptr : pdesc->esc; };
generic_file *get_read_cat_layer(bool small) const;
private:
static const U_I ENTREE_CRC_SIZE;
saved_status xsaved;
smart_pointer<pile_descriptor> pdesc;
};
extern const char *cat_entree_signature2string(unsigned char sign);
} // end of namespace
#endif
archive_version.hpp
class archive_version that rules which archive format to follow
libdar::archive_version
class archive_version manages the version of the archive format
Definition archive_version.hpp:47
libdar::cat_entree::get_escape_layer
escape * get_escape_layer() const
escape generic_file relative methods
Definition cat_entree.hpp:200
libdar::cat_entree::get_read_cat_layer
generic_file * get_read_cat_layer(bool small) const
return the adhoc layer in the stack to read from the catalogue objects (except the EA,...
libdar::cat_entree::inherited_dump
virtual void inherited_dump(const pile_descriptor &pdesc, bool small) const
inherited class may overload this method but shall first call the parent's inherited_dump() in the ov...
libdar::cat_entree::same_as
bool same_as(const cat_entree &ref) const
return true of the two objects would generate the same entry on filsystem
Definition cat_entree.hpp:120
libdar::cat_entree::specific_dump
void specific_dump(const pile_descriptor &pdesc, bool small) const
this call gives an access to inherited_dump
Definition cat_entree.hpp:132
libdar::cat_entree::get_pile
pile * get_pile() const
stack used to read object from (nullptr is returned for object created from filesystem)
Definition cat_entree.hpp:186
libdar::cat_entree::set_list_entry
void set_list_entry(const slice_layout *sly, bool fetch_ea, list_entry &ent) const
setup a list_entry object relative to the current cat_entree object
libdar::cat_entree::get_saved_status
saved_status get_saved_status() const
obtain the saved status of the object
Definition cat_entree.hpp:164
libdar::cat_entree::cat_entree
cat_entree(saved_status val)
setup an object when read from filesystem
Definition cat_entree.hpp:84
libdar::cat_entree::signature
virtual unsigned char signature() const =0
inherited class signature
libdar::cat_entree::read
static cat_entree * read(const std::shared_ptr< user_interaction > &dialog, const smart_pointer< pile_descriptor > &f, const archive_version &reading_ver, entree_stats &stats, std::map< infinint, cat_etoile * > &corres, compression default_algo, bool lax, bool only_detruit, bool small)
read and create an object of inherited class of class cat_entree
libdar::cat_entree::~cat_entree
virtual ~cat_entree() noexcept(false)
destructor
Definition cat_entree.hpp:107
libdar::cat_entree::xsaved
saved_status xsaved
inode data status, this field is stored with signature() in the cat_signature field -> must be manage...
Definition cat_entree.hpp:208
libdar::cat_entree::set_saved_status
void set_saved_status(saved_status x)
modify the saved_status of the object
Definition cat_entree.hpp:167
libdar::cat_entree::get_description
virtual std::string get_description() const =0
inherited class designation
libdar::cat_entree::cat_entree
cat_entree(const smart_pointer< pile_descriptor > &pdesc, bool small, saved_status val)
setup an object when read from an archive
libdar::cat_entree::change_location
virtual void change_location(const smart_pointer< pile_descriptor > &pdesc)
libdar::cat_entree::clone
virtual cat_entree * clone() const =0
a way to copy the exact type of an object even if pointed to by a parent class pointer
libdar::cat_entree::operator==
virtual bool operator==(const cat_entree &ref) const =0
returns true if the two object are the same
libdar::cat_entree::dump
void dump(const pile_descriptor &pdesc, bool small) const
write down the object information to a stack
libdar::cat_entree::get_compressor_layer
proto_compressor * get_compressor_layer() const
compressor generic_file relative methods
Definition cat_entree.hpp:193
libdar::cat_entree::post_constructor
virtual void post_constructor(const pile_descriptor &pdesc)
let inherited classes build object's data after CRC has been read from file in small read mode
Definition cat_entree.hpp:139
libdar::cat_etoile
the hard link implementation
Definition cat_etoile.hpp:48
libdar::generic_file
this is the interface class from which all other data transfer classes inherit
Definition generic_file.hpp:77
libdar::list_entry
Definition list_entry.hpp:60
libdar::pile
stores a stack of generic_files writing/reading on each others
Definition pile.hpp:44
libdar::smart_pointer
smart pointer class to be used to automagically manage multiple time pointed to address
Definition smart_pointer.hpp:79
entree_stats.hpp
datastructure holding the nature of file present in a given archive
escape.hpp
class escape definition, used for sequential reading of archives
libdar::compression
compression
the different compression algorithm available
Definition compression.hpp:46
libdar::cat_entree_signature2string
const char * cat_entree_signature2string(unsigned char sign)
convert a signature char to a human readable string
libdar::saved_status
saved_status
data saved status for an entry
Definition cat_status.hpp:44
infinint.hpp
switch module to limitint (32 ou 64 bits integers) or infinint
list_entry.hpp
class of objects describing an entry in the archive, used by archive::get_children_in_table
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
pile.hpp
class pile definition. Used to manage a stack of generic_file objects
pile_descriptor.hpp
optimization structure to quickly access some commonly used layers of a stack of generic_file
proto_compressor.hpp
abstracted ancestor class for compressor and parallel_compressor classes
slice_layout.hpp
object describing the slicing of an archive
smart_pointer.hpp
template class implementing memory efficient smart pointer
libdar::entree_stats
holds the statistics contents of a catalogue
Definition entree_stats.hpp:49
user_interaction.hpp
defines the interaction interface between libdar and users.