cat_nomme.hpp
Go to the documentation of this file.
/*********************************************************************/
// dar - disk archive - a backup/restoration program
// Copyright (C) 2002-2023 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_NOMME_HPP
#define CAT_NOMME_HPP
#include "../my_config.h"
extern "C"
{
} // end extern "C"
#include <string>
#include "cat_entree.hpp"
namespace libdar
{
class cat_nomme : public cat_entree
{
public:
cat_nomme(const std::string & name, saved_status arg): cat_entree(arg) { xname = name; };
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) noexcept = default;
virtual ~cat_nomme() = default;
virtual bool operator == (const cat_entree & ref) const override;
virtual bool operator < (const cat_nomme & ref) const { return xname < ref.xname; };
const std::string & get_name() const { return xname; };
void change_name(const std::string & x) { xname = x; };
bool same_as(const cat_nomme & ref) const { return cat_entree::same_as(ref) && xname == ref.xname; };
// signature() is kept as an abstract method
// clone() is also ketp abstract
protected:
virtual void inherited_dump(const pile_descriptor & pdesc, bool small) const override;
private:
std::string xname;
};
} // end of namespace
#endif
cat_entree.hpp
base class for all object contained in a catalogue
libdar::cat_entree
the root class from all other inherite for any entry in the catalogue
Definition: cat_entree.hpp:60
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::cat_entree
cat_entree(saved_status val)
setup an object when read from filesystem
Definition: cat_entree.hpp:84
libdar::cat_nomme
the base class for all entry that have a name
Definition: cat_nomme.hpp:45
libdar::cat_nomme::operator==
virtual bool operator==(const cat_entree &ref) const override
returns true if the two object are the same
libdar::cat_nomme::inherited_dump
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...
libdar::cat_nomme::same_as
bool same_as(const cat_nomme &ref) const
Definition: cat_nomme.hpp:63
libdar::smart_pointer< pile_descriptor >
libdar::saved_status
saved_status
data saved status for an entry
Definition: cat_status.hpp:45
libdar
libdar namespace encapsulate all libdar symbols
Definition: archive.hpp:47