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
00040 #ifndef _CPP_BITS_LOCFACETS_H
00041 #define _CPP_BITS_LOCFACETS_H 1
00042
00043 #pragma GCC system_header
00044
00045 #include <ctime>
00046 #include <cwctype>
00047 #include <ios>
00048
00049 namespace std
00050 {
00051
00052 #ifdef _GLIBCPP_USE_WCHAR_T
00053 # define _GLIBCPP_NUM_FACETS 28
00054 #else
00055 # define _GLIBCPP_NUM_FACETS 14
00056 #endif
00057
00058 template<typename _CharT, typename _Traits>
00059 struct __pad;
00060
00061
00062
00063 #include <bits/ctype_base.h>
00064
00065
00066 template<typename _CharT>
00067 class __ctype_abstract_base : public locale::facet, public ctype_base
00068 {
00069 public:
00070
00071 typedef _CharT char_type;
00072
00073 bool
00074 is(mask __m, char_type __c) const
00075 { return this->do_is(__m, __c); }
00076
00077 const char_type*
00078 is(const char_type *__lo, const char_type *__hi, mask *__vec) const
00079 { return this->do_is(__lo, __hi, __vec); }
00080
00081 const char_type*
00082 scan_is(mask __m, const char_type* __lo, const char_type* __hi) const
00083 { return this->do_scan_is(__m, __lo, __hi); }
00084
00085 const char_type*
00086 scan_not(mask __m, const char_type* __lo, const char_type* __hi) const
00087 { return this->do_scan_not(__m, __lo, __hi); }
00088
00089 char_type
00090 toupper(char_type __c) const
00091 { return this->do_toupper(__c); }
00092
00093 const char_type*
00094 toupper(char_type *__lo, const char_type* __hi) const
00095 { return this->do_toupper(__lo, __hi); }
00096
00097 char_type
00098 tolower(char_type __c) const
00099 { return this->do_tolower(__c); }
00100
00101 const char_type*
00102 tolower(char_type* __lo, const char_type* __hi) const
00103 { return this->do_tolower(__lo, __hi); }
00104
00105 char_type
00106 widen(char __c) const
00107 { return this->do_widen(__c); }
00108
00109 const char*
00110 widen(const char* __lo, const char* __hi, char_type* __to) const
00111 { return this->do_widen(__lo, __hi, __to); }
00112
00113 char
00114 narrow(char_type __c, char __dfault) const
00115 { return this->do_narrow(__c, __dfault); }
00116
00117 const char_type*
00118 narrow(const char_type* __lo, const char_type* __hi,
00119 char __dfault, char *__to) const
00120 { return this->do_narrow(__lo, __hi, __dfault, __to); }
00121
00122 protected:
00123 explicit
00124 __ctype_abstract_base(size_t __refs = 0): locale::facet(__refs) { }
00125
00126 virtual
00127 ~__ctype_abstract_base() { }
00128
00129 virtual bool
00130 do_is(mask __m, char_type __c) const = 0;
00131
00132 virtual const char_type*
00133 do_is(const char_type* __lo, const char_type* __hi,
00134 mask* __vec) const = 0;
00135
00136 virtual const char_type*
00137 do_scan_is(mask __m, const char_type* __lo,
00138 const char_type* __hi) const = 0;
00139
00140 virtual const char_type*
00141 do_scan_not(mask __m, const char_type* __lo,
00142 const char_type* __hi) const = 0;
00143
00144 virtual char_type
00145 do_toupper(char_type) const = 0;
00146
00147 virtual const char_type*
00148 do_toupper(char_type* __lo, const char_type* __hi) const = 0;
00149
00150 virtual char_type
00151 do_tolower(char_type) const = 0;
00152
00153 virtual const char_type*
00154 do_tolower(char_type* __lo, const char_type* __hi) const = 0;
00155
00156 virtual char_type
00157 do_widen(char) const = 0;
00158
00159 virtual const char*
00160 do_widen(const char* __lo, const char* __hi,
00161 char_type* __dest) const = 0;
00162
00163 virtual char
00164 do_narrow(char_type, char __dfault) const = 0;
00165
00166 virtual const char_type*
00167 do_narrow(const char_type* __lo, const char_type* __hi,
00168 char __dfault, char* __dest) const = 0;
00169 };
00170
00171
00172 template<typename _CharT>
00173 class ctype : public __ctype_abstract_base<_CharT>
00174 {
00175 public:
00176
00177 typedef _CharT char_type;
00178 typedef typename ctype::mask mask;
00179
00180 static locale::id id;
00181
00182 explicit
00183 ctype(size_t __refs = 0) : __ctype_abstract_base<_CharT>(__refs) { }
00184
00185 protected:
00186 virtual
00187 ~ctype();
00188
00189 virtual bool
00190 do_is(mask __m, char_type __c) const;
00191
00192 virtual const char_type*
00193 do_is(const char_type* __lo, const char_type* __hi, mask* __vec) const;
00194
00195 virtual const char_type*
00196 do_scan_is(mask __m, const char_type* __lo, const char_type* __hi) const;
00197
00198 virtual const char_type*
00199 do_scan_not(mask __m, const char_type* __lo,
00200 const char_type* __hi) const;
00201
00202 virtual char_type
00203 do_toupper(char_type __c) const;
00204
00205 virtual const char_type*
00206 do_toupper(char_type* __lo, const char_type* __hi) const;
00207
00208 virtual char_type
00209 do_tolower(char_type __c) const;
00210
00211 virtual const char_type*
00212 do_tolower(char_type* __lo, const char_type* __hi) const;
00213
00214 virtual char_type
00215 do_widen(char __c) const;
00216
00217 virtual const char*
00218 do_widen(const char* __lo, const char* __hi, char_type* __dest) const;
00219
00220 virtual char
00221 do_narrow(char_type, char __dfault) const;
00222
00223 virtual const char_type*
00224 do_narrow(const char_type* __lo, const char_type* __hi,
00225 char __dfault, char* __dest) const;
00226 };
00227
00228 template<typename _CharT>
00229 locale::id ctype<_CharT>::id;
00230
00231
00232 template<>
00233 class ctype<char> : public __ctype_abstract_base<char>
00234 {
00235 public:
00236
00237 typedef char char_type;
00238
00239 protected:
00240
00241 __c_locale _M_c_locale_ctype;
00242 bool _M_del;
00243 __to_type _M_toupper;
00244 __to_type _M_tolower;
00245 const mask* _M_table;
00246
00247 public:
00248 static locale::id id;
00249 static const size_t table_size = 1 + static_cast<unsigned char>(-1);
00250
00251 explicit
00252 ctype(const mask* __table = 0, bool __del = false, size_t __refs = 0);
00253
00254 explicit
00255 ctype(__c_locale __cloc, const mask* __table = 0, bool __del = false,
00256 size_t __refs = 0);
00257
00258 inline bool
00259 is(mask __m, char __c) const;
00260
00261 inline const char*
00262 is(const char* __lo, const char* __hi, mask* __vec) const;
00263
00264 inline const char*
00265 scan_is(mask __m, const char* __lo, const char* __hi) const;
00266
00267 inline const char*
00268 scan_not(mask __m, const char* __lo, const char* __hi) const;
00269
00270 protected:
00271 const mask*
00272 table() const throw()
00273 { return _M_table; }
00274
00275 static const mask*
00276 classic_table() throw();
00277
00278 virtual
00279 ~ctype();
00280
00281 virtual bool
00282 do_is(mask __m, char_type __c) const;
00283
00284 virtual const char_type*
00285 do_is(const char_type* __lo, const char_type* __hi, mask* __vec) const;
00286
00287 virtual const char_type*
00288 do_scan_is(mask __m, const char_type* __lo, const char_type* __hi) const;
00289
00290 virtual const char_type*
00291 do_scan_not(mask __m, const char_type* __lo,
00292 const char_type* __hi) const;
00293
00294 virtual char_type
00295 do_toupper(char_type) const;
00296
00297 virtual const char_type*
00298 do_toupper(char_type* __lo, const char_type* __hi) const;
00299
00300 virtual char_type
00301 do_tolower(char_type) const;
00302
00303 virtual const char_type*
00304 do_tolower(char_type* __lo, const char_type* __hi) const;
00305
00306 virtual char_type
00307 do_widen(char) const;
00308
00309 virtual const char*
00310 do_widen(const char* __lo, const char* __hi, char_type* __dest) const;
00311
00312 virtual char
00313 do_narrow(char_type, char __dfault) const;
00314
00315 virtual const char_type*
00316 do_narrow(const char_type* __lo, const char_type* __hi,
00317 char __dfault, char* __dest) const;
00318 };
00319
00320 template<>
00321 const ctype<char>&
00322 use_facet<ctype<char> >(const locale& __loc);
00323
00324 #ifdef _GLIBCPP_USE_WCHAR_T
00325
00326 template<>
00327 class ctype<wchar_t> : public __ctype_abstract_base<wchar_t>
00328 {
00329 public:
00330
00331 typedef wchar_t char_type;
00332 typedef wctype_t __wmask_type;
00333
00334 protected:
00335 __c_locale _M_c_locale_ctype;
00336
00337 public:
00338
00339 static locale::id id;
00340
00341 explicit
00342 ctype(size_t __refs = 0);
00343
00344 explicit
00345 ctype(__c_locale __cloc, size_t __refs = 0);
00346
00347 protected:
00348 __wmask_type
00349 _M_convert_to_wmask(const mask __m) const;
00350
00351 virtual
00352 ~ctype();
00353
00354 virtual bool
00355 do_is(mask __m, char_type __c) const;
00356
00357 virtual const char_type*
00358 do_is(const char_type* __lo, const char_type* __hi, mask* __vec) const;
00359
00360 virtual const char_type*
00361 do_scan_is(mask __m, const char_type* __lo, const char_type* __hi) const;
00362
00363 virtual const char_type*
00364 do_scan_not(mask __m, const char_type* __lo,
00365 const char_type* __hi) const;
00366
00367 virtual char_type
00368 do_toupper(char_type) const;
00369
00370 virtual const char_type*
00371 do_toupper(char_type* __lo, const char_type* __hi) const;
00372
00373 virtual char_type
00374 do_tolower(char_type) const;
00375
00376 virtual const char_type*
00377 do_tolower(char_type* __lo, const char_type* __hi) const;
00378
00379 virtual char_type
00380 do_widen(char) const;
00381
00382 virtual const char*
00383 do_widen(const char* __lo, const char* __hi, char_type* __dest) const;
00384
00385 virtual char
00386 do_narrow(char_type, char __dfault) const;
00387
00388 virtual const char_type*
00389 do_narrow(const char_type* __lo, const char_type* __hi,
00390 char __dfault, char* __dest) const;
00391
00392 };
00393
00394 template<>
00395 const ctype<wchar_t>&
00396 use_facet<ctype<wchar_t> >(const locale& __loc);
00397 #endif //_GLIBCPP_USE_WCHAR_T
00398
00399
00400 #include <bits/ctype_inline.h>
00401
00402
00403 template<typename _CharT>
00404 class ctype_byname : public ctype<_CharT>
00405 {
00406 public:
00407 typedef _CharT char_type;
00408
00409 explicit
00410 ctype_byname(const char* __s, size_t __refs = 0);
00411
00412 protected:
00413 virtual
00414 ~ctype_byname() { };
00415 };
00416
00417
00418 template<>
00419 ctype_byname<char>::ctype_byname(const char*, size_t refs);
00420
00421 template<>
00422 ctype_byname<wchar_t>::ctype_byname(const char*, size_t refs);
00423
00424
00425 #include <bits/codecvt.h>
00426
00427
00428
00429 class __num_base
00430 {
00431 protected:
00432
00433
00434 static const char _S_atoms[];
00435
00436 enum
00437 {
00438 _M_zero,
00439 _M_e = _M_zero + 10,
00440 _M_E = _M_zero + 11,
00441 _M_size = 21 + 1
00442 };
00443
00444
00445
00446 static bool
00447 _S_format_float(const ios_base& __io, char* __fptr, char __mod,
00448 streamsize __prec);
00449
00450
00451 static void
00452 _S_format_int(const ios_base& __io, char* __fptr, char __mod, char __modl);
00453 };
00454
00455
00456 template<typename _CharT>
00457 class numpunct : public locale::facet
00458 {
00459 public:
00460
00461 typedef _CharT char_type;
00462 typedef basic_string<_CharT> string_type;
00463
00464 static locale::id id;
00465
00466 private:
00467 char_type _M_decimal_point;
00468 char_type _M_thousands_sep;
00469 const char* _M_grouping;
00470 const char_type* _M_truename;
00471 const char_type* _M_falsename;
00472
00473 public:
00474 explicit
00475 numpunct(size_t __refs = 0) : locale::facet(__refs)
00476 { _M_initialize_numpunct(); }
00477
00478 explicit
00479 numpunct(__c_locale __cloc, size_t __refs = 0) : locale::facet(__refs)
00480 { _M_initialize_numpunct(__cloc); }
00481
00482 char_type
00483 decimal_point() const
00484 { return this->do_decimal_point(); }
00485
00486 char_type
00487 thousands_sep() const
00488 { return this->do_thousands_sep(); }
00489
00490 string
00491 grouping() const
00492 { return this->do_grouping(); }
00493
00494 string_type
00495 truename() const
00496 { return this->do_truename(); }
00497
00498 string_type
00499 falsename() const
00500 { return this->do_falsename(); }
00501
00502 protected:
00503 virtual
00504 ~numpunct();
00505
00506 virtual char_type
00507 do_decimal_point() const
00508 { return _M_decimal_point; }
00509
00510 virtual char_type
00511 do_thousands_sep() const
00512 { return _M_thousands_sep; }
00513
00514 virtual string
00515 do_grouping() const
00516 { return _M_grouping; }
00517
00518 virtual string_type
00519 do_truename() const
00520 { return _M_truename; }
00521
00522 virtual string_type
00523 do_falsename() const
00524 { return _M_falsename; }
00525
00526
00527 void
00528 _M_initialize_numpunct(__c_locale __cloc = NULL);
00529 };
00530
00531 template<typename _CharT>
00532 locale::id numpunct<_CharT>::id;
00533
00534 template<>
00535 numpunct<char>::~numpunct();
00536
00537 template<>
00538 void
00539 numpunct<char>::_M_initialize_numpunct(__c_locale __cloc);
00540
00541 #ifdef _GLIBCPP_USE_WCHAR_T
00542 template<>
00543 numpunct<wchar_t>::~numpunct();
00544
00545 template<>
00546 void
00547 numpunct<wchar_t>::_M_initialize_numpunct(__c_locale __cloc);
00548 #endif
00549
00550 template<typename _CharT>
00551 class numpunct_byname : public numpunct<_CharT>
00552 {
00553
00554 __c_locale _M_c_locale_numpunct;
00555
00556 public:
00557 typedef _CharT char_type;
00558 typedef basic_string<_CharT> string_type;
00559
00560 explicit
00561 numpunct_byname(const char* __s, size_t __refs = 0)
00562 : numpunct<_CharT>(__refs)
00563 {
00564 _S_create_c_locale(_M_c_locale_numpunct, __s);
00565 _M_initialize_numpunct(_M_c_locale_numpunct);
00566 }
00567
00568 protected:
00569 virtual
00570 ~numpunct_byname()
00571 { _S_destroy_c_locale(_M_c_locale_numpunct); }
00572 };
00573
00574 template<typename _CharT, typename _InIter>
00575 class num_get : public locale::facet, public __num_base
00576 {
00577 public:
00578
00579 typedef _CharT char_type;
00580 typedef _InIter iter_type;
00581
00582 static locale::id id;
00583
00584 explicit
00585 num_get(size_t __refs = 0) : locale::facet(__refs) { }
00586
00587 iter_type
00588 get(iter_type __in, iter_type __end, ios_base& __io,
00589 ios_base::iostate& __err, bool& __v) const
00590 { return this->do_get(__in, __end, __io, __err, __v); }
00591
00592 iter_type
00593 get(iter_type __in, iter_type __end, ios_base& __io,
00594 ios_base::iostate& __err, long& __v) const
00595 { return this->do_get(__in, __end, __io, __err, __v); }
00596
00597 iter_type
00598 get(iter_type __in, iter_type __end, ios_base& __io,
00599 ios_base::iostate& __err, unsigned short& __v) const
00600 { return this->do_get(__in, __end, __io, __err, __v); }
00601
00602 iter_type
00603 get(iter_type __in, iter_type __end, ios_base& __io,
00604 ios_base::iostate& __err, unsigned int& __v) const
00605 { return this->do_get(__in, __end, __io, __err, __v); }
00606
00607 iter_type
00608 get(iter_type __in, iter_type __end, ios_base& __io,
00609 ios_base::iostate& __err, unsigned long& __v) const
00610 { return this->do_get(__in, __end, __io, __err, __v); }
00611
00612 #ifdef _GLIBCPP_USE_LONG_LONG
00613 iter_type
00614 get(iter_type __in, iter_type __end, ios_base& __io,
00615 ios_base::iostate& __err, long long& __v) const
00616 { return this->do_get(__in, __end, __io, __err, __v); }
00617
00618 iter_type
00619 get(iter_type __in, iter_type __end, ios_base& __io,
00620 ios_base::iostate& __err, unsigned long long& __v) const
00621 { return this->do_get(__in, __end, __io, __err, __v); }
00622 #endif
00623
00624 iter_type
00625 get(iter_type __in, iter_type __end, ios_base& __io,
00626 ios_base::iostate& __err, float& __v) const
00627 { return this->do_get(__in, __end, __io, __err, __v); }
00628
00629 iter_type
00630 get(iter_type __in, iter_type __end, ios_base& __io,
00631 ios_base::iostate& __err, double& __v) const
00632 { return this->do_get(__in, __end, __io, __err, __v); }
00633
00634 iter_type
00635 get(iter_type __in, iter_type __end, ios_base& __io,
00636 ios_base::iostate& __err, long double& __v) const
00637 { return this->do_get(__in, __end, __io, __err, __v); }
00638
00639 iter_type
00640 get(iter_type __in, iter_type __end, ios_base& __io,
00641 ios_base::iostate& __err, void*& __v) const
00642 { return this->do_get(__in, __end, __io, __err, __v); }
00643
00644 protected:
00645 virtual ~num_get() { }
00646
00647 iter_type
00648 _M_extract_float(iter_type, iter_type, ios_base&, ios_base::iostate&,
00649 string& __xtrc) const;
00650
00651 iter_type
00652 _M_extract_int(iter_type, iter_type, ios_base&, ios_base::iostate&,
00653 string& __xtrc, int& __base) const;
00654
00655 virtual iter_type
00656 do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, bool&) const;
00657
00658
00659 virtual iter_type
00660 do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, long&) const;
00661
00662 virtual iter_type
00663 do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
00664 unsigned short&) const;
00665
00666 virtual iter_type
00667 do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
00668 unsigned int&) const;
00669
00670 virtual iter_type
00671 do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
00672 unsigned long&) const;
00673
00674 #ifdef _GLIBCPP_USE_LONG_LONG
00675 virtual iter_type
00676 do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
00677 long long&) const;
00678
00679 virtual iter_type
00680 do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
00681 unsigned long long&) const;
00682 #endif
00683
00684 virtual iter_type
00685 do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
00686 float&) const;
00687
00688 virtual iter_type
00689 do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
00690 double&) const;
00691
00692 virtual iter_type
00693 do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
00694 long double&) const;
00695
00696 virtual iter_type
00697 do_get(iter_type, iter_type, ios_base&, ios_base::iostate& __err,
00698 void*&) const;
00699 };
00700
00701 template<typename _CharT, typename _InIter>
00702 locale::id num_get<_CharT, _InIter>::id;
00703
00704 #if 0
00705
00706 template<typename _CharT>
00707 class num_get<_CharT, istreambuf_iterator<_CharT> >;
00708
00709 iter_type
00710 _M_extract_float(iter_type, iter_type, ios_base&, ios_base::iostate&,
00711 string& __xtrc) const;
00712
00713 iter_type
00714 _M_extract_int(iter_type, iter_type, ios_base&, ios_base::iostate&,
00715 string& __xtrc, int& __base) const;
00716
00717 virtual iter_type
00718 do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, bool&) const;
00719 #endif
00720
00721 template<typename _CharT, typename _OutIter>
00722 class num_put : public locale::facet, public __num_base
00723 {
00724 public:
00725
00726 typedef _CharT char_type;
00727 typedef _OutIter iter_type;
00728
00729 static locale::id id;
00730
00731 explicit
00732 num_put(size_t __refs = 0) : locale::facet(__refs) { }
00733
00734 iter_type
00735 put(iter_type __s, ios_base& __f, char_type __fill, bool __v) const
00736 { return this->do_put(__s, __f, __fill, __v); }
00737
00738 iter_type
00739 put(iter_type __s, ios_base& __f, char_type __fill, long __v) const
00740 { return this->do_put(__s, __f, __fill, __v); }
00741
00742 iter_type
00743 put(iter_type __s, ios_base& __f, char_type __fill,
00744 unsigned long __v) const
00745 { return this->do_put(__s, __f, __fill, __v); }
00746
00747 #ifdef _GLIBCPP_USE_LONG_LONG
00748 iter_type
00749 put(iter_type __s, ios_base& __f, char_type __fill, long long __v) const
00750 { return this->do_put(__s, __f, __fill, __v); }
00751
00752 iter_type
00753 put(iter_type __s, ios_base& __f, char_type __fill,
00754 unsigned long long __v) const
00755 { return this->do_put(__s, __f, __fill, __v); }
00756 #endif
00757
00758 iter_type
00759 put(iter_type __s, ios_base& __f, char_type __fill, double __v) const
00760 { return this->do_put(__s, __f, __fill, __v); }
00761
00762 iter_type
00763 put(iter_type __s, ios_base& __f, char_type __fill,
00764 long double __v) const
00765 { return this->do_put(__s, __f, __fill, __v); }
00766
00767 iter_type
00768 put(iter_type __s, ios_base& __f, char_type __fill,
00769 const void* __v) const
00770 { return this->do_put(__s, __f, __fill, __v); }
00771
00772 protected:
00773 template<typename _ValueT>
00774 iter_type
00775 _M_convert_float(iter_type, ios_base& __io, char_type __fill,
00776 char __mod, _ValueT __v) const;
00777
00778 template<typename _ValueT>
00779 iter_type
00780 _M_convert_int(iter_type, ios_base& __io, char_type __fill,
00781 char __mod, char __modl, _ValueT __v) const;
00782
00783 iter_type
00784 _M_widen_float(iter_type, ios_base& __io, char_type __fill, char* __cs,
00785 int __len) const;
00786
00787 iter_type
00788 _M_widen_int(iter_type, ios_base& __io, char_type __fill, char* __cs,
00789 int __len) const;
00790
00791 iter_type
00792 _M_insert(iter_type, ios_base& __io, char_type __fill,
00793 const char_type* __ws, int __len) const;
00794
00795 virtual
00796 ~num_put() { };
00797
00798 virtual iter_type
00799 do_put(iter_type, ios_base&, char_type __fill, bool __v) const;
00800
00801 virtual iter_type
00802 do_put(iter_type, ios_base&, char_type __fill, long __v) const;
00803
00804 virtual iter_type
00805 do_put(iter_type, ios_base&, char_type __fill, unsigned long) const;
00806
00807 #ifdef _GLIBCPP_USE_LONG_LONG
00808 virtual iter_type
00809 do_put(iter_type, ios_base&, char_type __fill, long long __v) const;
00810
00811 virtual iter_type
00812 do_put(iter_type, ios_base&, char_type __fill, unsigned long long) const;
00813 #endif
00814
00815 virtual iter_type
00816 do_put(iter_type, ios_base&, char_type __fill, double __v) const;
00817
00818 virtual iter_type
00819 do_put(iter_type, ios_base&, char_type __fill, long double __v) const;
00820
00821 virtual iter_type
00822 do_put(iter_type, ios_base&, char_type __fill, const void* __v) const;
00823 };
00824
00825 template <typename _CharT, typename _OutIter>
00826 locale::id num_put<_CharT, _OutIter>::id;
00827
00828
00829 template<typename _CharT>
00830 class collate : public locale::facet
00831 {
00832 public:
00833
00834 typedef _CharT char_type;
00835 typedef basic_string<_CharT> string_type;
00836
00837 protected:
00838
00839
00840 __c_locale _M_c_locale_collate;
00841
00842 public:
00843 static locale::id id;
00844
00845 explicit
00846 collate(size_t __refs = 0)
00847 : locale::facet(__refs)
00848 { _M_c_locale_collate = _S_c_locale; }
00849
00850 explicit
00851 collate(__c_locale __cloc, size_t __refs = 0)
00852 : locale::facet(__refs)
00853 { _M_c_locale_collate = _S_clone_c_locale(__cloc); }
00854
00855 int
00856 compare(const _CharT* __lo1, const _CharT* __hi1,
00857 const _CharT* __lo2, const _CharT* __hi2) const
00858 { return this->do_compare(__lo1, __hi1, __lo2, __hi2); }
00859
00860 string_type
00861 transform(const _CharT* __lo, const _CharT* __hi) const
00862 { return this->do_transform(__lo, __hi); }
00863
00864 long
00865 hash(const _CharT* __lo, const _CharT* __hi) const
00866 { return this->do_hash(__lo, __hi); }
00867
00868
00869 int
00870 _M_compare(const _CharT*, const _CharT*) const;
00871
00872 size_t
00873 _M_transform(_CharT*, const _CharT*, size_t) const;
00874
00875 protected:
00876 virtual
00877 ~collate()
00878 { _S_destroy_c_locale(_M_c_locale_collate); }
00879
00880 virtual int
00881 do_compare(const _CharT* __lo1, const _CharT* __hi1,
00882 const _CharT* __lo2, const _CharT* __hi2) const;
00883
00884 virtual string_type
00885 do_transform(const _CharT* __lo, const _CharT* __hi) const;
00886
00887 virtual long
00888 do_hash(const _CharT* __lo, const _CharT* __hi) const;
00889 };
00890
00891 template<typename _CharT>
00892 locale::id collate<_CharT>::id;
00893
00894
00895 template<>
00896 int
00897 collate<char>::_M_compare(const char*, const char*) const;
00898
00899 template<>
00900 size_t
00901 collate<char>::_M_transform(char*, const char*, size_t) const;
00902
00903 #ifdef _GLIBCPP_USE_WCHAR_T
00904 template<>
00905 int
00906 collate<wchar_t>::_M_compare(const wchar_t*, const wchar_t*) const;
00907
00908 template<>
00909 size_t
00910 collate<wchar_t>::_M_transform(wchar_t*, const wchar_t*, size_t) const;
00911 #endif
00912
00913 template<typename _CharT>
00914 class collate_byname : public collate<_CharT>
00915 {
00916 public:
00917 typedef _CharT char_type;
00918 typedef basic_string<_CharT> string_type;
00919
00920 explicit
00921 collate_byname(const char* __s, size_t __refs = 0)
00922 : collate<_CharT>(__refs)
00923 {
00924 _S_destroy_c_locale(_M_c_locale_collate);
00925 _S_create_c_locale(_M_c_locale_collate, __s);
00926 }
00927
00928 protected:
00929 virtual
00930 ~collate_byname() { }
00931 };
00932
00933
00934 class time_base
00935 {
00936 public:
00937 enum dateorder { no_order, dmy, mdy, ymd, ydm };
00938 };
00939
00940 template<typename _CharT>
00941 class __timepunct : public locale::facet
00942 {
00943 public:
00944
00945 typedef _CharT __char_type;
00946 typedef basic_string<_CharT> __string_type;
00947
00948 static locale::id id;
00949
00950
00951 static const _CharT* _S_timezones[14];
00952
00953 protected:
00954 __c_locale _M_c_locale_timepunct;
00955 char* _M_name_timepunct;
00956 const _CharT* _M_date_format;
00957 const _CharT* _M_date_era_format;
00958 const _CharT* _M_time_format;
00959 const _CharT* _M_time_era_format;
00960 const _CharT* _M_date_time_format;
00961 const _CharT* _M_date_time_era_format;
00962 const _CharT* _M_am;
00963 const _CharT* _M_pm;
00964 const _CharT* _M_am_pm_format;
00965
00966
00967 const _CharT* _M_day1;
00968 const _CharT* _M_day2;
00969 const _CharT* _M_day3;
00970 const _CharT* _M_day4;
00971 const _CharT* _M_day5;
00972 const _CharT* _M_day6;
00973 const _CharT* _M_day7;
00974
00975
00976 const _CharT* _M_day_a1;
00977 const _CharT* _M_day_a2;
00978 const _CharT* _M_day_a3;
00979 const _CharT* _M_day_a4;
00980 const _CharT* _M_day_a5;
00981 const _CharT* _M_day_a6;
00982 const _CharT* _M_day_a7;
00983
00984
00985 const _CharT* _M_month01;
00986 const _CharT* _M_month02;
00987 const _CharT* _M_month03;
00988 const _CharT* _M_month04;
00989 const _CharT* _M_month05;
00990 const _CharT* _M_month06;
00991 const _CharT* _M_month07;
00992 const _CharT* _M_month08;
00993 const _CharT* _M_month09;
00994 const _CharT* _M_month10;
00995 const _CharT* _M_month11;
00996 const _CharT* _M_month12;
00997
00998
00999 const _CharT* _M_month_a01;
01000 const _CharT* _M_month_a02;
01001 const _CharT* _M_month_a03;
01002 const _CharT* _M_month_a04;
01003 const _CharT* _M_month_a05;
01004 const _CharT* _M_month_a06;
01005 const _CharT* _M_month_a07;
01006 const _CharT* _M_month_a08;
01007 const _CharT* _M_month_a09;
01008 const _CharT* _M_month_a10;
01009 const _CharT* _M_month_a11;
01010 const _CharT* _M_month_a12;
01011
01012 public:
01013 explicit
01014 __timepunct(size_t __refs = 0);
01015
01016 explicit
01017 __timepunct(__c_locale __cloc, const char* __s, size_t __refs = 0);
01018
01019 void
01020 _M_put(_CharT* __s, size_t __maxlen, const _CharT* __format,
01021 const tm* __tm) const;
01022
01023 void
01024 _M_date_formats(const _CharT** __date) const
01025 {
01026
01027 __date[0] = _M_date_format;
01028 __date[1] = _M_date_era_format;
01029 }
01030
01031 void
01032 _M_time_formats(const _CharT** __time) const
01033 {
01034
01035 __time[0] = _M_time_format;
01036 __time[1] = _M_time_era_format;
01037 }
01038
01039 void
01040 _M_ampm(const _CharT** __ampm) const
01041 {
01042 __ampm[0] = _M_am;
01043 __ampm[1] = _M_pm;
01044 }
01045
01046 void
01047 _M_date_time_formats(const _CharT** __dt) const
01048 {
01049
01050 __dt[0] = _M_date_time_format;
01051 __dt[1] = _M_date_time_era_format;
01052 }
01053
01054 void
01055 _M_days(const _CharT** __days) const
01056 {
01057 __days[0] = _M_day1;
01058 __days[1] = _M_day2;
01059 __days[2] = _M_day3;
01060 __days[3] = _M_day4;
01061 __days[4] = _M_day5;
01062 __days[5] = _M_day6;
01063 __days[6] = _M_day7;
01064 }
01065
01066 void
01067 _M_days_abbreviated(const _CharT** __days) const
01068 {
01069 __days[0] = _M_day_a1;
01070 __days[1] = _M_day_a2;
01071 __days[2] = _M_day_a3;
01072 __days[3] = _M_day_a4;
01073 __days[4] = _M_day_a5;
01074 __days[5] = _M_day_a6;
01075 __days[6] = _M_day_a7;
01076 }
01077
01078 void
01079 _M_months(const _CharT** __months) const
01080 {
01081 __months[0] = _M_month01;
01082 __months[1] = _M_month02;
01083 __months[2] = _M_month03;
01084 __months[3] = _M_month04;
01085 __months[4] = _M_month05;
01086 __months[5] = _M_month06;
01087 __months[6] = _M_month07;
01088 __months[7] = _M_month08;
01089 __months[8] = _M_month09;
01090 __months[9] = _M_month10;
01091 __months[10] = _M_month11;
01092 __months[11] = _M_month12;
01093 }
01094
01095 void
01096 _M_months_abbreviated(const _CharT** __months) const
01097 {
01098 __months[0] = _M_month_a01;
01099 __months[1] = _M_month_a02;
01100 __months[2] = _M_month_a03;
01101 __months[3] = _M_month_a04;
01102 __months[4] = _M_month_a05;
01103 __months[5] = _M_month_a06;
01104 __months[6] = _M_month_a07;
01105 __months[7] = _M_month_a08;
01106 __months[8] = _M_month_a09;
01107 __months[9] = _M_month_a10;
01108 __months[10] = _M_month_a11;
01109 __months[11] = _M_month_a12;
01110 }
01111
01112 protected:
01113 virtual
01114 ~__timepunct();
01115
01116
01117 void
01118 _M_initialize_timepunct(__c_locale __cloc = NULL);
01119 };
01120
01121 template<typename _CharT>
01122 locale::id __timepunct<_CharT>::id;
01123
01124
01125 template<>
01126 const char*
01127 __timepunct<char>::_S_timezones[14];
01128
01129 template<>
01130 void
01131 __timepunct<char>::_M_initialize_timepunct(__c_locale __cloc);
01132
01133 template<>
01134 void
01135 __timepunct<char>::_M_put(char*, size_t, const char*, const tm*) const;
01136
01137 #ifdef _GLIBCPP_USE_WCHAR_T
01138 template<>
01139 const wchar_t*
01140 __timepunct<wchar_t>::_S_timezones[14];
01141
01142 template<>
01143 void
01144 __timepunct<wchar_t>::_M_initialize_timepunct(__c_locale __cloc);
01145
01146 template<>
01147 void
01148 __timepunct<wchar_t>::_M_put(wchar_t*, size_t, const wchar_t*,
01149 const tm*) const;
01150 #endif
01151
01152
01153 template<typename _CharT>
01154 const _CharT* __timepunct<_CharT>::_S_timezones[14];
01155
01156
01157 #include <bits/time_members.h>
01158
01159 template<typename _CharT, typename _InIter>
01160 class time_get : public locale::facet, public time_base
01161 {
01162 public:
01163
01164 typedef _CharT char_type;
01165 typedef _InIter iter_type;
01166 typedef basic_string<_CharT> __string_type;
01167
01168 static locale::id id;
01169
01170 explicit
01171 time_get(size_t __refs = 0)
01172 : locale::facet (__refs) { }
01173
01174 dateorder
01175 date_order() const
01176 { return this->do_date_order(); }
01177
01178 iter_type
01179 get_time(iter_type __beg, iter_type __end, ios_base& __io,
01180 ios_base::iostate& __err, tm* __tm) const
01181 { return this->do_get_time(__beg, __end, __io, __err, __tm); }
01182
01183 iter_type
01184 get_date(iter_type __beg, iter_type __end, ios_base& __io,
01185 ios_base::iostate& __err, tm* __tm) const
01186 { return this->do_get_date(__beg, __end, __io, __err, __tm); }
01187
01188 iter_type
01189 get_weekday(iter_type __beg, iter_type __end, ios_base& __io,
01190 ios_base::iostate& __err, tm* __tm) const
01191 { return this->do_get_weekday(__beg, __end, __io, __err, __tm); }
01192
01193 iter_type
01194 get_monthname(iter_type __beg, iter_type __end, ios_base& __io,
01195 ios_base::iostate& __err, tm* __tm) const
01196 { return this->do_get_monthname(__beg, __end, __io, __err, __tm); }
01197
01198 iter_type
01199 get_year(iter_type __beg, iter_type __end, ios_base& __io,
01200 ios_base::iostate& __err, tm* __tm) const
01201 { return this->do_get_year(__beg, __end, __io, __err, __tm); }
01202
01203 protected:
01204 virtual
01205 ~time_get() { }
01206
01207 virtual dateorder
01208 do_date_order() const;
01209
01210 virtual iter_type
01211 do_get_time(iter_type __beg, iter_type __end, ios_base& __io,
01212 ios_base::iostate& __err, tm* __tm) const;
01213
01214 virtual iter_type
01215 do_get_date(iter_type __beg, iter_type __end, ios_base& __io,
01216 ios_base::iostate& __err, tm* __tm) const;
01217
01218 virtual iter_type
01219 do_get_weekday(iter_type __beg, iter_type __end, ios_base&,
01220 ios_base::iostate& __err, tm* __tm) const;
01221
01222 virtual iter_type
01223 do_get_monthname(iter_type __beg, iter_type __end, ios_base&,
01224 ios_base::iostate& __err, tm* __tm) const;
01225
01226 virtual iter_type
01227 do_get_year(iter_type __beg, iter_type __end, ios_base& __io,
01228 ios_base::iostate& __err, tm* __tm) const;
01229
01230
01231 void
01232 _M_extract_num(iter_type& __beg, iter_type& __end, int& __member,
01233 int __min, int __max, size_t __len,
01234 const ctype<_CharT>& __ctype,
01235 ios_base::iostate& __err) const;
01236
01237
01238
01239 void
01240 _M_extract_name(iter_type& __beg, iter_type& __end, int& __member,
01241 const _CharT** __names, size_t __indexlen,
01242 ios_base::iostate& __err) const;
01243
01244
01245 void
01246 _M_extract_via_format(iter_type& __beg, iter_type& __end, ios_base& __io,
01247 ios_base::iostate& __err, tm* __tm,
01248 const _CharT* __format) const;
01249 };
01250
01251 template<typename _CharT, typename _InIter>
01252 locale::id time_get<_CharT, _InIter>::id;
01253
01254 template<typename _CharT, typename _InIter>
01255 class time_get_byname : public time_get<_CharT, _InIter>
01256 {
01257 public:
01258
01259 typedef _CharT char_type;
01260 typedef _InIter iter_type;
01261
01262 explicit
01263 time_get_byname(const char*, size_t __refs = 0)
01264 : time_get<_CharT, _InIter>(__refs) { }
01265
01266 protected:
01267 virtual
01268 ~time_get_byname() { }
01269 };
01270
01271 template<typename _CharT, typename _OutIter>
01272 class time_put : public locale::facet, public time_base
01273 {
01274 public:
01275
01276 typedef _CharT char_type;
01277 typedef _OutIter iter_type;
01278
01279 static locale::id id;
01280
01281 explicit
01282 time_put(size_t __refs = 0)
01283 : locale::facet(__refs) { }
01284
01285 iter_type
01286 put(iter_type __s, ios_base& __io, char_type __fill, const tm* __tm,
01287 const _CharT* __beg, const _CharT* __end) const;
01288
01289 iter_type
01290 put(iter_type __s, ios_base& __io, char_type __fill,
01291 const tm* __tm, char __format, char __mod = 0) const
01292 { return this->do_put(__s, __io, __fill, __tm, __format, __mod); }
01293
01294 protected:
01295 virtual
01296 ~time_put()
01297 { }
01298
01299 virtual iter_type
01300 do_put(iter_type __s, ios_base& __io, char_type __fill, const tm* __tm,
01301 char __format, char __mod) const;
01302 };
01303
01304 template<typename _CharT, typename _OutIter>
01305 locale::id time_put<_CharT, _OutIter>::id;
01306
01307 template<typename _CharT, typename _OutIter>
01308 class time_put_byname : public time_put<_CharT, _OutIter>
01309 {
01310 public:
01311
01312 typedef _CharT char_type;
01313 typedef _OutIter iter_type;
01314
01315 explicit
01316 time_put_byname(const char* , size_t __refs = 0)
01317 : time_put<_CharT, _OutIter>(__refs)
01318 { };
01319
01320 protected:
01321 virtual
01322 ~time_put_byname() { }
01323 };
01324
01325
01326 class money_base
01327 {
01328 public:
01329 enum part { none, space, symbol, sign, value };
01330 struct pattern { char field[4]; };
01331
01332 static const pattern _S_default_pattern;
01333
01334
01335
01336 static pattern
01337 _S_construct_pattern(char __precedes, char __space, char __posn);
01338 };
01339
01340 template<typename _CharT, bool _Intl>
01341 class moneypunct : public locale::facet, public money_base
01342 {
01343 public:
01344
01345 typedef _CharT char_type;
01346 typedef basic_string<_CharT> string_type;
01347
01348 static const bool intl = _Intl;
01349 static locale::id id;
01350
01351 private:
01352 const char* _M_grouping;
01353 char_type _M_decimal_point;
01354 char_type _M_thousands_sep;
01355 const char_type* _M_curr_symbol;
01356 const char_type* _M_positive_sign;
01357 const char_type* _M_negative_sign;
01358 int _M_frac_digits;
01359 pattern _M_pos_format;
01360 pattern _M_neg_format;
01361
01362 public:
01363 explicit
01364 moneypunct(size_t __refs = 0) : locale::facet(__refs)
01365 { _M_initialize_moneypunct(); }
01366
01367 explicit
01368 moneypunct(__c_locale __cloc, const char* __s, size_t __refs = 0)
01369 : locale::facet(__refs)
01370 { _M_initialize_moneypunct(__cloc, __s); }
01371
01372 char_type
01373 decimal_point() const
01374 { return this->do_decimal_point(); }
01375
01376 char_type
01377 thousands_sep() const
01378 { return this->do_thousands_sep(); }
01379
01380 string
01381 grouping() const
01382 { return this->do_grouping(); }
01383
01384 string_type
01385 curr_symbol() const
01386 { return this->do_curr_symbol(); }
01387
01388 string_type
01389 positive_sign() const
01390 { return this->do_positive_sign(); }
01391
01392 string_type
01393 negative_sign() const
01394 { return this->do_negative_sign(); }
01395
01396 int
01397 frac_digits() const
01398 { return this->do_frac_digits(); }
01399
01400 pattern
01401 pos_format() const
01402 { return this->do_pos_format(); }
01403
01404 pattern
01405 neg_format() const
01406 { return this->do_neg_format(); }
01407
01408 protected:
01409 virtual
01410 ~moneypunct();
01411
01412 virtual char_type
01413 do_decimal_point() const
01414 { return _M_decimal_point; }
01415
01416 virtual char_type
01417 do_thousands_sep() const
01418 { return _M_thousands_sep; }
01419
01420 virtual string
01421 do_grouping() const
01422 { return _M_grouping; }
01423
01424 virtual string_type
01425 do_curr_symbol() const
01426 { return _M_curr_symbol; }
01427
01428 virtual string_type
01429 do_positive_sign() const
01430 { return _M_positive_sign; }
01431
01432 virtual string_type
01433 do_negative_sign() const
01434 { return _M_negative_sign; }
01435
01436 virtual int
01437 do_frac_digits() const
01438 { return _M_frac_digits; }
01439
01440 virtual pattern
01441 do_pos_format() const
01442 { return _M_pos_format; }
01443
01444 virtual pattern
01445 do_neg_format() const
01446 { return _M_neg_format; }
01447
01448
01449 void
01450 _M_initialize_moneypunct(__c_locale __cloc = NULL,
01451 const char* __name = NULL);
01452 };
01453
01454 template<typename _CharT, bool _Intl>
01455 locale::id moneypunct<_CharT, _Intl>::id;
01456
01457 template<typename _CharT, bool _Intl>
01458 const bool moneypunct<_CharT, _Intl>::intl;
01459
01460 template<>
01461 moneypunct<char, true>::~moneypunct();
01462
01463 template<>
01464 moneypunct<char, false>::~moneypunct();
01465
01466 template<>
01467 void
01468 moneypunct<char, true>::_M_initialize_moneypunct(__c_locale, const char*);
01469
01470 template<>
01471 void
01472 moneypunct<char, false>::_M_initialize_moneypunct(__c_locale, const char*);
01473
01474 #ifdef _GLIBCPP_USE_WCHAR_T
01475 template<>
01476 moneypunct<wchar_t, true>::~moneypunct();
01477
01478 template<>
01479 moneypunct<wchar_t, false>::~moneypunct();
01480
01481 template<>
01482 void
01483 moneypunct<wchar_t, true>::_M_initialize_moneypunct(__c_locale,
01484 const char*);
01485
01486 template<>
01487 void
01488 moneypunct<wchar_t, false>::_M_initialize_moneypunct(__c_locale,
01489 const char*);
01490 #endif
01491
01492 template<typename _CharT, bool _Intl>
01493 class moneypunct_byname : public moneypunct<_CharT, _Intl>
01494 {
01495 __c_locale _M_c_locale_moneypunct;
01496
01497 public:
01498 typedef _CharT char_type;
01499 typedef basic_string<_CharT> string_type;
01500
01501 static const bool intl = _Intl;
01502
01503 explicit
01504 moneypunct_byname(const char* __s, size_t __refs = 0)
01505 : moneypunct<_CharT, _Intl>(__refs)
01506 {
01507 _S_create_c_locale(_M_c_locale_moneypunct, __s);
01508 _M_initialize_moneypunct(_M_c_locale_moneypunct);
01509 }
01510
01511 protected:
01512 virtual
01513 ~moneypunct_byname()
01514 { _S_destroy_c_locale(_M_c_locale_moneypunct); }
01515 };
01516
01517 template<typename _CharT, bool _Intl>
01518 const bool moneypunct_byname<_CharT, _Intl>::intl;
01519
01520 template<typename _CharT, typename _InIter>
01521 class money_get : public locale::facet
01522 {
01523 public:
01524
01525 typedef _CharT char_type;
01526 typedef _InIter iter_type;
01527 typedef basic_string<_CharT> string_type;
01528
01529 static locale::id id;
01530
01531 explicit
01532 money_get(size_t __refs = 0) : locale::facet(__refs) { }
01533
01534 iter_type
01535 get(iter_type __s, iter_type __end, bool __intl, ios_base& __io,
01536 ios_base::iostate& __err, long double& __units) const
01537 { return this->do_get(__s, __end, __intl, __io, __err, __units); }
01538
01539 iter_type
01540 get(iter_type __s, iter_type __end, bool __intl, ios_base& __io,
01541 ios_base::iostate& __err, string_type& __digits) const
01542 { return this->do_get(__s, __end, __intl, __io, __err, __digits); }
01543
01544 protected:
01545 virtual
01546 ~money_get() { }
01547
01548 virtual iter_type
01549 do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io,
01550 ios_base::iostate& __err, long double& __units) const;
01551
01552 virtual iter_type
01553 do_get(iter_type __s, iter_type __end, bool __intl, ios_base& __io,
01554 ios_base::iostate& __err, string_type& __digits) const;
01555 };
01556
01557 template<typename _CharT, typename _InIter>
01558 locale::id money_get<_CharT, _InIter>::id;
01559
01560 template<typename _CharT, typename _OutIter>
01561 class money_put : public locale::facet
01562 {
01563 public:
01564 typedef _CharT char_type;
01565 typedef _OutIter iter_type;
01566 typedef basic_string<_CharT> string_type;
01567
01568 static locale::id id;
01569
01570 explicit
01571 money_put(size_t __refs = 0) : locale::facet(__refs) { }
01572
01573 iter_type
01574 put(iter_type __s, bool __intl, ios_base& __io,
01575 char_type __fill, long double __units) const
01576 { return this->do_put(__s, __intl, __io, __fill, __units); }
01577
01578 iter_type
01579 put(iter_type __s, bool __intl, ios_base& __io,
01580 char_type __fill, const string_type& __digits) const
01581 { return this->do_put(__s, __intl, __io, __fill, __digits); }
01582
01583 protected:
01584 virtual
01585 ~money_put() { }
01586
01587 virtual iter_type
01588 do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill,
01589 long double __units) const;
01590
01591 virtual iter_type
01592 do_put(iter_type __s, bool __intl, ios_base& __io, char_type __fill,
01593 const string_type& __digits) const;
01594 };
01595
01596 template<typename _CharT, typename _OutIter>
01597 locale::id money_put<_CharT, _OutIter>::id;
01598
01599
01600 struct messages_base
01601 {
01602 typedef int catalog;
01603 };
01604
01605 template<typename _CharT>
01606 class messages : public locale::facet, public messages_base
01607 {
01608 public:
01609
01610 typedef _CharT char_type;
01611 typedef basic_string<_CharT> string_type;
01612
01613 protected:
01614
01615
01616 __c_locale _M_c_locale_messages;
01617 char* _M_name_messages;
01618
01619 public:
01620 static locale::id id;
01621
01622 explicit
01623 messages(size_t __refs = 0);
01624
01625
01626 explicit
01627 messages(__c_locale __cloc, const char* __s, size_t __refs = 0);
01628
01629 catalog
01630 open(const basic_string<char>& __s, const locale& __loc) const
01631 { return this->do_open(__s, __loc); }
01632
01633
01634 catalog
01635 open(const basic_string<char>&, const locale&, const char*) const;
01636
01637 string_type
01638 get(catalog __c, int __set, int __msgid, const string_type& __s) const
01639 { return this->do_get(__c, __set, __msgid, __s); }
01640
01641 void
01642 close(catalog __c) const
01643 { return this->do_close(__c); }
01644
01645 protected:
01646 virtual
01647 ~messages();
01648
01649 virtual catalog
01650 do_open(const basic_string<char>&, const locale&) const;
01651
01652 virtual string_type
01653 do_get(catalog, int, int, const string_type& __dfault) const;
01654
01655 virtual void
01656 do_close(catalog) const;
01657
01658
01659 char*
01660 _M_convert_to_char(const string_type& __msg) const
01661 {
01662
01663 return reinterpret_cast<char*>(const_cast<_CharT*>(__msg.c_str()));
01664 }
01665
01666
01667 string_type
01668 _M_convert_from_char(char* __msg) const
01669 {
01670
01671 size_t __len = char_traits<char>::length(__msg) - 1;
01672
01673
01674
01675 #if 0
01676
01677
01678
01679 typedef typename codecvt<char, _CharT, mbstate_t> __codecvt_type;
01680
01681 __codecvt_type::state_type __state;
01682
01683
01684
01685 char* __from_next;
01686
01687 _CharT* __to = static_cast<_CharT*>(__builtin_alloca(__len + 1));
01688 const __codecvt_type& __cvt = use_facet<__codecvt_type>(_M_locale_conv);
01689 __cvt.out(__state, __msg, __msg + __len, __from_next,
01690 __to, __to + __len + 1, __to_next);
01691 return string_type(__to);
01692 #endif
01693 #if 0
01694 typedef ctype<_CharT> __ctype_type;
01695
01696 const __ctype_type& __cvt = use_facet<__ctype_type>(locale());
01697
01698
01699 _CharT* __dest = static_cast<_CharT*>(__builtin_alloca(__len + 1));
01700 __cvt.widen(__msg, __msg + __len, __dest);
01701 return basic_string<_CharT>(__dest);
01702 #endif
01703 return string_type();
01704 }
01705 };
01706
01707 template<typename _CharT>
01708 locale::id messages<_CharT>::id;
01709
01710
01711 template<>
01712 string
01713 messages<char>::do_get(catalog, int, int, const string&) const;
01714
01715 #ifdef _GLIBCPP_USE_WCHAR_T
01716 template<>
01717 wstring
01718 messages<wchar_t>::do_get(catalog, int, int, const wstring&) const;
01719 #endif
01720
01721 template<typename _CharT>
01722 class messages_byname : public messages<_CharT>
01723 {
01724 public:
01725 typedef _CharT char_type;
01726 typedef basic_string<_CharT> string_type;
01727
01728 explicit
01729 messages_byname(const char* __s, size_t __refs = 0);
01730
01731 protected:
01732 virtual
01733 ~messages_byname()
01734 { }
01735 };
01736
01737
01738 #include <bits/messages_members.h>
01739
01740
01741
01742
01743
01744
01745 template<typename _CharT>
01746 inline bool
01747 isspace(_CharT __c, const locale& __loc)
01748 { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::space, __c); }
01749
01750 template<typename _CharT>
01751 inline bool
01752 isprint(_CharT __c, const locale& __loc)
01753 { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::print, __c); }
01754
01755 template<typename _CharT>
01756 inline bool
01757 iscntrl(_CharT __c, const locale& __loc)
01758 { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::cntrl, __c); }
01759
01760 template<typename _CharT>
01761 inline bool
01762 isupper(_CharT __c, const locale& __loc)
01763 { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::upper, __c); }
01764
01765 template<typename _CharT>
01766 inline bool islower(_CharT __c, const locale& __loc)
01767 { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::lower, __c); }
01768
01769 template<typename _CharT>
01770 inline bool
01771 isalpha(_CharT __c, const locale& __loc)
01772 { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alpha, __c); }
01773
01774 template<typename _CharT>
01775 inline bool
01776 isdigit(_CharT __c, const locale& __loc)
01777 { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::digit, __c); }
01778
01779 template<typename _CharT>
01780 inline bool
01781 ispunct(_CharT __c, const locale& __loc)
01782 { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::punct, __c); }
01783
01784 template<typename _CharT>
01785 inline bool
01786 isxdigit(_CharT __c, const locale& __loc)
01787 { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::xdigit, __c); }
01788
01789 template<typename _CharT>
01790 inline bool
01791 isalnum(_CharT __c, const locale& __loc)
01792 { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::alnum, __c); }
01793
01794 template<typename _CharT>
01795 inline bool
01796 isgraph(_CharT __c, const locale& __loc)
01797 { return use_facet<ctype<_CharT> >(__loc).is(ctype_base::graph, __c); }
01798
01799 template<typename _CharT>
01800 inline _CharT
01801 toupper(_CharT __c, const locale& __loc)
01802 { return use_facet<ctype<_CharT> >(__loc).toupper(__c); }
01803
01804 template<typename _CharT>
01805 inline _CharT
01806 tolower(_CharT __c, const locale& __loc)
01807 { return use_facet<ctype<_CharT> >(__loc).tolower(__c); }
01808 }
01809
01810 #endif