libutil++  1.9.3
 All Classes Functions Variables
Boolean.h
1 /*
2 ** libutil++
3 ** $Id: Boolean.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__Boolean_H__
10 #define __libutilxx__sella__variant__Boolean_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 Boolean;
23  }
24 }
25 
27  public:
28  static const boost::regex & Pattern(void) { static boost::regex regex("^(?:true|false)$", boost::regex::icase); return regex; }
29  static const int Type = 0x02;
30 
31  /* Constructors */
32  Boolean() throw ();
33  Boolean(const std::string &value) throw (TypeCastException);
34  Boolean(bool value) throw ();
35 
36  Boolean(const Boolean &other) throw ();
37  virtual ~Boolean() throw ();
38 
39  /* Operators */
40  bool operator==(const Boolean &other) const throw ();
41  bool operator!=(const Boolean &other) const throw ();
42  bool operator>(const Boolean &other) const throw ();
43  bool operator<(const Boolean &other) const throw ();
44  bool operator!() throw ();
45  Boolean& operator=(const Boolean &other) throw ();
46  Boolean& operator=(bool other) throw ();
47  Boolean& operator+=(bool value) throw ();
48  Boolean& operator-=(bool value) throw ();
49  Boolean& operator*=(bool value) throw ();
50  Boolean& operator/=(bool value) throw ();
51  Boolean& operator^=(bool value) throw ();
52  Boolean& operator%=(bool value) throw ();
53  Boolean& operator&=(bool value) throw ();
54  Boolean& operator|=(bool value) throw ();
55  Boolean& operator<<=(int bits) throw ();
56  Boolean& operator>>=(int bits) throw ();
57 
58  /* Public Member Functions */
59  bool get() const throw (UnsupportedOperatorException);
60 
61  virtual void msgpack(sella::util::MessagePack &mpack, uint32_t &offset) const throw (TypeCastException);
62  virtual void msgpackBufferSize(size_t &size) const throw ();
63  virtual std::string str(int type) const throw ();
64  virtual int getType(void) throw () { return Type; }
65 
66  static bool isType(const std::string &value) throw () { return isType(value.c_str(), value.size()); }
67  static bool isType(const char *value, size_t size) throw ();
68 };
69 
70 #endif
71 
72 /*
73 ** vim: noet ts=3 sw=3
74 */