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