Disk ARchive  2.7.14
Full featured and portable backup and archiving tool
cat_nomme.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_NOMME_HPP
27 #define CAT_NOMME_HPP
28 
29 #include "../my_config.h"
30 
31 extern "C"
32 {
33 } // end extern "C"
34 
35 #include <string>
36 #include "cat_entree.hpp"
37 
38 namespace libdar
39 {
42 
44  class cat_nomme : public cat_entree
45  {
46  public:
47  cat_nomme(const std::string & name, saved_status arg): cat_entree(arg) { xname = name; };
48  cat_nomme(const smart_pointer<pile_descriptor> & pdesc, bool small, saved_status val);
49  cat_nomme(const cat_nomme & ref) = default;
50  cat_nomme(cat_nomme && ref) noexcept = default;
51  cat_nomme & operator = (const cat_nomme & ref) = default;
52  cat_nomme & operator = (cat_nomme && ref) noexcept = default;
53  virtual ~cat_nomme() = default;
54 
55  virtual bool operator == (const cat_entree & ref) const override;
56  virtual bool operator < (const cat_nomme & ref) const { return xname < ref.xname; };
57  const std::string & get_name() const { return xname; };
58  void change_name(const std::string & x) { xname = x; };
59 
63  bool same_as(const cat_nomme & ref) const { return cat_entree::same_as(ref) && xname == ref.xname; };
64 
65  // signature() is kept as an abstract method
66  // clone() is also ketp abstract
67 
68  protected:
69  virtual void inherited_dump(const pile_descriptor & pdesc, bool small) const override;
70 
71  private:
72  std::string xname;
73 
74  };
75 
77 
78 } // end of namespace
79 
80 #endif
base class for all object contained in a catalogue
the root class from all other inherite for any entry in the catalogue
Definition: cat_entree.hpp:60
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
cat_entree(saved_status val)
setup an object when read from filesystem
Definition: cat_entree.hpp:84
the base class for all entry that have a name
Definition: cat_nomme.hpp:45
virtual bool operator==(const cat_entree &ref) const override
returns true if the two object are the same
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...
bool same_as(const cat_nomme &ref) const
Definition: cat_nomme.hpp:63
saved_status
data saved status for an entry
Definition: cat_status.hpp:45
libdar namespace encapsulate all libdar symbols
Definition: archive.hpp:47