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 #include "my_global.h"                          /* uint */
26 
27 typedef struct st_typelib TYPELIB;
28 
29 class MY_LOCALE
30 {
31 public:
32   uint  number;
33   const char *name;
34   const char *description;
35   const bool is_ascii;
36   TYPELIB *month_names;
37   TYPELIB *ab_month_names;
38   TYPELIB *day_names;
39   TYPELIB *ab_day_names;
40   uint max_month_name_length;
41   uint max_day_name_length;
42   uint decimal_point;
43   uint thousand_sep;
44   const char *grouping;
45   MY_LOCALE_ERRMSGS *errmsgs;
MY_LOCALE(uint number_par,const char * name_par,const char * descr_par,bool is_ascii_par,TYPELIB * month_names_par,TYPELIB * ab_month_names_par,TYPELIB * day_names_par,TYPELIB * ab_day_names_par,uint max_month_name_length_par,uint max_day_name_length_par,uint decimal_point_par,uint thousand_sep_par,const char * grouping_par,MY_LOCALE_ERRMSGS * errmsgs_par)46   MY_LOCALE(uint number_par,
47             const char *name_par, const char *descr_par, bool is_ascii_par,
48             TYPELIB *month_names_par, TYPELIB *ab_month_names_par,
49             TYPELIB *day_names_par, TYPELIB *ab_day_names_par,
50             uint max_month_name_length_par, uint max_day_name_length_par,
51             uint decimal_point_par, uint thousand_sep_par,
52             const char *grouping_par, MY_LOCALE_ERRMSGS *errmsgs_par) :
53     number(number_par),
54     name(name_par), description(descr_par), is_ascii(is_ascii_par),
55     month_names(month_names_par), ab_month_names(ab_month_names_par),
56     day_names(day_names_par), ab_day_names(ab_day_names_par),
57     max_month_name_length(max_month_name_length_par),
58     max_day_name_length(max_day_name_length_par),
59     decimal_point(decimal_point_par),
60     thousand_sep(thousand_sep_par),
61     grouping(grouping_par),
62     errmsgs(errmsgs_par)
63   {}
64 };
65 /* Exported variables */
66 
67 extern MY_LOCALE my_locale_en_US;
68 extern MY_LOCALE *my_locales[];
69 extern MY_LOCALE *my_default_lc_messages;
70 extern MY_LOCALE *my_default_lc_time_names;
71 
72 /* Exported functions */
73 
74 MY_LOCALE *my_locale_by_name(const char *name);
75 MY_LOCALE *my_locale_by_number(uint number);
76 void cleanup_errmsgs(void);
77 
78 #endif /* SQL_LOCALE_INCLUDED */
79