deci.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 DECI_HPP
#define DECI_HPP
#include "../my_config.h"
#include <iostream>
#include <string>
#include "storage.hpp"
#include "infinint.hpp"
namespace libdar
{
class deci
{
public :
deci(std::string s);
deci(const infinint & x);
deci(const deci & ref) { copy_from(ref); };
deci(deci && ref) noexcept { decimales = nullptr; std::swap(decimales, ref.decimales); };
deci & operator = (const deci & ref) { detruit(); copy_from(ref); return *this; };
deci & operator = (deci && ref) noexcept { std::swap(decimales, ref.decimales); return *this; };
~deci() { detruit(); };
infinint computer() const;
std::string human() const;
private :
storage *decimales;
void detruit();
void copy_from(const deci & ref);
void reduce();
};
extern std::ostream & operator << (std::ostream & ref, const infinint & arg);
} // end of namespace
#endif
libdar::deci
decimal class, convert infinint from and to decimal represention
Definition: deci.hpp:51
libdar::deci::deci
deci(std::string s)
libdar::deci::human
std::string human() const
this produce a string from the decimal stored in the current object
libdar::deci::deci
deci(const infinint &x)
constructor to build a "deci" from an infinint
libdar::deci::deci
deci(const deci &ref)
copy constructor
Definition: deci.hpp:62
libdar::deci::deci
deci(deci &&ref) noexcept
move constructor
Definition: deci.hpp:65
libdar::deci::operator=
deci & operator=(const deci &ref)
assignment operator
Definition: deci.hpp:68
libdar::deci::~deci
~deci()
destructor
Definition: deci.hpp:74
libdar::deci::computer
infinint computer() const
this produce a infinint from the decimal stored in the current object
libdar::infinint
the arbitrary large positive integer class
Definition: real_infinint.hpp:62
libdar::storage
arbitrary large storage structure
Definition: storage.hpp:53
libdar::operator<<
std::ostream & operator<<(std::ostream &ref, const infinint &arg)
specific << operator to use infinint in std::ostream
infinint.hpp
switch module to limitint (32 ou 64 bits integers) or infinint
libdar
libdar namespace encapsulate all libdar symbols
Definition: archive.hpp:47
storage.hpp
contains a class that permits arbitrary large data storage