Loading...
Searching...
No Matches
archive_version.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 ARCHIVE_VERSION_HPP
#define ARCHIVE_VERSION_HPP
#include "../my_config.h"
#include <string>
#include "integers.hpp"
namespace libdar
{
// no need to dig into this from API
class generic_file;
class archive_version
{
public:
archive_version(U_16 x = 0, unsigned char fix = 0);
archive_version(const archive_version & ref) = default;
archive_version(archive_version && ref) noexcept = default;
archive_version & operator = (const archive_version & ref) = default;
archive_version & operator = (archive_version && ref) noexcept = default;
~archive_version() = default;
bool operator < (const archive_version & ref) const { return value() < ref.value(); };
bool operator >= (const archive_version & ref) const { return value() >= ref.value(); };
bool operator == (const archive_version & ref) const { return value() == ref.value(); };
bool operator != (const archive_version & ref) const { return value() != ref.value(); };
bool operator > (const archive_version & ref) const { return value() > ref.value(); };
bool operator <= (const archive_version & ref) const { return value() <= ref.value(); };
void dump(generic_file & f) const;
void read(generic_file & f);
std::string display() const;
private:
U_16 version;
unsigned char fix;
U_I value() const { return (U_I)(version)*256 + fix; };
static unsigned char to_digit(unsigned char val);
static unsigned char to_char(unsigned char val);
};
extern const archive_version empty_archive_version();
} // end of namespace
#endif
libdar::archive_version
class archive_version manages the version of the archive format
Definition archive_version.hpp:47
libdar::archive_version::display
std::string display() const
provides the version information as a human readable string
libdar::archive_version::archive_version
archive_version(U_16 x=0, unsigned char fix=0)
archive_version constructor
libdar::generic_file
this is the interface class from which all other data transfer classes inherit
Definition generic_file.hpp:77
integers.hpp
are defined here basic integer types that tend to be portable
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