Disk ARchive  2.4.12
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
deci.hpp
Go to the documentation of this file.
1 /*********************************************************************/
2 // dar - disk archive - a backup/restoration program
3 // Copyright (C) 2002-2052 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 "storage.hpp"
32 #include "infinint.hpp"
33 
34 namespace libdar
35 {
36 
39 
40 
42 
49  class deci
50  {
51  public :
53  deci(std::string s);
54 
56  deci(const infinint & x);
57 
59  deci(const deci & ref)
60  { copy_from(ref); };
61 
64  { detruit(); };
65 
66 
68  const deci & operator = (const deci & ref)
69  { detruit(); copy_from(ref); return *this; };
70 
72  infinint computer() const;
74  std::string human() const;
75 
76 #ifdef LIBDAR_SPECIAL_ALLOC
77  USE_SPECIAL_ALLOC(deci);
78 #endif
79 
80  private :
81  storage *decimales;
82 
83  void detruit();
84  void copy_from(const deci & ref);
85  void reduce();
86  };
87 
89 
94  extern std::ostream & operator << (std::ostream & ref, const infinint & arg);
95 
96 
98 
99 } // end of namespace
100 
101 #endif
std::ostream & operator<<(std::ostream &ref, const infinint &arg)
specific << operator to use infinint in std::ostream
decimal class, convert infinint from and to decimal represention
Definition: deci.hpp:49
the deleted file entry
Definition: catalogue.hpp:906
const deci & operator=(const deci &ref)
copy operator
Definition: deci.hpp:68
contains a class that permits arbitrary large data storage
deci(const deci &ref)
copy constructor
Definition: deci.hpp:59
infinint computer() const
this produce a infinint from the decimal stored in the current object
deci(std::string s)
constructor to build a "deci" object from a string representing decimals
~deci()
destructor
Definition: deci.hpp:63
arbitrary large storage structure
Definition: storage.hpp:57
switch module to limitint (32 ou 64 bits integers) or infinint
the arbitrary large positive integer class
std::string human() const
this produce a string fromr the decimal stored in the current object