~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/temporal_interval.h

  • Committer: Jay Pipes
  • Date: 2009-09-15 21:01:42 UTC
  • mto: (1126.2.5 merge)
  • mto: This revision was merged to the branch mainline in revision 1128.
  • Revision ID: jpipes@serialcoder-20090915210142-x8mwiqn1q0vzjspp
Moves Alter_info out into its own header and source file, cleans up some related include mess in sql_lex.h, and renames Alter_info to AlterInfo.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2009 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2009 Sun Microsystems
5
5
 *
6
6
 *  Authors: 
7
7
 *
20
20
 *  along with this program; if not, write to the Free Software
21
21
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
22
22
 */
23
 
 
24
 
#ifndef DRIZZLED_TEMPORAL_INTERVAL_H
25
 
#define DRIZZLED_TEMPORAL_INTERVAL_H
26
 
 
27
 
/* @TODO Replace this include with some forward decls */
28
23
#include <drizzled/item.h>
29
 
#include <drizzled/type/time.h>
30
24
 
31
25
namespace drizzled 
32
26
{
40
34
public:
41
35
 
42
36
  TemporalInterval(uint32_t in_year,
43
 
                   uint32_t in_month,
44
 
                   uint32_t in_day,
45
 
                   uint32_t in_hour,
46
 
                   uint64_t in_minute,
47
 
                   uint64_t in_second,
48
 
                   uint64_t in_second_part,
49
 
                   bool in_neg) :
50
 
    year(in_year),
51
 
    month(in_month),
52
 
    day(in_day),
53
 
    hour(in_hour),
54
 
    minute(in_minute),
55
 
    second(in_second),
56
 
    second_part(in_second_part),
57
 
    neg(in_neg)
 
37
      uint32_t in_month,
 
38
      uint32_t in_day,
 
39
      uint32_t in_hour,
 
40
      uint64_t in_minute,
 
41
      uint64_t in_second,
 
42
      uint64_t in_second_part,
 
43
      bool in_neg)
 
44
    :
 
45
      year(in_year),
 
46
      month(in_month),
 
47
      day(in_day),
 
48
      hour(in_hour),
 
49
      minute(in_minute),
 
50
      second(in_second),
 
51
      second_part(in_second_part),
 
52
      neg(in_neg)
58
53
  {}
59
54
 
60
 
  TemporalInterval() :
61
 
    year(0),
62
 
    month(0),
63
 
    day(0),
64
 
    hour(0),
65
 
    minute(0),
66
 
    second(0),
67
 
    second_part(0),
68
 
    neg(false)
 
55
  TemporalInterval()
 
56
    :
 
57
      year(0),
 
58
      month(0),
 
59
      day(0),
 
60
      hour(0),
 
61
      minute(0),
 
62
      second(0),
 
63
      second_part(0),
 
64
      neg(false)
69
65
  {}
70
66
 
71
67
  /**
72
68
   * Sets whether or not this object specifies a negative interval
73
69
   * @param[in] in_neg true if this is a negative interval, false if not
74
70
   */
75
 
  inline void setNegative(bool in_neg= true)
 
71
  void setNegative(bool in_neg= true)
76
72
  {
77
73
    neg= in_neg;
78
74
  }
80
76
  /**
81
77
   * reverse boolean value of the negative flag
82
78
   */
83
 
  inline void toggleNegative()
 
79
  void toggleNegative()
84
80
  {
85
81
    neg= !neg;
86
82
  }
89
85
   * @retval true this is a negative temporal interval
90
86
   * @retval false this is a positive temporal interval
91
87
   */
92
 
  inline bool getNegative() const
 
88
  bool getNegative() const
93
89
  {
94
90
    return neg;
95
91
  }
96
92
 
97
 
  inline uint32_t  get_year() { return year; }
98
 
  inline void set_year(uint32_t new_year) { year = new_year; }
99
 
 
100
 
  inline uint32_t  get_month(){ return month; }
101
 
  inline void set_month(uint32_t new_month) { month = new_month; }
102
 
 
103
 
  inline uint32_t  get_day(){ return day; }
104
 
  inline void set_day(uint32_t new_day) { day = new_day; }
105
 
 
106
 
  inline uint32_t  get_hour(){ return hour; }
107
 
  inline void set_hour(uint32_t new_hour) { hour = new_hour; }
108
 
 
109
 
  inline uint64_t  get_minute(){ return minute; }
110
 
  inline void set_minute(uint32_t new_minute) { minute = new_minute; }
111
 
 
112
 
  inline uint64_t  get_second(){ return second; }
113
 
  inline void set_second(uint32_t new_second) { second = new_second; }
114
 
 
115
 
  inline uint64_t  get_second_part(){ return second_part; }
116
 
  inline void set_second_part(uint32_t new_second_part) { second_part = new_second_part; }
117
 
 
118
93
  /**
119
94
   * Populate this TemporalInterval from a string value
120
95
   *
136
111
   * @retval true date was added and value stored properly
137
112
   * @retval false result of addition is a null value
138
113
   */
139
 
  bool addDate(type::Time *ltime, interval_type int_type);
 
114
  bool addDate(DRIZZLE_TIME *ltime, interval_type int_type);
140
115
 
141
116
private:
142
117
 
196
171
 
197
172
};
198
173
 
199
 
} /* namespace drizzled */
200
 
 
201
 
#endif /* DRIZZLED_TEMPORAL_INTERVAL_H */
 
174
} /* end namespace drizzled */