c++locale.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef _C_LOCALE_H
00037 #define _C_LOCALE_H 1
00038
00039 #pragma GCC system_header
00040
00041 #include <cstring>
00042 #include <cstdio>
00043 #include <clocale>
00044 #include <langinfo.h>
00045 #include <iconv.h>
00046 #include <libintl.h>
00047
00048 #define _GLIBCXX_C_LOCALE_GNU 1
00049
00050 #define _GLIBCXX_NUM_CATEGORIES 6
00051
00052 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
00053 namespace __gnu_cxx
00054 {
00055 extern "C" __typeof(uselocale) __uselocale;
00056 }
00057 #endif
00058
00059 namespace std
00060 {
00061 typedef __locale_t __c_locale;
00062
00063
00064
00065
00066
00067 template<typename _Tv>
00068 int
00069 __convert_from_v(char* __out, const int __size, const char* __fmt,
00070 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
00071 _Tv __v, const __c_locale& __cloc, int __prec)
00072 {
00073 __c_locale __old = __gnu_cxx::__uselocale(__cloc);
00074 #else
00075 _Tv __v, const __c_locale&, int __prec)
00076 {
00077 char* __old = std::setlocale(LC_ALL, NULL);
00078 char* __sav = new char[std::strlen(__old) + 1];
00079 std::strcpy(__sav, __old);
00080 std::setlocale(LC_ALL, "C");
00081 #endif
00082
00083 #ifdef _GLIBCXX_USE_C99
00084 const int __ret = std::snprintf(__out, __size, __fmt, __prec, __v);
00085 #else
00086 const int __ret = std::sprintf(__out, __fmt, __prec, __v);
00087 #endif
00088
00089 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
00090 __gnu_cxx::__uselocale(__old);
00091 #else
00092 std::setlocale(LC_ALL, __sav);
00093 delete [] __sav;
00094 #endif
00095 return __ret;
00096 }
00097 }
00098
00099 #endif
Generated on Sun Sep 12 15:49:57 2004 for libstdc++ source by
1.3.8