| 1 |
/* Copyright (C) 2015 Povilas Kanapickas <[email protected]> |
| 2 |
|
| 3 |
This file is part of cppreference-doc |
| 4 |
|
| 5 |
This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 |
| 6 |
Unported License. To view a copy of this license, visit |
| 7 |
http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative |
| 8 |
Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. |
| 9 |
|
| 10 |
Permission is granted to copy, distribute and/or modify this document |
| 11 |
under the terms of the GNU Free Documentation License, Version 1.3 or |
| 12 |
any later version published by the Free Software Foundation; with no |
| 13 |
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. |
| 14 |
*/ |
| 15 |
|
| 16 |
#ifndef CPPREFERENCE_LOCALE_H |
| 17 |
#define CPPREFERENCE_LOCALE_H |
| 18 |
|
| 19 |
namespace std { |
| 20 |
|
| 21 |
class locale { |
| 22 |
public: |
| 23 |
class id { |
| 24 |
public: |
| 25 |
id(); |
| 26 |
}; |
| 27 |
|
| 28 |
class facet { |
| 29 |
public: |
| 30 |
explicit facet(std::size_t refs = 0); |
| 31 |
protected: |
| 32 |
virtual ~facet(); |
| 33 |
}; |
| 34 |
|
| 35 |
typedef int category; |
| 36 |
|
| 37 |
static const category none; |
| 38 |
static const category collate; |
| 39 |
static const category ctype; |
| 40 |
static const category monetary; |
| 41 |
static const category numeric; |
| 42 |
static const category time; |
| 43 |
static const category messages; |
| 44 |
static const category all; |
| 45 |
|
| 46 |
locale(); |
| 47 |
locale(const locale& other); |
| 48 |
explicit locale(const char* std_name); |
| 49 |
explicit locale(const std::string& std_name); |
| 50 |
locale(const locale& other, const char* std_name, category cat); |
| 51 |
locale(const locale& other, const std::string& std_name, category cat); |
| 52 |
template<class Facet > |
| 53 |
locale(const locale& other, Facet* f); |
| 54 |
locale(const locale& other, const locale& one, category cat); |
| 55 |
|
| 56 |
~locale(); |
| 57 |
|
| 58 |
const locale& operator=(const locale& other); |
| 59 |
|
| 60 |
template<class Facet > |
| 61 |
locale combine(const locale& other) const; |
| 62 |
|
| 63 |
std::string name() const; |
| 64 |
|
| 65 |
bool operator==(const locale& other) const; |
| 66 |
bool operator!=(const locale& other) const; |
| 67 |
|
| 68 |
template<class CharT, class Traits, class Alloc > |
| 69 |
bool operator()(const basic_string<CharT, Traits, Alloc>& s1, |
| 70 |
const basic_string<CharT, Traits, Alloc>& s2) const; |
| 71 |
|
| 72 |
static locale global(const locale& loc); |
| 73 |
static const locale& classic(); |
| 74 |
}; |
| 75 |
|
| 76 |
#if CPPREFERENCE_STDVER >= 2011 |
| 77 |
template<class Codecvt, |
| 78 |
class Elem = wchar_t, |
| 79 |
class Wide_alloc = std::allocator<Elem>, |
| 80 |
class Byte_alloc = std::allocator<char> > |
| 81 |
class wstring_convert { |
| 82 |
public: |
| 83 |
explicit wstring_convert(Codecvt* pcvt = new Codecvt); |
| 84 |
wstring_convert(Codecvt* pcvt, state_type state); |
| 85 |
explicit wstring_convert(const byte_string& byte_err, |
| 86 |
const wide_string& wide_err = wide_string()); |
| 87 |
#if CPPREFERENCE_STDVER >= 2014 |
| 88 |
wstring_convert(const std::wstring_convert&) = delete; |
| 89 |
#endif |
| 90 |
|
| 91 |
~wstring_convert(); |
| 92 |
|
| 93 |
wide_string from_bytes(char byte); |
| 94 |
wide_string from_bytes(const char* ptr); |
| 95 |
wide_string from_bytes(const byte_string& str); |
| 96 |
wide_string from_bytes(const char* first, const char* last); |
| 97 |
|
| 98 |
byte_string to_bytes(Elem wchar); |
| 99 |
byte_string to_bytes(const Elem* wptr); |
| 100 |
byte_string to_bytes(const wide_string& wstr); |
| 101 |
byte_string to_bytes(const Elem* first, const Elem* last); |
| 102 |
|
| 103 |
std::size_t converted() const; |
| 104 |
|
| 105 |
state_type state() const; |
| 106 |
}; |
| 107 |
|
| 108 |
template<class Codecvt, |
| 109 |
class Elem = wchar_t, |
| 110 |
class Tr = std::char_traits<Elem> > |
| 111 |
class wbuffer_convert : public std::basic_streambuf<Elem, Tr> { |
| 112 |
public: |
| 113 |
typedef typename Codecvt::state_type state_type; |
| 114 |
|
| 115 |
explicit wbuffer_convert(std::streambuf* bytebuf = 0, |
| 116 |
Codecvt* pcvt = new Codecvt, |
| 117 |
state_type state = state_type()); |
| 118 |
#if CPPREFERENCE_STDVER >= 2014 |
| 119 |
wbuffer_convert(const std::wbuffer_convert&) = delete; |
| 120 |
#endif |
| 121 |
|
| 122 |
~wbuffer_convert(); |
| 123 |
|
| 124 |
std::streambuf* rdbuf() const; |
| 125 |
std::streambuf* rdbuf(std::streambuf* bytebuf); |
| 126 |
|
| 127 |
state_type state() const; |
| 128 |
}; |
| 129 |
|
| 130 |
#endif // CPPREFERENCE_STDVER >= 2011 |
| 131 |
|
| 132 |
class ctype_base { |
| 133 |
public: |
| 134 |
typedef int mask; // actually unspecified |
| 135 |
static const mask space; |
| 136 |
static const mask print; |
| 137 |
static const mask cntrl; |
| 138 |
static const mask upper; |
| 139 |
static const mask lower; |
| 140 |
static const mask alpha; |
| 141 |
static const mask digit; |
| 142 |
static const mask punct; |
| 143 |
static const mask xdigit; |
| 144 |
#if CPPREFERENCE_STDVER >= 2011 |
| 145 |
static const mask blank; |
| 146 |
#endif |
| 147 |
static const mask alnum; |
| 148 |
static const mask graph; |
| 149 |
}; |
| 150 |
|
| 151 |
class codecvt_base { |
| 152 |
public: |
| 153 |
enum result { |
| 154 |
ok, |
| 155 |
partial, |
| 156 |
error, |
| 157 |
noconv |
| 158 |
}; |
| 159 |
}; |
| 160 |
|
| 161 |
class messages_base { |
| 162 |
public: |
| 163 |
typedef int catalog; // actually unspecified |
| 164 |
}; |
| 165 |
|
| 166 |
class time_base { |
| 167 |
public: |
| 168 |
enum dateorder { |
| 169 |
no_order, dmy, mdy, ymd, ydm |
| 170 |
}; |
| 171 |
}; |
| 172 |
|
| 173 |
class money_base { |
| 174 |
public: |
| 175 |
enum part { |
| 176 |
none, space, symbol, sign, value |
| 177 |
}; |
| 178 |
struct pattern { |
| 179 |
char field[4]; |
| 180 |
}; |
| 181 |
}; |
| 182 |
|
| 183 |
template<class CharT> |
| 184 |
class ctype : public ctype_base, public locale::facet { |
| 185 |
public: |
| 186 |
typedef CharT char_type; |
| 187 |
static locale::id id; |
| 188 |
|
| 189 |
explicit ctype(std::size_t refs = 0); |
| 190 |
|
| 191 |
const mask* table() const; // only in char specialization |
| 192 |
static const mask* classic_table(); // only in char specialization |
| 193 |
|
| 194 |
bool is(mask m, CharT c) const; |
| 195 |
const CharT* is(const CharT* low, const CharT* high, mask* vec) const; |
| 196 |
const CharT* scan_is(mask m, const CharT* beg, const CharT* end) const; |
| 197 |
const CharT* scan_not(mask m, const CharT* beg, const CharT* end) const; |
| 198 |
CharT toupper(CharT c) const; |
| 199 |
const CharT* toupper(CharT* beg, const CharT* end) const; |
| 200 |
CharT tolower(CharT c) const; |
| 201 |
const CharT* tolower(CharT* beg, const CharT* end) const; |
| 202 |
CharT widen(char c) const; |
| 203 |
const char* widen(const char* beg, const char* end, CharT* dst) const; |
| 204 |
char narrow(CharT c, char dflt) const; |
| 205 |
const CharT* narrow(const CharT* beg, const CharT* end, |
| 206 |
char dflt, char* dst) const; |
| 207 |
|
| 208 |
protected: |
| 209 |
virtual bool do_is(mask m, CharT c) const; |
| 210 |
virtual const CharT* do_is(const CharT* low, const CharT* high, mask* vec) const; |
| 211 |
virtual const CharT* do_scan_is(mask m, const CharT* beg, const CharT* end) const; |
| 212 |
virtual const CharT* do_scan_not(mask m, const CharT* beg, const CharT* end) const; |
| 213 |
virtual CharT do_toupper(CharT c) const; |
| 214 |
virtual const CharT* do_toupper(CharT* beg, const CharT* end) const; |
| 215 |
virtual CharT do_tolower(CharT c) const; |
| 216 |
virtual const CharT* do_tolower(CharT* beg, const CharT* end) const; |
| 217 |
virtual CharT do_widen(char c) const; |
| 218 |
virtual const char* do_widen(const char* beg, const char* end, CharT* dst) const; |
| 219 |
virtual char do_narrow(CharT c, char dflt) const; |
| 220 |
virtual const CharT* do_narrow(const CharT* beg, const CharT* end, |
| 221 |
char dflt, char* dst) const; |
| 222 |
virtual ~ctype(); |
| 223 |
}; |
| 224 |
|
| 225 |
template<class InternT, class ExternT, class State> |
| 226 |
class codecvt : public codecvt_base, public locale::facet { |
| 227 |
public: |
| 228 |
typedef InternT intern_type; |
| 229 |
typedef ExternT extern_type; |
| 230 |
typedef State state_type; |
| 231 |
|
| 232 |
static locale::id id; |
| 233 |
|
| 234 |
explicit codecvt(std::size_t refs = 0); |
| 235 |
|
| 236 |
result out(StateT& state, |
| 237 |
const InternT* from, |
| 238 |
const InternT* from_end, |
| 239 |
const InternT*& from_next, |
| 240 |
ExternT* to, |
| 241 |
ExternT* to_end, |
| 242 |
ExternT*& to_next) const; |
| 243 |
result in(stateT& state, |
| 244 |
const externT* from, |
| 245 |
const externT* from_end, |
| 246 |
const externT*& from_next, |
| 247 |
internT* to, |
| 248 |
internT* to_end, |
| 249 |
internT*& to_next) const; |
| 250 |
result unshift(StateT& state, |
| 251 |
ExternT* to, |
| 252 |
ExternT* to_end, |
| 253 |
ExternT*& to_next) const; |
| 254 |
int encoding() const; |
| 255 |
bool always_noconv() const; |
| 256 |
int length(StateT& state, |
| 257 |
const ExternT* from, |
| 258 |
const ExternT* from_end, |
| 259 |
std::size_t max) const; |
| 260 |
int max_length() const; |
| 261 |
|
| 262 |
protected: |
| 263 |
virtual result do_out(StateT& state, |
| 264 |
const InternT* from, |
| 265 |
const InternT* from_end, |
| 266 |
const InternT*& from_next, |
| 267 |
ExternT* to, |
| 268 |
ExternT* to_end, |
| 269 |
ExternT*& to_next) const; |
| 270 |
virtual result do_in(stateT& state, |
| 271 |
const externT* from, |
| 272 |
const externT* from_end, |
| 273 |
const externT*& from_next, |
| 274 |
internT* to, |
| 275 |
internT* to_end, |
| 276 |
internT*& to_next) const; |
| 277 |
virtual result do_unshift(StateT& state, |
| 278 |
ExternT* to, |
| 279 |
ExternT* to_end, |
| 280 |
ExternT*& to_next) const; |
| 281 |
virtual int do_encoding() const; |
| 282 |
virtual bool do_always_noconv() const; |
| 283 |
virtual int do_length(StateT& state, |
| 284 |
const ExternT* from, |
| 285 |
const ExternT* from_end, |
| 286 |
std::size_t max) const; |
| 287 |
virtual int do_max_length() const; |
| 288 |
virtual ~codecvt(); |
| 289 |
}; |
| 290 |
|
| 291 |
template<class CharT> |
| 292 |
class collate : public locale::facet { |
| 293 |
public: |
| 294 |
typedef CharT char_type; |
| 295 |
typedef std::basic_string<CharT> string_type; |
| 296 |
static locale::id id; |
| 297 |
|
| 298 |
explicit collate(std::size_t refs = 0); |
| 299 |
|
| 300 |
int compare(const CharT* low1, const CharT* high1, |
| 301 |
const CharT* low2, const CharT* high2) const; |
| 302 |
string_type transform(const CharT* low, const CharT* high) const; |
| 303 |
long hash(const CharT* beg, const CharT* end) const; |
| 304 |
|
| 305 |
protected: |
| 306 |
virtual int do_compare(const CharT* low1, const CharT* high1, |
| 307 |
const CharT* low2, const CharT* high2) const; |
| 308 |
virtual string_type do_transform(const CharT* low, const CharT* high) const; |
| 309 |
virtual long do_hash(const CharT* beg, const CharT* end) const; |
| 310 |
virtual ~collate(); |
| 311 |
}; |
| 312 |
|
| 313 |
template<class CharT> |
| 314 |
class messages : public messages_base, public locale::facet { |
| 315 |
public: |
| 316 |
typedef CharT char_type; |
| 317 |
typedef std::basic_string<CharT> string_type; |
| 318 |
static locale::id id; |
| 319 |
|
| 320 |
explicit messages(std::size_t refs = 0); |
| 321 |
|
| 322 |
catalog open(const std::basic_string<char>& name, const std::locale& loc) const; |
| 323 |
string_type get(catalog cat, int set, int msgid, const string_type& dfault) const; |
| 324 |
void close(catalog c) const; |
| 325 |
|
| 326 |
protected: |
| 327 |
virtual catalog do_open(const std::basic_string<char>& name, const std::locale& loc) const; |
| 328 |
virtual string_type do_get(catalog cat, int set, int msgid, const string_type& dfault) const; |
| 329 |
virtual void do_close(catalog c) const; |
| 330 |
virtual ~messages(); |
| 331 |
}; |
| 332 |
|
| 333 |
template < |
| 334 |
class CharT, |
| 335 |
class InputIt = std::istreambuf_iterator<CharT> |
| 336 |
> class time_get : public time_base, public locale::facet { |
| 337 |
public: |
| 338 |
typedef CharT char_type; |
| 339 |
typedef InputIt iter_type; |
| 340 |
static locale::id id; |
| 341 |
|
| 342 |
explicit time_get(std::size_t refs = 0); |
| 343 |
|
| 344 |
public: |
| 345 |
dateorder date_order() const; |
| 346 |
iter_type get_time(iter_type beg, iter_type end, std::ios_base& str, |
| 347 |
std::ios_base::iostate& err, std::tm* t) const; |
| 348 |
iter_type get_date(iter_type beg, iter_type end, std::ios_base& str, |
| 349 |
std::ios_base::iostate& err, std::tm* t) const; |
| 350 |
iter_type get_weekday(iter_type beg, iter_type end, std::ios_base& str, |
| 351 |
std::ios_base::iostate& err, std::tm* t) const; |
| 352 |
iter_type get_monthname(iter_type beg, iter_type end, std::ios_base& str, |
| 353 |
std::ios_base::iostate& err, std::tm* t) const; |
| 354 |
iter_type do_get_year(iter_type s, iter_type end, std::ios_base& str, |
| 355 |
std::ios_base::iostate& err, std::tm* t) const; |
| 356 |
|
| 357 |
#if CPPREFERENCE_STDVER >= 2011 |
| 358 |
iter_type get(iter_type beg, iter_type end, std::ios_base& str, |
| 359 |
std::ios_base::iostate& err, std::tm* t, |
| 360 |
const char_type* fmtbeg, const char_type* fmtend) const; |
| 361 |
#endif |
| 362 |
|
| 363 |
protected: |
| 364 |
virtual dateorder do_date_order() const; |
| 365 |
virtual iter_type get_time(iter_type beg, iter_type end, std::ios_base& str, |
| 366 |
std::ios_base::iostate& err, std::tm* t) const; |
| 367 |
virtual iter_type do_get_date(iter_type beg, iter_type end, std::ios_base& str, |
| 368 |
std::ios_base::iostate& err, std::tm* t) const; |
| 369 |
virtual iter_type do_get_weekday(iter_type beg, iter_type end, std::ios_base& str, |
| 370 |
std::ios_base::iostate& err, std::tm* t) const; |
| 371 |
virtual iter_type do_get_monthname(iter_type beg, iter_type end, std::ios_base& str, |
| 372 |
std::ios_base::iostate& err, std::tm* t) const; |
| 373 |
virtual iter_type do_get_year(iter_type s, iter_type end, std::ios_base& str, |
| 374 |
std::ios_base::iostate& err, std::tm* t) const; |
| 375 |
#if CPPREFERENCE_STDVER >= 2011 |
| 376 |
virtual iter_type do_get(iter_type neg, iter_type end, std::ios_base& str, |
| 377 |
std::ios_base::iostate& err, std::tm* t, |
| 378 |
char format, char modifier) const; |
| 379 |
#endif |
| 380 |
virtual ~time_get(); |
| 381 |
}; |
| 382 |
|
| 383 |
template < |
| 384 |
class CharT, |
| 385 |
class OutputIt = std::ostreambuf_iterator<CharT> |
| 386 |
> class time_put : public time_base, public locale::facet { |
| 387 |
public: |
| 388 |
typedef CharT char_type; |
| 389 |
typedef OutputIt iter_type; |
| 390 |
static locale::id id; |
| 391 |
|
| 392 |
explicit time_put(std::size_t refs = 0); |
| 393 |
|
| 394 |
|
| 395 |
iter_type put(iter_type out, std::ios_base& str, |
| 396 |
char_type fill, const std::tm* t, |
| 397 |
const CharT* fmtbeg, const CharT* fmtend) const; |
| 398 |
iter_type put(iter_type out, std::ios_base& str, |
| 399 |
char_type fill, const std::tm* t, |
| 400 |
char format, char modifier = 0) const; |
| 401 |
|
| 402 |
protected: |
| 403 |
virtual iter_type do_put(iter_type out, std::ios_base& str, |
| 404 |
char_type fill, const std::tm* t, |
| 405 |
char format, char modifier) const; |
| 406 |
virtual ~time_put(); |
| 407 |
}; |
| 408 |
|
| 409 |
template < |
| 410 |
class CharT, |
| 411 |
class InputIt = std::istreambuf_iterator<CharT> |
| 412 |
> class num_get : public locale::facet { |
| 413 |
public: |
| 414 |
typedef CharT char_type; |
| 415 |
typedef InputIt iter_type; |
| 416 |
static locale::id id; |
| 417 |
|
| 418 |
explicit num_get(std::size_t refs = 0); |
| 419 |
|
| 420 |
iter_type get(iter_type in, iter_type end, std::ios_base& str, |
| 421 |
std::ios_base::iostate& err, bool& v) const; |
| 422 |
iter_type get(iter_type in, iter_type end, std::ios_base& str, |
| 423 |
std::ios_base::iostate& err, long& v) const; |
| 424 |
iter_type get(iter_type in, iter_type end, std::ios_base& str, |
| 425 |
std::ios_base::iostate& err, long long& v) const; |
| 426 |
iter_type get(iter_type in, iter_type end, std::ios_base& str, |
| 427 |
std::ios_base::iostate& err, unsigned short& v) const; |
| 428 |
iter_type get(iter_type in, iter_type end, std::ios_base& str, |
| 429 |
std::ios_base::iostate& err, unsigned int& v) const; |
| 430 |
iter_type get(iter_type in, iter_type end, std::ios_base& str, |
| 431 |
std::ios_base::iostate& err, unsigned long& v) const; |
| 432 |
iter_type get(iter_type in, iter_type end, std::ios_base& str, |
| 433 |
std::ios_base::iostate& err, unsigned long long& v) const; |
| 434 |
iter_type get(iter_type in, iter_type end, std::ios_base& str, |
| 435 |
std::ios_base::iostate& err, float& v) const; |
| 436 |
iter_type get(iter_type in, iter_type end, std::ios_base& str, |
| 437 |
std::ios_base::iostate& err, double& v) const; |
| 438 |
iter_type get(iter_type in, iter_type end, std::ios_base& str, |
| 439 |
std::ios_base::iostate& err, long double& v) const; |
| 440 |
iter_type get(iter_type in, iter_type end, std::ios_base& str, |
| 441 |
std::ios_base::iostate& err, void*& v) const; |
| 442 |
|
| 443 |
protected: |
| 444 |
virtual iter_type do_get(iter_type in, iter_type end, std::ios_base& str, |
| 445 |
std::ios_base::iostate& err, bool& v) const; |
| 446 |
virtual iter_type do_get(iter_type in, iter_type end, std::ios_base& str, |
| 447 |
std::ios_base::iostate& err, long& v) const; |
| 448 |
virtual iter_type do_get(iter_type in, iter_type end, std::ios_base& str, |
| 449 |
std::ios_base::iostate& err, long long& v) const; |
| 450 |
virtual iter_type do_get(iter_type in, iter_type end, std::ios_base& str, |
| 451 |
std::ios_base::iostate& err, unsigned short& v) const; |
| 452 |
virtual iter_type do_get(iter_type in, iter_type end, std::ios_base& str, |
| 453 |
std::ios_base::iostate& err, unsigned int& v) const; |
| 454 |
virtual iter_type do_get(iter_type in, iter_type end, std::ios_base& str, |
| 455 |
std::ios_base::iostate& err, unsigned long& v) const; |
| 456 |
virtual iter_type do_get(iter_type in, iter_type end, std::ios_base& str, |
| 457 |
std::ios_base::iostate& err, unsigned long long& v) const; |
| 458 |
virtual iter_type do_get(iter_type in, iter_type end, std::ios_base& str, |
| 459 |
std::ios_base::iostate& err, float& v) const; |
| 460 |
virtual iter_type do_get(iter_type in, iter_type end, std::ios_base& str, |
| 461 |
std::ios_base::iostate& err, double& v) const; |
| 462 |
virtual iter_type do_get(iter_type in, iter_type end, std::ios_base& str, |
| 463 |
std::ios_base::iostate& err, long double& v) const; |
| 464 |
virtual iter_type do_get(iter_type in, iter_type end, std::ios_base& str, |
| 465 |
std::ios_base::iostate& err, void*& v) const; |
| 466 |
virtual ~num_get(); |
| 467 |
}; |
| 468 |
|
| 469 |
template < |
| 470 |
class CharT, |
| 471 |
class OutputIt = std::ostreambuf_iterator<CharT> |
| 472 |
> class num_put : public locale::facet { |
| 473 |
public: |
| 474 |
typedef CharT char_type; |
| 475 |
typedef OutputIt iter_type; |
| 476 |
static locale::id id; |
| 477 |
|
| 478 |
explicit num_put(std::size_t refs = 0); |
| 479 |
|
| 480 |
iter_type put(iter_type out, std::ios_base& str, char_type fill, bool v) const; |
| 481 |
iter_type put(iter_type out, std::ios_base& str, char_type fill, long v) const; |
| 482 |
iter_type put(iter_type out, std::ios_base& str, char_type fill, long long v) const; |
| 483 |
iter_type put(iter_type out, std::ios_base& str, char_type fill, unsigned long v) const; |
| 484 |
iter_type put(iter_type out, std::ios_base& str, char_type fill, unsigned long long v) const; |
| 485 |
iter_type put(iter_type out, std::ios_base& str, char_type fill, double v) const; |
| 486 |
iter_type put(iter_type out, std::ios_base& str, char_type fill, long double v) const; |
| 487 |
iter_type put(iter_type out, std::ios_base& str, char_type fill, const void* v) const; |
| 488 |
|
| 489 |
protected: |
| 490 |
virtual iter_type do_put(iter_type out, std::ios_base& str, char_type fill, bool v) const; |
| 491 |
virtual iter_type do_put(iter_type out, std::ios_base& str, char_type fill, long v) const; |
| 492 |
virtual iter_type do_put(iter_type out, std::ios_base& str, char_type fill, long long v) const; |
| 493 |
virtual iter_type do_put(iter_type out, std::ios_base& str, char_type fill, unsigned long) const; |
| 494 |
virtual iter_type do_put(iter_type out, std::ios_base& str, char_type fill, unsigned long long) const; |
| 495 |
virtual iter_type do_put(iter_type out, std::ios_base& str, char_type fill, double v) const; |
| 496 |
virtual iter_type do_put(iter_type out, std::ios_base& str, char_type fill, long double v) const; |
| 497 |
virtual iter_type do_put(iter_type out, std::ios_base& str, char_type fill, const void* v) const; |
| 498 |
virtual ~num_put(); |
| 499 |
}; |
| 500 |
|
| 501 |
template<class CharT> |
| 502 |
class numpunct : public locale::facet { |
| 503 |
public: |
| 504 |
typedef CharT char_type; |
| 505 |
typedef std::basic_string<CharT> string_type; |
| 506 |
static locale::id id; |
| 507 |
|
| 508 |
explicit numpunct(std::size_t refs = 0); |
| 509 |
|
| 510 |
char_type decimal_point() const; |
| 511 |
char_type thousands_sep() const; |
| 512 |
std::string grouping() const; |
| 513 |
string_type truename() const; |
| 514 |
string_type falsename() const; |
| 515 |
|
| 516 |
protected: |
| 517 |
virtual char_type do_decimal_point() const; |
| 518 |
virtual char_type do_thousands_sep() const; |
| 519 |
virtual std::string do_grouping() const; |
| 520 |
virtual string_type do_truename() const; |
| 521 |
virtual string_type do_falsename() const; |
| 522 |
virtual ~numpunct(); |
| 523 |
}; |
| 524 |
|
| 525 |
template < |
| 526 |
class CharT, |
| 527 |
class InputIt = std::istreambuf_iterator<CharT> |
| 528 |
> class money_get : public locale::facet { |
| 529 |
public: |
| 530 |
typedef CharT char_type; |
| 531 |
typedef std::basic_string<CharT> string_type; |
| 532 |
typedef InputIt iter_type; |
| 533 |
static locale::id id; |
| 534 |
|
| 535 |
explicit money_get(std::size_t refs = 0); |
| 536 |
iter_type get(iter_type beg, iter_type end, bool intl, std::ios_base& str, |
| 537 |
std::ios_base::iostate& err, long double& units) const; |
| 538 |
iter_type get(iter_type beg, iter_type end, bool intl, std::ios_base& str, |
| 539 |
std::ios_base::iostate& err, string_type& digits) const; |
| 540 |
|
| 541 |
protected: |
| 542 |
virtual iter_type do_get(iter_type beg, iter_type end, bool intl, std::ios_base& str, |
| 543 |
std::ios_base::iostate& err, long double& units) const; |
| 544 |
virtual iter_type do_get(iter_type beg, iter_type end, bool intl, std::ios_base& str, |
| 545 |
std::ios_base::iostate& err, string_type& digits) const; |
| 546 |
virtual ~money_get(); |
| 547 |
}; |
| 548 |
|
| 549 |
template < |
| 550 |
class CharT, |
| 551 |
class OutputIt = std::ostreambuf_iterator<CharT> |
| 552 |
> class money_put : public locale::facet { |
| 553 |
public: |
| 554 |
typedef CharT char_type; |
| 555 |
typedef std::basic_string<CharT> string_type; |
| 556 |
typedef OutputIt iter_type; |
| 557 |
static locale::id id; |
| 558 |
|
| 559 |
explicit money_put(std::size_t refs = 0); |
| 560 |
|
| 561 |
iter_type put(iter_type out, bool intl, std::ios_base& f, |
| 562 |
char_type fill, long double quant) const; |
| 563 |
iter_type put(iter_type out, bool intl, std::ios_base& f, |
| 564 |
char_type fill, const string_type& quant) const; |
| 565 |
|
| 566 |
protected: |
| 567 |
virtual iter_type do_put(iter_type out, bool intl, std::ios_base& str, |
| 568 |
char_type fill, long double units) const; |
| 569 |
virtual iter_type do_put(iter_type out, bool intl, std::ios_base& str, |
| 570 |
char_type fill, const string_type& digits) const; |
| 571 |
virtual ~money_put(); |
| 572 |
}; |
| 573 |
|
| 574 |
template<class CharT, bool International = false > |
| 575 |
class moneypunct : public money_base, public locale::facet { |
| 576 |
public: |
| 577 |
typedef CharT char_type; |
| 578 |
typedef std::basic_string<CharT> string_type; |
| 579 |
typedef typename money_base::pattern pattern; |
| 580 |
|
| 581 |
explicit moneypunct(std::size_t refs = 0); |
| 582 |
|
| 583 |
CharT decimal_point() const; |
| 584 |
char_type thousands_sep() const; |
| 585 |
std::string grouping() const; |
| 586 |
string_type curr_symbol() const; |
| 587 |
string_type positive_sign() const; |
| 588 |
string_type negative_sign() const; |
| 589 |
int frac_digits() const; |
| 590 |
pattern pos_format() const; |
| 591 |
pattern neg_format() const; |
| 592 |
|
| 593 |
protected: |
| 594 |
virtual CharT do_decimal_point() const; |
| 595 |
virtual char_type do_thousands_sep() const; |
| 596 |
virtual std::string do_grouping() const; |
| 597 |
virtual string_type do_curr_symbol() const; |
| 598 |
virtual string_type do_positive_sign() const; |
| 599 |
virtual string_type do_negative_sign() const; |
| 600 |
virtual int do_frac_digits() const; |
| 601 |
virtual pattern do_pos_format() const; |
| 602 |
virtual pattern do_neg_format() const; |
| 603 |
virtual ~moneypunct(); |
| 604 |
}; |
| 605 |
|
| 606 |
template<class CharT> |
| 607 |
class ctype_byname : public ctype<CharT> { |
| 608 |
public: |
| 609 |
explicit ctype_byname(const char* name, std::size_t refs = 0); |
| 610 |
#if CPPREFERENCE_STDVER >= 2011 |
| 611 |
explicit ctype_byname(const std::string& name, std::size_t refs = 0); |
| 612 |
#endif |
| 613 |
protected: |
| 614 |
~ctype_byname(); |
| 615 |
}; |
| 616 |
|
| 617 |
template<class InternT, class ExternT, class State> |
| 618 |
class codecvt_byname : public codecvt<InternT, ExternT, State> { |
| 619 |
public: |
| 620 |
explicit codecvt_byname(const char* name, std::size_t refs = 0); |
| 621 |
#if CPPREFERENCE_STDVER >= 2011 |
| 622 |
explicit codecvt_byname(const std::string& name, std::size_t refs = 0); |
| 623 |
#endif |
| 624 |
protected: |
| 625 |
~codecvt_byname(); |
| 626 |
}; |
| 627 |
|
| 628 |
template<class CharT> |
| 629 |
class messages_byname : public messages<CharT> { |
| 630 |
public: |
| 631 |
explicit messages_byname(const char* name, std::size_t refs = 0); |
| 632 |
#if CPPREFERENCE_STDVER >= 2011 |
| 633 |
explicit messages_byname(const std::string& name, std::size_t refs = 0); |
| 634 |
#endif |
| 635 |
protected: |
| 636 |
~messages_byname(); |
| 637 |
}; |
| 638 |
|
| 639 |
template<class CharT> |
| 640 |
class collate_byname : public collate<CharT> { |
| 641 |
public: |
| 642 |
explicit collate_byname(const char* name, std::size_t refs = 0); |
| 643 |
#if CPPREFERENCE_STDVER >= 2011 |
| 644 |
explicit collate_byname(const std::string& name, std::size_t refs = 0); |
| 645 |
#endif |
| 646 |
protected: |
| 647 |
~collate_byname(); |
| 648 |
}; |
| 649 |
|
| 650 |
template<class CharT, class InputIt> |
| 651 |
class time_get_byname : public time_get<CharT, InputIt> { |
| 652 |
public: |
| 653 |
explicit time_get_byname(const char* name, std::size_t refs = 0); |
| 654 |
#if CPPREFERENCE_STDVER >= 2011 |
| 655 |
explicit time_get_byname(const std::string& name, std::size_t refs = 0); |
| 656 |
#endif |
| 657 |
protected: |
| 658 |
~time_get_byname(); |
| 659 |
}; |
| 660 |
|
| 661 |
template<class CharT, class OutputIt> |
| 662 |
class time_put_byname : public time_put<CharT, OutputIt> { |
| 663 |
public: |
| 664 |
explicit time_put_byname(const char* name, std::size_t refs = 0); |
| 665 |
#if CPPREFERENCE_STDVER >= 2011 |
| 666 |
explicit time_put_byname(const std::string& name, std::size_t refs = 0); |
| 667 |
#endif |
| 668 |
protected: |
| 669 |
~time_put_byname(); |
| 670 |
}; |
| 671 |
|
| 672 |
template<class CharT> |
| 673 |
class numpunct_byname : public numpunct<CharT> { |
| 674 |
public: |
| 675 |
explicit numpunct_byname(const char* name, std::size_t refs = 0); |
| 676 |
#if CPPREFERENCE_STDVER >= 2011 |
| 677 |
explicit numpunct_byname(const std::string& name, std::size_t refs = 0); |
| 678 |
#endif |
| 679 |
protected: |
| 680 |
~numpunct_byname(); |
| 681 |
}; |
| 682 |
|
| 683 |
template<class CharT, bool International = false> |
| 684 |
class moneypunct_byname : public moneypunct<CharT, International> { |
| 685 |
public: |
| 686 |
typedef typename money_base::pattern pattern; |
| 687 |
|
| 688 |
explicit moneypunct_byname(const char* name, std::size_t refs = 0); |
| 689 |
#if CPPREFERENCE_STDVER >= 2011 |
| 690 |
explicit moneypunct_byname(const std::string& name, std::size_t refs = 0); |
| 691 |
#endif |
| 692 |
protected: |
| 693 |
~moneypunct_byname(); |
| 694 |
}; |
| 695 |
|
| 696 |
template<class Facet> |
| 697 |
const Facet& use_facet(const locale& loc); |
| 698 |
template<class Facet> |
| 699 |
const Facet& has_facet(const locale& loc); |
| 700 |
|
| 701 |
template<class CharT> bool isspace(CharT c, const locale& loc); |
| 702 |
#if CPPREFERENCE_STDVER >= 2011 |
| 703 |
template<class CharT> bool isblank(CharT c, const locale& loc); |
| 704 |
#endif |
| 705 |
template<class CharT> bool iscntrl(CharT c, const locale& loc); |
| 706 |
template<class CharT> bool isupper(CharT c, const locale& loc); |
| 707 |
template<class CharT> bool islower(CharT c, const locale& loc); |
| 708 |
template<class CharT> bool isalpha(CharT c, const locale& loc); |
| 709 |
template<class CharT> bool isdigit(CharT c, const locale& loc); |
| 710 |
template<class CharT> bool ispunct(CharT c, const locale& loc); |
| 711 |
template<class CharT> bool isxdigit(CharT c, const locale& loc); |
| 712 |
template<class CharT> bool isalnum(CharT c, const locale& loc); |
| 713 |
template<class CharT> bool isprint(CharT c, const locale& loc); |
| 714 |
template<class CharT> bool isgraph(CharT c, const locale& loc); |
| 715 |
template<class CharT> CharT toupper(CharT c, const locale& loc); |
| 716 |
template<class CharT> CharT tolower(CharT c, const locale& loc); |
| 717 |
} // namespace std |
| 718 |
|
| 719 |
#endif // CPPREFERENCE_LOCALE_H |