~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/temporal_interval.h

mergeĀ lp:~hingo/drizzle/drizzle-auth_ldap-fix-and-docs

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
 
4
 *  Copyright (C) 2009 Sun Microsystems, Inc.
5
5
 *
6
6
 *  Authors: 
7
7
 *
21
21
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
22
22
 */
23
23
 
24
 
#ifndef DRIZZLED_TEMPORAL_INTERVAL_H
25
 
#define DRIZZLED_TEMPORAL_INTERVAL_H
 
24
#pragma once
26
25
 
27
26
/* @TODO Replace this include with some forward decls */
28
 
#include "drizzled/item.h"
 
27
#include <drizzled/item.h>
 
28
#include <drizzled/type/time.h>
29
29
 
30
 
namespace drizzled 
31
 
{
 
30
namespace drizzled {
32
31
 
33
32
/**
34
33
 * @brief
39
38
public:
40
39
 
41
40
  TemporalInterval(uint32_t in_year,
42
 
      uint32_t in_month,
43
 
      uint32_t in_day,
44
 
      uint32_t in_hour,
45
 
      uint64_t in_minute,
46
 
      uint64_t in_second,
47
 
      uint64_t in_second_part,
48
 
      bool in_neg)
49
 
    :
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)
 
41
                   uint32_t in_month,
 
42
                   uint32_t in_day,
 
43
                   uint32_t in_hour,
 
44
                   uint64_t in_minute,
 
45
                   uint64_t in_second,
 
46
                   uint64_t in_second_part,
 
47
                   bool in_neg) :
 
48
    year(in_year),
 
49
    month(in_month),
 
50
    day(in_day),
 
51
    hour(in_hour),
 
52
    minute(in_minute),
 
53
    second(in_second),
 
54
    second_part(in_second_part),
 
55
    neg(in_neg)
58
56
  {}
59
57
 
60
 
  TemporalInterval()
61
 
    :
62
 
      year(0),
63
 
      month(0),
64
 
      day(0),
65
 
      hour(0),
66
 
      minute(0),
67
 
      second(0),
68
 
      second_part(0),
69
 
      neg(false)
 
58
  TemporalInterval() :
 
59
    year(0),
 
60
    month(0),
 
61
    day(0),
 
62
    hour(0),
 
63
    minute(0),
 
64
    second(0),
 
65
    second_part(0),
 
66
    neg(false)
70
67
  {}
71
68
 
72
69
  /**
95
92
    return neg;
96
93
  }
97
94
 
98
 
  inline uint32_t  get_year() { return year; }
 
95
  inline uint32_t  get_year() const { return year; }
99
96
  inline void set_year(uint32_t new_year) { year = new_year; }
100
97
 
101
 
  inline uint32_t  get_month(){ return month; }
 
98
  inline uint32_t  get_month() const { return month; }
102
99
  inline void set_month(uint32_t new_month) { month = new_month; }
103
100
 
104
 
  inline uint32_t  get_day(){ return day; }
 
101
  inline uint32_t  get_day() const { return day; }
105
102
  inline void set_day(uint32_t new_day) { day = new_day; }
106
103
 
107
 
  inline uint32_t  get_hour(){ return hour; }
 
104
  inline uint32_t  get_hour() const { return hour; }
108
105
  inline void set_hour(uint32_t new_hour) { hour = new_hour; }
109
106
 
110
 
  inline uint64_t  get_minute(){ return minute; }
 
107
  inline uint64_t  get_minute() const { return minute; }
111
108
  inline void set_minute(uint32_t new_minute) { minute = new_minute; }
112
109
 
113
 
  inline uint64_t  get_second(){ return second; }
 
110
  inline uint64_t  get_second() const { return second; }
114
111
  inline void set_second(uint32_t new_second) { second = new_second; }
115
112
 
116
 
  inline uint64_t  get_second_part(){ return second_part; }
 
113
  inline uint64_t  get_second_part() const { return second_part; }
117
114
  inline void set_second_part(uint32_t new_second_part) { second_part = new_second_part; }
118
115
 
119
116
  /**
137
134
   * @retval true date was added and value stored properly
138
135
   * @retval false result of addition is a null value
139
136
   */
140
 
  bool addDate(DRIZZLE_TIME *ltime, interval_type int_type);
 
137
  bool addDate(type::Time *ltime, interval_type int_type);
141
138
 
142
139
private:
143
140
 
181
178
   */
182
179
  bool getIntervalFromString(const char *str,
183
180
                             uint32_t length, 
184
 
                             const CHARSET_INFO * const cs,
 
181
                             const charset_info_st * const cs,
185
182
                             uint32_t count, 
186
183
                             uint64_t *values,
187
184
                             bool transform_msec);
199
196
 
200
197
} /* namespace drizzled */
201
198
 
202
 
#endif /* DRIZZLED_TEMPORAL_INTERVAL_H */