1 | /* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. |
2 | |
3 | This program is free software; you can redistribute it and/or modify |
4 | it under the terms of the GNU General Public License as published by |
5 | the Free Software Foundation; version 2 of the License. |
6 | |
7 | This program is distributed in the hope that it will be useful, |
8 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
9 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
10 | GNU General Public License for more details. |
11 | |
12 | You should have received a copy of the GNU General Public License |
13 | along with this program; if not, write to the Free Software |
14 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ |
15 | |
16 | #ifndef SQL_LOCALE_INCLUDED |
17 | #define SQL_LOCALE_INCLUDED |
18 | |
19 | typedef struct my_locale_errmsgs |
20 | { |
21 | const char *language; |
22 | const char ***errmsgs; |
23 | } MY_LOCALE_ERRMSGS; |
24 | |
25 | |
26 | typedef struct st_typelib TYPELIB; |
27 | |
28 | class MY_LOCALE |
29 | { |
30 | public: |
31 | uint number; |
32 | const char *name; |
33 | const char *description; |
34 | const bool is_ascii; |
35 | TYPELIB *month_names; |
36 | TYPELIB *ab_month_names; |
37 | TYPELIB *day_names; |
38 | TYPELIB *ab_day_names; |
39 | uint max_month_name_length; |
40 | uint max_day_name_length; |
41 | uint decimal_point; |
42 | uint thousand_sep; |
43 | const char *grouping; |
44 | MY_LOCALE_ERRMSGS *errmsgs; |
45 | MY_LOCALE(uint number_par, |
46 | const char *name_par, const char *descr_par, bool is_ascii_par, |
47 | TYPELIB *month_names_par, TYPELIB *ab_month_names_par, |
48 | TYPELIB *day_names_par, TYPELIB *ab_day_names_par, |
49 | uint max_month_name_length_par, uint max_day_name_length_par, |
50 | uint decimal_point_par, uint thousand_sep_par, |
51 | const char *grouping_par, MY_LOCALE_ERRMSGS *errmsgs_par) : |
52 | number(number_par), |
53 | name(name_par), description(descr_par), is_ascii(is_ascii_par), |
54 | month_names(month_names_par), ab_month_names(ab_month_names_par), |
55 | day_names(day_names_par), ab_day_names(ab_day_names_par), |
56 | max_month_name_length(max_month_name_length_par), |
57 | max_day_name_length(max_day_name_length_par), |
58 | decimal_point(decimal_point_par), |
59 | thousand_sep(thousand_sep_par), |
60 | grouping(grouping_par), |
61 | errmsgs(errmsgs_par) |
62 | {} |
63 | uint repertoire() const |
64 | { return is_ascii ? MY_REPERTOIRE_ASCII : MY_REPERTOIRE_EXTENDED; } |
65 | }; |
66 | /* Exported variables */ |
67 | |
68 | extern MY_LOCALE my_locale_en_US; |
69 | extern MY_LOCALE *my_locales[]; |
70 | extern MY_LOCALE *my_default_lc_messages; |
71 | extern MY_LOCALE *my_default_lc_time_names; |
72 | |
73 | /* Exported functions */ |
74 | |
75 | MY_LOCALE *my_locale_by_name(const char *name); |
76 | MY_LOCALE *my_locale_by_number(uint number); |
77 | void cleanup_errmsgs(void); |
78 | |
79 | #endif /* SQL_LOCALE_INCLUDED */ |
80 | |