Disk ARchive 2.7.16
Full featured and portable backup and archiving tool
Loading...
Searching...
No Matches
deci.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 DECI_HPP
27#define DECI_HPP
28
29#include "../my_config.h"
30#include <iostream>
31#include <string>
32#include "storage.hpp"
33#include "infinint.hpp"
34
35namespace libdar
36{
37
40
41
43
50 class deci
51 {
52 public :
56 deci(std::string s);
57
59 deci(const infinint & x);
60
62 deci(const deci & ref) { copy_from(ref); };
63
65 deci(deci && ref) noexcept { decimales = nullptr; std::swap(decimales, ref.decimales); };
66
68 deci & operator = (const deci & ref) { detruit(); copy_from(ref); return *this; };
69
71 deci & operator = (deci && ref) noexcept { std::swap(decimales, ref.decimales); return *this; };
72
74 ~deci() { detruit(); };
75
76
79
81 std::string human() const;
82
83 private :
84 storage *decimales;
85
86 void detruit();
87 void copy_from(const deci & ref);
88 void reduce();
89 };
90
92
96 extern std::ostream & operator << (std::ostream & ref, const infinint & arg);
97
99
100} // end of namespace
101
102#endif
decimal class, convert infinint from and to decimal represention
Definition deci.hpp:51
deci(std::string s)
std::string human() const
this produce a string from the decimal stored in the current object
deci(const infinint &x)
constructor to build a "deci" from an infinint
deci(const deci &ref)
copy constructor
Definition deci.hpp:62
deci(deci &&ref) noexcept
move constructor
Definition deci.hpp:65
deci & operator=(const deci &ref)
assignment operator
Definition deci.hpp:68
~deci()
destructor
Definition deci.hpp:74
infinint computer() const
this produce a infinint from the decimal stored in the current object
the arbitrary large positive integer class
arbitrary large storage structure
Definition storage.hpp:53
std::ostream & operator<<(std::ostream &ref, const infinint &arg)
specific << operator to use infinint in std::ostream
switch module to limitint (32 ou 64 bits integers) or infinint
include macro defined by the configure script and some specific additional ones
libdar namespace encapsulate all libdar symbols
Definition archive.hpp:47
contains a class that permits arbitrary large data storage