Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00031 #pragma once
00032
00033 #include <drizzled/common_fwd.h>
00034
00035 #include PCRE_HEADER
00036
00037
00038 #define OUT_VECTOR_SIZE 30
00039
00040 namespace drizzled {
00041
00042 class TemporalFormat
00043 {
00044 protected:
00045 const char *_pattern;
00046 pcre *_re;
00047 int32_t _error_offset;
00048 const char *_error;
00049
00050 uint32_t _year_part_index;
00051 uint32_t _month_part_index;
00052 uint32_t _day_part_index;
00053 uint32_t _hour_part_index;
00054 uint32_t _minute_part_index;
00055 uint32_t _second_part_index;
00056 uint32_t _usecond_part_index;
00057 uint32_t _nsecond_part_index;
00058 public:
00065 TemporalFormat(const char *pattern);
00066
00067 ~TemporalFormat();
00068
00073 inline bool is_valid() const {return _re && (_error == NULL);}
00079 inline void set_year_part_index(int32_t index) {_year_part_index= ((index - 1) * 2) + 2;}
00085 inline void set_month_part_index(int32_t index) {_month_part_index= ((index - 1) * 2) + 2;}
00091 inline void set_day_part_index(int32_t index) {_day_part_index= ((index - 1) * 2) + 2;}
00097 inline void set_hour_part_index(int32_t index) {_hour_part_index= ((index - 1) * 2) + 2;}
00103 inline void set_minute_part_index(int32_t index) {_minute_part_index= ((index - 1) * 2) + 2;}
00109 inline void set_second_part_index(int32_t index) {_second_part_index= ((index - 1) * 2) + 2;}
00115 inline void set_usecond_part_index(int32_t index) {_usecond_part_index= ((index - 1) * 2) + 2;}
00121 inline void set_nsecond_part_index(int32_t index) {_nsecond_part_index= ((index - 1) * 2) + 2;}
00130 bool matches(const char *data, size_t data_len, Temporal *to);
00131 };
00132
00133
00145 bool init_temporal_formats();
00149 void deinit_temporal_formats();
00150
00151 }
00152