Disk ARchive  2.4.8
 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