drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
temporal_format.h
Go to the documentation of this file.
1
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
*
4
* Copyright (C) 2008 Sun Microsystems, Inc.
5
*
6
* Authors:
7
*
8
* Jay Pipes <
[email protected]
>
9
*
10
* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version.
14
*
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU General Public License for more details.
19
*
20
* You should have received a copy of the GNU General Public License
21
* along with this program; if not, write to the Free Software
22
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23
*/
24
30
31
#pragma once
32
33
#include <drizzled/common_fwd.h>
34
#include <drizzled/pcre.h>
35
36
namespace
drizzled
{
37
38
class
TemporalFormat
39
{
40
protected
:
41
const
char
*
_pattern
;
42
pcre2_code *
_re
;
43
PCRE2_SIZE
_error_offset
;
44
int32_t _error;
45
/* Index of the pattern which is a specific temporal part */
46
uint32_t _year_part_index;
47
uint32_t _month_part_index;
48
uint32_t _day_part_index;
49
uint32_t _hour_part_index;
50
uint32_t _minute_part_index;
51
uint32_t _second_part_index;
52
uint32_t _usecond_part_index;
53
uint32_t _nsecond_part_index;
54
public
:
61
TemporalFormat
(
const
char
*pattern);
62
63
~TemporalFormat
();
64
69
inline
bool
is_valid
()
const
{
return
_re
!= NULL;}
75
inline
void
set_year_part_index
(int32_t index) {_year_part_index= ((index - 1) * 2) + 2;}
81
inline
void
set_month_part_index
(int32_t index) {_month_part_index= ((index - 1) * 2) + 2;}
87
inline
void
set_day_part_index
(int32_t index) {_day_part_index= ((index - 1) * 2) + 2;}
93
inline
void
set_hour_part_index
(int32_t index) {_hour_part_index= ((index - 1) * 2) + 2;}
99
inline
void
set_minute_part_index
(int32_t index) {_minute_part_index= ((index - 1) * 2) + 2;}
105
inline
void
set_second_part_index
(int32_t index) {_second_part_index= ((index - 1) * 2) + 2;}
111
inline
void
set_usecond_part_index
(int32_t index) {_usecond_part_index= ((index - 1) * 2) + 2;}
117
inline
void
set_nsecond_part_index
(int32_t index) {_nsecond_part_index= ((index - 1) * 2) + 2;}
126
bool
matches
(
const
char
*data,
size_t
data_len,
Temporal
*to);
127
};
128
129
141
bool
init_temporal_formats
();
145
void
deinit_temporal_formats
();
146
147
}
/* end namespace drizzled */
drizzled::TemporalFormat::set_year_part_index
void set_year_part_index(int32_t index)
Definition
temporal_format.h:75
drizzled::TemporalFormat::is_valid
bool is_valid() const
Definition
temporal_format.h:69
drizzled::TemporalFormat::TemporalFormat
TemporalFormat(const char *pattern)
Definition
temporal_format.cc:45
drizzled::TemporalFormat::set_usecond_part_index
void set_usecond_part_index(int32_t index)
Definition
temporal_format.h:111
drizzled::TemporalFormat::set_hour_part_index
void set_hour_part_index(int32_t index)
Definition
temporal_format.h:93
drizzled::TemporalFormat::set_day_part_index
void set_day_part_index(int32_t index)
Definition
temporal_format.h:87
drizzled::TemporalFormat::set_minute_part_index
void set_minute_part_index(int32_t index)
Definition
temporal_format.h:99
drizzled::TemporalFormat::matches
bool matches(const char *data, size_t data_len, Temporal *to)
Definition
temporal_format.cc:73
drizzled::TemporalFormat::_pattern
const char * _pattern
Definition
temporal_format.h:41
drizzled::TemporalFormat::_error_offset
PCRE2_SIZE _error_offset
Definition
temporal_format.h:43
drizzled::TemporalFormat::set_nsecond_part_index
void set_nsecond_part_index(int32_t index)
Definition
temporal_format.h:117
drizzled::TemporalFormat::set_month_part_index
void set_month_part_index(int32_t index)
Definition
temporal_format.h:81
drizzled::TemporalFormat::_re
pcre2_code * _re
Definition
temporal_format.h:42
drizzled::TemporalFormat::set_second_part_index
void set_second_part_index(int32_t index)
Definition
temporal_format.h:105
drizzled::Temporal
Definition
temporal.h:80
drizzled
TODO: Rename this file - func.h is stupid.
Definition
abort_exception.h:27
drizzled::init_temporal_formats
bool init_temporal_formats()
Definition
temporal_format.cc:271
drizzled::deinit_temporal_formats
void deinit_temporal_formats()
Definition
temporal_format.cc:310
← Back to Drizzle docs
drizzled
temporal_format.h
Generated by
1.15.0