libutil++  1.9.3
 All Classes Functions Variables
Double.h
1 /*
2 ** libutil++
3 ** $Id: Double.h 1702 2016-08-13 23:26:06Z sella $
4 ** Copyright (c) 2011-2016 Digital Genesis, LLC. All Rights Reserved.
5 ** Released under the LGPL Version 2.1 License.
6 ** http://www.digitalgenesis.com
7 */
8 
9 #ifndef __libutilxx__sella__variant__Double_H__
10 #define __libutilxx__sella__variant__Double_H__
11 
12 #include "../../common.h"
13 #include "TypeCastException.h"
14 #include "Nullable.h"
15 
16 #include <memory>
17 
18 #include <boost/regex.hpp>
19 
20 namespace sella {
21  namespace variant {
22  class Double;
23  }
24 }
25 
26 /* FIXME: Should convert this to a long double (12 bytes on 32bit, 16 bytes on 64bit) */
27 
29  public:
30  static const boost::regex & Pattern(void) { static boost::regex regex("^-?[0-9]*\\.[0-9]+$"); return regex; }
31  static const int Type = 0x05;
32 
33  /* Constructors */
34  Double() throw ();
35  Double(const std::string &value) throw (TypeCastException);
36  Double(double value) throw ();
37 
38  Double(const Double &other) throw ();
39  virtual ~Double() throw ();
40 
41  /* Operators */
42  bool operator==(const Double &other) const throw ();
43  bool operator!=(const Double &other) const throw ();
44  bool operator>(const Double &other) const throw ();
45  bool operator<(const Double &other) const throw ();
46  bool operator!() throw ();
47  Double& operator=(const Double &other) throw ();
48  Double& operator=(double other) throw ();
49  Double& operator++() throw ();
50  Double& operator--() throw ();
51  Double& operator+=(double value) throw ();
52  Double& operator-=(double value) throw ();
53  Double& operator*=(double value) throw ();
54  Double& operator/=(double value) throw ();
55  Double& operator^=(double value) throw ();
56 
57  /* Public Member Functions */
58  double get() const throw (UnsupportedOperatorException);
59 
60  virtual void msgpack(sella::util::MessagePack &mpack, uint32_t &offset) const throw (TypeCastException);
61  virtual void msgpackBufferSize(size_t &size) const throw ();
62  virtual std::string str(int type) const throw ();
63  virtual int getType(void) throw () { return Type; }
64 
65  static bool isType(const std::string &value) throw () { return isType(value.c_str(), value.size()); }
66  static bool isType(const char *value, size_t size) throw ();
67 };
68 
69 #endif
70 
71 /*
72 ** vim: noet ts=3 sw=3
73 */