| Disk ARchive 2.6.12 Full featured and portable backup and archiving tool

deci.hpp
Go to the documentation of this file.
1 /*********************************************************************/
2 // dar - disk archive - a backup/restoration program
3 // Copyright (C) 2002-2020 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 : http://dar.linux.free.fr/email.html
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
35 namespace 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
78 infinint computer() const;
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
libdar::deci::operator=
deci & operator=(const deci &ref)
assignment operator
Definition: deci.hpp:68
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::infinint
the arbitrary large positive integer class
Definition: real_infinint.hpp:62
libdar::storage
arbitrary large storage structure
Definition: storage.hpp:53
libdar::deci::deci
deci(const deci &ref)
copy constructor
Definition: deci.hpp:62
libdar::deci::computer
infinint computer() const
this produce a infinint from the decimal stored in the current object
libdar::deci
decimal class, convert infinint from and to decimal represention
Definition: deci.hpp:51
libdar::deci::~deci
~deci()
destructor
Definition: deci.hpp:74
libdar::deci::deci
deci(deci &&ref) noexcept
move constructor
Definition: deci.hpp:65
libdar::deci::human
std::string human() const
this produce a string from the decimal stored in the current object
storage.hpp
contains a class that permits arbitrary large data storage
libdar::deci::deci
deci(const infinint &x)
constructor to build a "deci" from an infinint
libdar::deci::deci
deci(std::string s)
libdar
libdar namespace encapsulate all libdar symbols
Definition: archive.hpp:47