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 PCRE_HEADER
00034
00035
00036 #define OUT_VECTOR_SIZE 30
00037
00038 namespace drizzled
00039 {
00040
00041
00042 class Temporal;
00043
00044 class TemporalFormat
00045 {
00046 protected:
00047 const char *_pattern;
00048 pcre *_re;
00049 int32_t _error_offset;
00050 const char *_error;
00051
00052 uint32_t _year_part_index;
00053 uint32_t _month_part_index;
00054 uint32_t _day_part_index;
00055 uint32_t _hour_part_index;
00056 uint32_t _minute_part_index;
00057 uint32_t _second_part_index;
00058 uint32_t _usecond_part_index;
00059 uint32_t _nsecond_part_index;
00060 public:
00067 TemporalFormat(const char *pattern);
00072 inline bool is_valid() const {return _re && (_error == NULL);}
00078 inline void set_year_part_index(int32_t index) {_year_part_index= ((index - 1) * 2) + 2;}
00084 inline void set_month_part_index(int32_t index) {_month_part_index= ((index - 1) * 2) + 2;}
00090 inline void set_day_part_index(int32_t index) {_day_part_index= ((index - 1) * 2) + 2;}
00096 inline void set_hour_part_index(int32_t index) {_hour_part_index= ((index - 1) * 2) + 2;}
00102 inline void set_minute_part_index(int32_t index) {_minute_part_index= ((index - 1) * 2) + 2;}
00108 inline void set_second_part_index(int32_t index) {_second_part_index= ((index - 1) * 2) + 2;}
00114 inline void set_usecond_part_index(int32_t index) {_usecond_part_index= ((index - 1) * 2) + 2;}
00120 inline void set_nsecond_part_index(int32_t index) {_nsecond_part_index= ((index - 1) * 2) + 2;}
00129 bool matches(const char *data, size_t data_len, Temporal *to);
00130 };
00131
00132
00144 bool init_temporal_formats();
00148 void deinit_temporal_formats();
00149
00150 }
00151