Disk ARchive: libdar::cat_directory Class Reference

| Disk ARchive 2.8.3 Full featured and portable backup and archiving tool

Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
libdar::cat_directory Class Reference
Private

the cat_directory inode class More...

`#include <cat_directory.hpp>`

Inherits libdar::cat_inode.

## Public Member Functions
| cat_directory (const infinint &xuid, const infinint &xgid, U_16 xperm, const datetime &last_access, const datetime &last_modif, const datetime &last_change, const std::string &xname, const infinint &device)
| cat_directory (const std::shared_ptr< user_interaction > &dialog, const smart_pointer< pile_descriptor > &pdesc, const archive_version &reading_ver, saved_status saved, entree_stats &stats, std::map< infinint, cat_etoile * > &corres, compression default_algo, bool lax, bool only_detruit, bool small)
| cat_directory (const cat_directory &ref)
| cat_directory (cat_directory &&ref) noexcept
cat_directory & | operator= (const cat_directory &ref)
cat_directory & | operator= (cat_directory &&ref)
virtual bool | operator== (const cat_entree &ref) const override
| attention this compares only the directories themselves, not the list of their children
void | add_children (cat_nomme *r)
bool | has_children () const
void | reset_read_children () const
void | end_read () const
bool | read_children (const cat_nomme *&r) const
bool | remove_last_read ()
| remove last read entry of self from parent directory
bool | tail_to_read_children (bool including_last_read)
| remove all entry not yet read by read_children
void | remove (const std::string &name)
| remove the given entry from the catalogue
void | remove_if_no_mirage (const std::string &name)
| remove the given entry if it is not a cat_mirage or a directory tree with cat_mirage objects
void | clear ()
| remove all entries contained in this directory (recursively)
cat_directory * | get_parent () const
bool | search_children (const std::string &name, const cat_nomme *&ref) const
path | get_path () const
| provide the current path of the directory (including its parent and ancestor)
virtual unsigned char | signature () const override
| inherited class signature
virtual std::string | get_description () const override
| inherited class designation
bool | get_recursive_has_changed () const
| detemine whether some data has changed since archive of reference in this cat_directory or subdirectories
void | recursive_has_changed_update () const
| ask recursive update for the recursive_has_changed field
infinint | get_dir_size () const
| get the number of "cat_nomme" entry directly containted in this cat_directory (no recursive call)
infinint | get_tree_size () const
| get then number of "cat_nomme" entry contained in this cat_directory and subdirectories (recursive call)
infinint | get_tree_ea_num () const
| get the number of entry having some EA set in the cat_directory tree (recursive call)
infinint | get_tree_mirage_num () const
| get the number of entry that are hard linked inode (aka mirage in dar implementation) (recursive call)
void | get_etiquettes_found_in_tree (std::map< infinint, infinint > &already_found) const
bool | is_empty () const
| whether this cat_directory is empty or not
void | remove_all_mirages_and_reduce_dirs ()
| recursively remove all mirage entries
void | remove_all_ea_and_fsa ()
| remove all EA and FSA recursively (those "full" get flagged "partial")
void | set_all_mirage_s_inode_wrote_field_to (bool val) const
| recursively set all mirage inode_wrote flag
void | set_all_mirage_s_inode_dumped_field_to (bool val) const
| set the value of inode_dumped for all mirage (recusively)
virtual cat_entree * | clone () const override
| a way to copy the exact type of an object even if pointed to by a parent class pointer
const infinint & | get_size () const
const infinint & | get_storage_size () const
void | recursively_set_to_unsaved_data_and_FSA ()
virtual void | change_location (const smart_pointer< pile_descriptor > &pdesc) override
| overwrite virtual method of cat_entree to propagate the action to all entries of the directory tree
Public Member Functions inherited from libdar::cat_inode
| cat_inode (const infinint &xuid, const infinint &xgid, U_16 xperm, const datetime &last_access, const datetime &last_modif, const datetime &last_change, const std::string &xname, const infinint &device)
| flag used to only consider certain fields when comparing/restoring inodes
| cat_inode (const std::shared_ptr< user_interaction > &dialog, const smart_pointer< pile_descriptor > &pdesc, const archive_version &reading_ver, saved_status saved, bool small)
| cat_inode (const cat_inode &ref)
| cat_inode (cat_inode &&ref) noexcept
cat_inode & | operator= (const cat_inode &ref)
cat_inode & | operator= (cat_inode &&ref)
const infinint & | get_uid () const
const infinint & | get_gid () const
U_16 | get_perm () const
datetime | get_last_access () const
datetime | get_last_modif () const
void | set_last_access (const datetime &x_time)
void | set_last_modif (const datetime &x_time)
infinint | get_device () const
bool | same_as (const cat_inode &ref) const
bool | is_more_recent_than (const cat_inode &ref, const infinint &hourshift) const
virtual bool | has_changed_since (const cat_inode &ref, const infinint &hourshift, comparison_fields what_to_check) const
void | compare (const cat_inode &other, const mask &ea_mask, comparison_fields what_to_check, const infinint &hourshift, bool symlink_date, const fsa_scope &scope, bool isolated_mode, bool seq_read_mode) const
void | ea_set_saved_status (ea_saved_status status)
ea_saved_status | ea_get_saved_status () const
void | ea_attach (ea_attributs *ref)
const ea_attributs * | get_ea () const
| the returned value is the address of an existing file of the cat_inode object and shall not be deleted by the caller
void | ea_detach () const
infinint | ea_get_size () const
void | ea_set_offset (const infinint &pos)
bool | ea_get_offset (infinint &pos) const
void | ea_set_crc (const crc &val)
void | ea_get_crc (const crc *&ptr) const
| the argument is set to point to an allocated crc object owned by this "cat_inode" object, this reference stays valid while the "cat_inode" object exists and MUST NOT be deleted by the caller in any case
bool | ea_get_crc_size (infinint &val) const
| returns true if crc is know and puts its width in argument
datetime | get_last_change () const
void | set_last_change (const datetime &x_time)
bool | has_last_change () const
void | fsa_set_saved_status (fsa_saved_status status)
fsa_saved_status | fsa_get_saved_status () const
fsa_scope | fsa_get_families () const
| gives the set of FSA family recorded for that inode
void | fsa_attach (filesystem_specific_attribute_list *ref)
void | fsa_partial_attach (const fsa_scope &val)
const filesystem_specific_attribute_list * | get_fsa () const
void | fsa_detach () const
infinint | fsa_get_size () const
void | fsa_set_offset (const infinint &pos)
bool | fsa_get_offset (infinint &pos) const
void | fsa_set_crc (const crc &val)
void | fsa_get_crc (const crc *&ptr) const
bool | fsa_get_crc_size (infinint &val) const
Public Member Functions inherited from libdar::cat_nomme
| cat_nomme (const std::string &name, saved_status arg)
| cat_nomme (const smart_pointer< pile_descriptor > &pdesc, bool small, saved_status val)
| cat_nomme (const cat_nomme &ref)=default
| cat_nomme (cat_nomme &&ref) noexcept=default
cat_nomme & | operator= (const cat_nomme &ref)=default
cat_nomme & | operator= (cat_nomme &&ref)=default
virtual bool | operator< (const cat_nomme &ref) const
const std::string & | get_name () const
void | change_name (const std::string &x)
bool | same_as (const cat_nomme &ref) const
Public Member Functions inherited from libdar::cat_entree
| cat_entree (saved_status val)
| setup an object when read from filesystem
| cat_entree (const smart_pointer< pile_descriptor > &pdesc, bool small, saved_status val)
| setup an object when read from an archive
| cat_entree (const cat_entree &ref)=default
| cat_entree (cat_entree &&ref) noexcept=default
cat_entree & | operator= (const cat_entree &ref)=default
cat_entree & | operator= (cat_entree &&ref)=default
virtual | ~cat_entree () noexcept(false)
| destructor
bool | operator!= (const cat_entree &ref) const
bool | same_as (const cat_entree &ref) const
| return true of the two objects would generate the same entry on filsystem
void | dump (const pile_descriptor &pdesc, bool small) const
| write down the object information to a stack
void | specific_dump (const pile_descriptor &pdesc, bool small) const
| this call gives an access to inherited_dump
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
saved_status | get_saved_status () const
| obtain the saved status of the object
void | set_saved_status (saved_status x)
| modify the saved_status of the object
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

## Protected Member Functions
virtual void | inherited_dump (const pile_descriptor &pdesc, bool small) const override
| true if object has been created by sequential reading of an archive
Protected Member Functions inherited from libdar::cat_inode
virtual void | sub_compare (const cat_inode &other, bool isolated_mode, bool seq_read_mode) const
bool | get_small_read () const
Protected Member Functions inherited from libdar::cat_entree
pile * | get_pile () const
| stack used to read object from (nullptr is returned for object created from filesystem)
proto_compressor * | get_compressor_layer () const
| compressor generic_file relative methods
escape * | get_escape_layer () const
| escape generic_file relative methods
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, FSA or Data part)

## Private Member Functions
void | init () noexcept
void | recursive_update_sizes () const
void | recursive_flag_size_to_update () const
void | erase_ordered_fils (std::deque< cat_nomme * >::const_iterator debut, std::deque< cat_nomme * >::const_iterator fin)
bool | remove_all_except_mirages ()
| remove all entry of the current directory except cat_mirage or cat_directory containing cat_mirage

## Private Attributes
infinint | x_size
infinint | x_storage_size
bool | updated_sizes
cat_directory * | parent
std::deque< cat_nomme * > | ordered_fils
std::deque< cat_nomme * >::const_iterator | it
| next entry to be returned by read_children
bool | recursive_has_changed

## Static Private Attributes
static const cat_eod | fin

## Additional Inherited Members
Static Public Member Functions inherited from libdar::cat_entree
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

## Detailed Description

the cat_directory inode class

Definition at line 51 of file cat_directory.hpp.

## Member Function Documentation

## ◆ change_location()

virtual void libdar::cat_directory::change_location | ( | const smart_pointer< pile_descriptor > & | pdesc | ) |
| overridevirtual

overwrite virtual method of cat_entree to propagate the action to all entries of the directory tree

Reimplemented from libdar::cat_entree.

## ◆ clone()

virtual cat_entree * libdar::cat_directory::clone | ( |  | ) | const
| inlineoverridevirtual

a way to copy the exact type of an object even if pointed to by a parent class pointer

Implements libdar::cat_entree.

Definition at line 169 of file cat_directory.hpp.

## ◆ get_description()

virtual std::string libdar::cat_directory::get_description | ( |  | ) | const
| inlineoverridevirtual

inherited class designation

Implements libdar::cat_entree.

Definition at line 128 of file cat_directory.hpp.

## ◆ get_dir_size()

infinint libdar::cat_directory::get_dir_size | ( |  | ) | const
| inline

get the number of "cat_nomme" entry directly containted in this cat_directory (no recursive call)

Definition at line 138 of file cat_directory.hpp.

## ◆ get_parent()

cat_directory * libdar::cat_directory::get_parent | ( |  | ) | const
| inline

Definition at line 118 of file cat_directory.hpp.

## ◆ get_recursive_has_changed()

bool libdar::cat_directory::get_recursive_has_changed | ( |  | ) | const
| inline

detemine whether some data has changed since archive of reference in this cat_directory or subdirectories

Definition at line 132 of file cat_directory.hpp.

## ◆ get_size()

const infinint & libdar::cat_directory::get_size | ( |  | ) | const
| inline

Definition at line 171 of file cat_directory.hpp.

## ◆ get_storage_size()

const infinint & libdar::cat_directory::get_storage_size | ( |  | ) | const
| inline

Definition at line 172 of file cat_directory.hpp.

## ◆ has_children()

bool libdar::cat_directory::has_children | ( |  | ) | const
| inline

Definition at line 82 of file cat_directory.hpp.

## ◆ inherited_dump()

virtual void libdar::cat_directory::inherited_dump | ( | const pile_descriptor & | pdesc,
|  | bool | small ) const
| overrideprotectedvirtual

true if object has been created by sequential reading of an archive

Reimplemented from libdar::cat_inode.

## ◆ is_empty()

bool libdar::cat_directory::is_empty | ( |  | ) | const
| inline

whether this cat_directory is empty or not

Definition at line 155 of file cat_directory.hpp.

## ◆ operator==()

virtual bool libdar::cat_directory::operator== | ( | const cat_entree & | ref | ) | const
| overridevirtual

attention this compares only the directories themselves, not the list of their children

Reimplemented from libdar::cat_nomme.

## ◆ remove()

void libdar::cat_directory::remove | ( | const std::string & | name | ) |

remove the given entry from the catalogue

Note
  read_children() is taken into account by this operation, no need to call reset_read_children(), if the argument removed was the one about to be read by read_children() the one following the removed entry will be returned the next time read_children() is invoked.
  calling remove() on a directory having cat_mirage objects may lead to delete the hard linked inode from memory (stored in the pointed to cat_etoile) if a next cat_mirage referring to that inode (through the use of the same etiquette number) comes to be read, this will lead dar to report a corrupted cat_directory/catalogue in that context, rather use remove_if_no_mirage()

## ◆ remove_all_except_mirages()

bool libdar::cat_directory::remove_all_except_mirages | ( |  | ) |
| private

remove all entry of the current directory except cat_mirage or cat_directory containing cat_mirage

Returns
  true if no cat_mirage was found and all entries have been removed from the cat_directory object

Note
  this is a recursive call, remains the directory tree where are located cat_mirages objects

References remove_all_except_mirages().

Referenced by remove_all_except_mirages().

## ◆ remove_last_read()

bool libdar::cat_directory::remove_last_read | ( |  | ) |

remove last read entry of self from parent directory

Returns
  false if there was not last read entry to remove (was about to read the first entry or no entry is present)

## ◆ signature()

virtual unsigned char libdar::cat_directory::signature | ( |  | ) | const
| inlineoverridevirtual

inherited class signature

Implements libdar::cat_entree.

Definition at line 126 of file cat_directory.hpp.

## ◆ tail_to_read_children()

bool libdar::cat_directory::tail_to_read_children | ( | bool | including_last_read | ) |

remove all entry not yet read by read_children

Parameters

  [in] | including_last_read | if true also delete the last object return by read in addition to the one not yet read()

Returns
  returns true except when including_last_read was true and the current reading object could not be deleted (because the directory was empty)

## Member Data Documentation

## ◆ fin

const cat_eod libdar::cat_directory::fin
| staticprivate

Definition at line 183 of file cat_directory.hpp.

## ◆ it

std::deque<cat_nomme*>::const_iterator libdar::cat_directory::it
| mutableprivate

next entry to be returned by read_children

Definition at line 193 of file cat_directory.hpp.

## ◆ ordered_fils

std::deque<cat_nomme *> libdar::cat_directory::ordered_fils
| private

Definition at line 192 of file cat_directory.hpp.

## ◆ parent

cat_directory* libdar::cat_directory::parent
| private

Definition at line 188 of file cat_directory.hpp.

## ◆ recursive_has_changed

bool libdar::cat_directory::recursive_has_changed
| mutableprivate

Definition at line 194 of file cat_directory.hpp.

## ◆ updated_sizes

bool libdar::cat_directory::updated_sizes
| mutableprivate

Definition at line 187 of file cat_directory.hpp.

## ◆ x_size

infinint libdar::cat_directory::x_size
| mutableprivate

Definition at line 185 of file cat_directory.hpp.

## ◆ x_storage_size

infinint libdar::cat_directory::x_storage_size
| mutableprivate

Definition at line 186 of file cat_directory.hpp.

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

- cat_directory.hpp