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, version 2.0, 5 as published by the Free Software Foundation. 6 7 This program is also distributed with certain software (including 8 but not limited to OpenSSL) that is licensed under separate terms, 9 as designated in a particular file or component or in included license 10 documentation. The authors of MySQL hereby grant you an additional 11 permission to link the program and your derivative works with the 12 separately licensed software that they have included with MySQL. 13 14 This program is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License, version 2.0, for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with this program; if not, write to the Free Software 21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 22 23 #ifndef SQL_LOCALE_INCLUDED 24 #define SQL_LOCALE_INCLUDED 25 26 typedef struct my_locale_errmsgs 27 { 28 const char *language; 29 const char **errmsgs; 30 } MY_LOCALE_ERRMSGS; 31 32 #include "my_global.h" /* uint */ 33 34 typedef struct st_typelib TYPELIB; 35 36 class MY_LOCALE 37 { 38 public: 39 uint number; 40 const char *name; 41 const char *description; 42 const bool is_ascii; 43 TYPELIB *month_names; 44 TYPELIB *ab_month_names; 45 TYPELIB *day_names; 46 TYPELIB *ab_day_names; 47 uint max_month_name_length; 48 uint max_day_name_length; 49 uint decimal_point; 50 uint thousand_sep; 51 const char *grouping; 52 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)53 MY_LOCALE(uint number_par, 54 const char *name_par, const char *descr_par, bool is_ascii_par, 55 TYPELIB *month_names_par, TYPELIB *ab_month_names_par, 56 TYPELIB *day_names_par, TYPELIB *ab_day_names_par, 57 uint max_month_name_length_par, uint max_day_name_length_par, 58 uint decimal_point_par, uint thousand_sep_par, 59 const char *grouping_par, MY_LOCALE_ERRMSGS *errmsgs_par) : 60 number(number_par), 61 name(name_par), description(descr_par), is_ascii(is_ascii_par), 62 month_names(month_names_par), ab_month_names(ab_month_names_par), 63 day_names(day_names_par), ab_day_names(ab_day_names_par), 64 max_month_name_length(max_month_name_length_par), 65 max_day_name_length(max_day_name_length_par), 66 decimal_point(decimal_point_par), 67 thousand_sep(thousand_sep_par), 68 grouping(grouping_par), 69 errmsgs(errmsgs_par) 70 {} 71 }; 72 /* Exported variables */ 73 74 extern MY_LOCALE my_locale_en_US; 75 extern MY_LOCALE *my_locales[]; 76 extern MYSQL_PLUGIN_IMPORT MY_LOCALE *my_default_lc_messages; 77 extern MY_LOCALE *my_default_lc_time_names; 78 79 /* Exported functions */ 80 81 MY_LOCALE *my_locale_by_name(const char *name); 82 MY_LOCALE *my_locale_by_number(uint number); 83 void cleanup_errmsgs(void); 84 85 #endif /* SQL_LOCALE_INCLUDED */ 86