Header And Logo

PostgreSQL
| The world's most advanced open source database.

pg_locale.h

Go to the documentation of this file.
00001 /*-----------------------------------------------------------------------
00002  *
00003  * PostgreSQL locale utilities
00004  *
00005  * src/include/utils/pg_locale.h
00006  *
00007  * Copyright (c) 2002-2013, PostgreSQL Global Development Group
00008  *
00009  *-----------------------------------------------------------------------
00010  */
00011 
00012 #ifndef _PG_LOCALE_
00013 #define _PG_LOCALE_
00014 
00015 #include <locale.h>
00016 #ifdef LOCALE_T_IN_XLOCALE
00017 #include <xlocale.h>
00018 #endif
00019 
00020 #include "utils/guc.h"
00021 
00022 
00023 /* GUC settings */
00024 extern char *locale_messages;
00025 extern char *locale_monetary;
00026 extern char *locale_numeric;
00027 extern char *locale_time;
00028 
00029 /* lc_time localization cache */
00030 extern char *localized_abbrev_days[];
00031 extern char *localized_full_days[];
00032 extern char *localized_abbrev_months[];
00033 extern char *localized_full_months[];
00034 
00035 
00036 extern bool check_locale_messages(char **newval, void **extra, GucSource source);
00037 extern void assign_locale_messages(const char *newval, void *extra);
00038 extern bool check_locale_monetary(char **newval, void **extra, GucSource source);
00039 extern void assign_locale_monetary(const char *newval, void *extra);
00040 extern bool check_locale_numeric(char **newval, void **extra, GucSource source);
00041 extern void assign_locale_numeric(const char *newval, void *extra);
00042 extern bool check_locale_time(char **newval, void **extra, GucSource source);
00043 extern void assign_locale_time(const char *newval, void *extra);
00044 
00045 extern bool check_locale(int category, const char *locale, char **canonname);
00046 extern char *pg_perm_setlocale(int category, const char *locale);
00047 
00048 extern bool lc_collate_is_c(Oid collation);
00049 extern bool lc_ctype_is_c(Oid collation);
00050 
00051 /*
00052  * Return the POSIX lconv struct (contains number/money formatting
00053  * information) with locale information for all categories.
00054  */
00055 extern struct lconv *PGLC_localeconv(void);
00056 
00057 extern void cache_locale_time(void);
00058 
00059 
00060 /*
00061  * We define our own wrapper around locale_t so we can keep the same
00062  * function signatures for all builds, while not having to create a
00063  * fake version of the standard type locale_t in the global namespace.
00064  * The fake version of pg_locale_t can be checked for truth; that's
00065  * about all it will be needed for.
00066  */
00067 #ifdef HAVE_LOCALE_T
00068 typedef locale_t pg_locale_t;
00069 #else
00070 typedef int pg_locale_t;
00071 #endif
00072 
00073 extern pg_locale_t pg_newlocale_from_collation(Oid collid);
00074 
00075 /* These functions convert from/to libc's wchar_t, *not* pg_wchar_t */
00076 #ifdef USE_WIDE_UPPER_LOWER
00077 extern size_t wchar2char(char *to, const wchar_t *from, size_t tolen,
00078            pg_locale_t locale);
00079 extern size_t char2wchar(wchar_t *to, size_t tolen,
00080            const char *from, size_t fromlen, pg_locale_t locale);
00081 #endif
00082 
00083 #endif   /* _PG_LOCALE_ */