Disk ARchive  2.7.14
Full featured and portable backup and archiving tool
cat_detruit.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 CAT_DETRUIT_HPP
27 #define CAT_DETRUIT_HPP
28 
29 #include "../my_config.h"
30 
31 extern "C"
32 {
33 } // end extern "C"
34 
35 #include "cat_nomme.hpp"
36 #include "datetime.hpp"
37 #include "archive_version.hpp"
38 
39 namespace libdar
40 {
41 
44 
45 
47 
48  class cat_detruit : public cat_nomme
49  {
50  public :
51  cat_detruit(const std::string & name, unsigned char firm, const datetime & date) : cat_nomme(name, saved_status::saved) , del_date(date) { signe = firm; };
52  cat_detruit(const smart_pointer<pile_descriptor> & pdesc, const archive_version & reading_ver, bool small);
53  cat_detruit(const cat_nomme & ref): cat_nomme(ref), del_date(0) { signe = ref.signature(); };
54  cat_detruit(const cat_detruit & ref) = default;
55  cat_detruit(cat_detruit && ref) noexcept = default;
56  cat_detruit & operator = (const cat_detruit & ref) = default;
57  cat_detruit & operator = (cat_detruit && ref) noexcept = default;
58  ~cat_detruit() = default;
59 
60  virtual bool operator == (const cat_entree & ref) const override;
61 
62  unsigned char get_signature() const { return signe; };
63  void set_signature(unsigned char x) { signe = x; };
64 
65  const datetime & get_date() const { return del_date; };
66  void set_date(const datetime & ref) { del_date = ref; };
67 
69  virtual unsigned char signature() const override { return 'x'; };
70 
72  virtual std::string get_description() const override { return "deleted file"; };
73 
75  virtual cat_entree *clone() const override { return new (std::nothrow) cat_detruit(*this); };
76 
77  protected:
78  virtual void inherited_dump(const pile_descriptor & pdesc, bool small) const override;
79 
80  private :
81  unsigned char signe;
82  datetime del_date;
83  };
84 
86 
87 } // end of namespace
88 
89 #endif
class archive_version that rules which archive format to follow
base class of all objects contained in a catalogue and that can be named
class archive_version manages the version of the archive format
the deleted file entry
Definition: cat_detruit.hpp:49
virtual cat_entree * clone() const override
inherited from cat_entree
Definition: cat_detruit.hpp:75
virtual bool operator==(const cat_entree &ref) const override
returns true if the two object are the same
virtual std::string get_description() const override
inherited from cat_entree
Definition: cat_detruit.hpp:72
virtual void inherited_dump(const pile_descriptor &pdesc, bool small) const override
inherited class may overload this method but shall first call the parent's inherited_dump() in the ov...
virtual unsigned char signature() const override
inherited from cat_entree
Definition: cat_detruit.hpp:69
the root class from all other inherite for any entry in the catalogue
Definition: cat_entree.hpp:60
virtual unsigned char signature() const =0
inherited class signature
the base class for all entry that have a name
Definition: cat_nomme.hpp:45
stores time information
Definition: datetime.hpp:59
this file contains the definition of class datetime that stores unix times in a portable way
@ saved
inode is saved in the archive
libdar namespace encapsulate all libdar symbols
Definition: archive.hpp:47