<locale>codecvt
· codecvt_base
· codecvt_byname
· collate
· collate_byname
· ctype · ctype<char>
· ctype_base
· ctype_byname
· has_facet
· locale
· messages
· messages_base
· messages_byname
· money_base
· money_get
· money_put
· moneypunct
· moneypunct_byname
· num_get
· num_put
· numpunct
· numpunct_byname
· time_base
· time_get
· time_get_byname
· time_put
· time_put_byname
· use_facet
isalnum
· isalpha
· iscntrl
· isdigit
· isgraph
· islower
· isprint
· ispunct
· isspace
· isupper
· isxdigit
· tolower
· toupper
namespace std {
class locale;
class ctype_base;
template<class E>
class ctype;
template<>
class ctype<char>;
template<class E>
class ctype_byname;
class codecvt_base;
template<class From, class To, class State>
class codecvt;
template<class From, class To, class State>
class codecvt_byname;
template<class E, class InIt>
class num_get;
template<class E, class OutIt>
class num_put;
template<class E>
class numpunct;
template<class E>
class numpunct_byname;
template<class E>
class collate;
template<class E>
class collate_byname;
class time_base;
template<class E, class InIt>
class time_get;
template<class E, class InIt>
class time_get_byname;
template<class E, class OutIt>
class time_put;
template<class E, class OutIt>
class time_put_byname;
class money_base;
template<class E, bool Intl, class InIt>
class money_get;
template<class E, bool Intl, class OutIt>
class money_put;
template<class E, bool Intl>
class moneypunct;
template<class E, bool Intl>
class moneypunct_byname;
class messages_base;
template<class E>
class messages;
template<class E>
class messages_byname;
// TEMPLATE FUNCTIONS
template<class Facet>
bool has_facet(const locale& loc);
template<class Facet>
const Facet& use_facet(const locale& loc);
template<class E>
bool isspace(E c, const locale& loc) const;
template<class E>
bool isprint(E c, const locale& loc) const;
template<class E>
bool iscntrl(E c, const locale& loc) const;
template<class E>
bool isupper(E c, const locale& loc) const;
template<class E>
bool islower(E c, const locale& loc) const;
template<class E>
bool isalpha(E c, const locale& loc) const;
template<class E>
bool isdigit(E c, const locale& loc) const;
template<class E>
bool ispunct(E c, const locale& loc) const;
template<class E>
bool isxdigit(E c, const locale& loc) const;
template<class E>
bool isalnum(E c, const locale& loc) const;
template<class E>
bool isgraph(E c, const locale& loc) const;
template<class E>
E toupper(E c, const locale& loc) const;
template<class E>
E tolower(E c, const locale& loc) const;
};
Include the standard header <locale>
to define a host of template classes and functions that
encapsulate and manipulate locales.
codecvttemplate<class From, class To, class State>
class codecvt
: public locale::facet, public codecvt_base {
public:
typedef From from_type;
typedef To to_type;
typedef State state_type;
explicit codecvt(size_t refs = 0);
result in(State& state,
const To *first1, const To *last1,
const To *next1,
From *first2, From *last2, From *next2);
result out(State& state,
const From *first1, const From *last1,
const From *next1,
To *first2, To *last2, To *next2);
result unshift(State& state,
To *first2, To *last2, To *next2);
bool always_noconv() const throw();
int max_length() const throw();
int length(State& state,
From *first1, const From *last1,
size_t _N2) const throw();
int encoding() const throw();
static locale::id id;
protected:
~codecvt();
virtual result do_in(State& state,
const To *first1, const To *last1,
const To *next1,
From *first2, From *last2, From *next2);
virtual result do_out(State& state,
const From *first1, const From *last1,
const From *next1,
To *first2, To *last2, To *next2);
virtual result do_unshift(State& state,
To *first2, To *last2, To *next2);
virtual bool do_always_noconv() const throw();
virtual int do_max_length() const throw();
virtual int do_encoding() const throw();
virtual int do_length(State& state,
From *first1, const From *last1,
size_t len2) const throw();
};
The template class describes an object that can serve as a locale facet,
to control conversions between a sequence of values of type From
and a sequence of values of type To. The class State
characterizes the transformation -- and an object of class State
stores any necessary state information during a conversion.
As with any locale facet, the static object id has an initial stored value
of zero. The first attempt to access its stored value stores a
unique positive value in id.
The template versions of do_in and do_out
always return codecvt_base::noconv.
The Standard C++ library defines an explicit specialization,
however, that is more useful:
template<>
codecvt<wchar_t, char, mbstate_t>
which converts between wchar_t and char
sequences.
codecvt::always_noconvbool always_noconv() const throw();
The member function returns do_always_noconv().
codecvt::codecvtexplicit codecvt(size_t refs = 0);
The constructor initializes its locale::facet
base object with locale::facet(refs).
codecvt::do_always_noconvvirtual bool do_always_noconv() const throw();
The protected virtual member function returns true only if
every call to do_in or do_out
returns noconv.
The template version always returns true.
codecvt::do_encodingvirtual int do_encoding() const throw();
The protected virtual member function returns:
to_type
is state dependentn, if the encoding involves only sequences
of length ncodecvt::do_invirtual result do_in(State state&,
const To *first1, const To *last1, const To *next1,
From *first2, From *last2, From *next2);
The protected virtual member function endeavors to convert the
source sequence at [first1, last1) to a destination
sequence that it stores within [first2, last2). It
always stores in next1 a pointer to the first
unconverted element in the source sequence, and it always stores
in next2 a pointer to the first unaltered element in
the destination sequence.
state must represent the initial
conversion state at the beginning of a new source sequence.
The function alters its stored value, as needed, to reflect the
current state of a successful conversion. Its stored value is
otherwise unspecified.
The function returns:
codecvt_base::error
if the source sequence is ill formedcodecvt_base::noconv
if the function performs no conversioncodecvt_base::ok if
the conversion succeedscodecvt_base::partial
if the source is insufficient, or if the destination is
not large enough, for the conversion to succeedThe template version always returns noconv.
codecvt::do_lengthvirtual int do_length(State state&,
From *first1, const From *last1,
size_t len2) const throw();
The protected virtual member function effectively calls do_out(state,
first1, last1, next1, buf, buf + len2, next2) for some
buffer buf and pointer next2, then
returns next2 - buf. (Thus, it is roughly analogous
to the function mbrlen,
at least when From is type char.)
The template version always returns the lesser of last1
- first1 and len2.
codecvt::do_max_lengthvirtual int do_max_length() const throw();
The protected virtual member function returns the largest
permissible value that can be returned by do_length(first1,
last1, 1), for arbitrary valid values of first1
and last1. (Thus, it is roughly analogous to the
macro MB_CUR_MAX,
at least when From is type char.)
The template version always returns 1.
codecvt::do_outvirtual result do_out(State state&,
const From *first1, const From *last1,
const From *next1,
To *first2, To *last2, To *next2);
The protected virtual member function endeavors to convert the
source sequence at [first1, last1) to a destination
sequence that it stores within [first2, last2). It
always stores in next1 a pointer to the first
unconverted element in the source sequence, and it always stores
in next2 a pointer to the first unaltered element in
the destination sequence.
state must represent the initial
conversion state at the beginning of a new source sequence.
The function alters its stored value, as needed, to reflect the
current state of a successful conversion. Its stored value is
otherwise unspecified.
The function returns:
codecvt_base::error
if the source sequence is ill formedcodecvt_base::noconv
if the function performs no conversioncodecvt_base::ok if
the conversion succeedscodecvt_base::partial
if the source is insufficient, or if the destination is
not large enough, for the conversion to succeedThe template version always returns noconv.
codecvt::do_unshiftvirtual result do_unshift(State state&,
To *first2, To *last2, To *next2);
The protected virtual member function endeavors to convert the
source element From(0) to a destination sequence
that it stores within [first2, last2), except for
the terminating element To(0). It always stores in next2
a pointer to the first unaltered element in the destination
sequence.
state must represent the initial
conversion state at the beginning of a new source sequence.
The function alters its stored value, as needed, to reflect the
current state of a successful conversion. Typically, converting
the source element From(0) leaves the current state
in the initial conversion state.
The function returns:
codecvt_base::error
if state represents an invalid statecodecvt_base::noconv
if the function performs no conversioncodecvt_base::ok if
the conversion succeedscodecvt_base::partial
if the destination is not large enough for the conversion
to succeedThe template version always returns noconv.
codecvt::from_typetypedef From from_type;
The type is a synonym for the template parameter From.
codecvt::inresult in(State state&,
const To *first1, const To *last1, const To *next1,
From *first2, From *last2, From *next2);
The member function returns do_in(state, first1,
last1, next1, first2, last2, next2).
codecvt::lengthint length(State state&,
From *first1, const From *last1,
size_t len2) const throw();
The member function returns do_length(first1,
last1, len2).
codecvt::encodingint encoding() const throw();
The member function returns do_encoding().
codecvt::max_lengthint max_length() const throw();
The member function returns do_max_length().
codecvt::outresult out(State state&,
const From *first1, const From *last1,
const From *next1,
To *first2, To *last2, To *next2);
The member function returns do_out(state, first1,
last1, next1, first2, last2, next2).
codecvt::state_typetypedef State state_type;
The type is a synonym for the template parameter State.
codecvt::to_typetypedef To to_type;
The type is a synonym for the template parameter To.
codecvt::unshiftresult unshift(State state&,
To *first2, To *last2, To *next2);
The member function returns do_unshift(state,
first2, last2, next2).
codecvt_baseclass codecvt_base {
public:
enum result {ok, partial, error, noconv};
};
The class describes an enumeration common to all
specializations of template class codecvt. The
enumeration result
describes the possible return values from do_in
or do_out:
error
if the source sequence is ill formednoconv
if the function performs no conversionok if
the conversion succeedspartial
if the destination is not large enough for the conversion
to succeedcodecvt_bynametemplate<class From, class To, class State>
class codecvt_byname
: public codecvt<From, To, State> {
public:
explicit codecvt_byname(const char *s,
size_t refs = 0);
protected:
~codecvt_byname();
};
The template class describes an object that can serve as a locale facet
of type codecvt<From,
To, State>. Its behavior is determined by the named
locale s. The constructor initializes its base
object with codecvt<From, To,
State>(refs).
collatetemplate<class E>
class collate : public locale::facet {
public:
typedef E char_type;
typedef basic_string<E> string_type;
explicit collate(size_t refs = 0);
int compare(const E *first1, const E *last1,
const E *first2, const E *last2) const;
string_type transform(const E *first,
const E *last) const;
long hash(const E *first, const E *last) const;
static locale::id id;
protected:
~collate();
virtual int
do_compare(const E *first1, const E *last1,
const E *first2, const E *last2) const;
virtual string_type do_transform(const E *first,
const E *last) const;
virtual long do_hash(const E *first,
const E *last) const;
};
The template class describes an object that can serve as a locale facet,
to control comparisons of sequences of type E.
As with any locale facet, the static object id has an initial stored value
of zero. The first attempt to access its stored value stores a
unique positive value in id.
collate::char_typetypedef E char_type;
The type is a synonym for the template parameter E.
collate::collateexplicit collate(size_t refs = 0);
The constructor initializes its base object with locale::facet(refs).
collate::compareint compare(const E *first1, const E *last1,
const E *first2, const E *last2) const;
The member function returns do_compare(first1,
last1, first2, last2).
collate::do_comparevirtual int do_compare(const E *first1, const E *last1,
const E *first2, const E *last2) const;
The protected virtual member function compares the sequence at
[first1, last1) with the sequence at [first2,
last2). It compares values by applying operator<
between pairs of corresponding elements of type E.
The first sequence compares less if it has the smaller element in
the earliest unequal pair in the sequences, or if no unequal
pairs exist but the first sequence is shorter.
If the first sequence compares less than the second sequence, the function returns -1. If the second sequence compares less, the function returns +1. Otherwise, the function returns zero.
collate::do_hashvirtual long do_hash(const E *first,
const E *last) const;
The protected virtual member function returns an integer
derived from the values of the elements in the sequence [first,
last). Such a hash value can be useful, for
example, in distributing sequences pseudo randomly across an
array of lists.
collate::do_transformvirtual string_type do_transform(const E *first,
const E *last) const;
The protected virtual member function returns an object of
class string_type
whose controlled sequence is a copy of the sequence [first,
last). If a class derived from collate<E>
overrides do_compare,
it should also override do_transform to match. Put
simply, two transformed strings should yield the same result,
when passed to collate::compare, that you would get
from passing the untransformed strings to compare in
the derived class.
collate::hashlong hash(const E *first, const E *last) const;
The member function returns do_hash(first, last).
collate::string_typetypedef basic_string<E> string_type;
The type describes a specialization of template class basic_string whose
objects can store copies of the source sequence.
collate::transformstring_type transform(const E *first,
const E *last) const;
The member function returns do_transform(first,
last).
collate_bynametemplate<class E>
class collate_byname : public collate<E> {
public:
explicit collate_byname(const char *s,
size_t refs = 0);
protected:
~collate_byname();
};
The template class describes an object that can serve as a locale facet
of type collate<E>.
Its behavior is determined by the named locale s.
The constructor initializes its base object with collate<E>(refs).
ctypechar_type · ctype ·
do_is
· do_narrow
· do_scan_is
· do_scan_not
· do_tolower
· do_toupper
· do_widen
· is ·
narrow
· scan_is
· scan_not
· tolower
· toupper
· widen
template<class E>
class ctype
: public locale::facet, public ctype_base {
public:
typedef E char_type;
explicit ctype(size_t refs = 0);
bool is(mask msk, E ch) const;
const E *is(const E *first, const E *last,
mask *dst) const;
const E *scan_is(mask msk, const E *first,
const E *last) const;
const E *scan_not(mask msk, const E *first,
const E *last) const;
E toupper(E ch) const;
const E *toupper(E *first, E *last) const;
E tolower(E ch) const;
const E *tolower(E *first, E *last) const;
E widen(char ch) const;
const char *widen(char *first, char *last,
E *dst) const;
char narrow(E ch, char dflt) const;
const E *narrow(const E *first, const E *last,
char dflt, char *dst) const;
static locale::id id;
protected:
~ctype();
virtual bool do_is(mask msk, E ch) const;
virtual const E *do_is(const E *first, const E *last,
mask *dst) const;
virtual const E *do_scan_is(mask msk, const E *first,
const E *last) const;
virtual const E *do_scan_not(mask msk, const E *first,
const E *last) const;
virtual E do_toupper(E ch) const;
virtual const E *do_toupper(E *first, E *last) const;
virtual E do_tolower(E ch) const;
virtual const E *do_tolower(E *first, E *last) const;
virtual E do_widen(char ch) const;
virtual const char *do_widen(char *first, char *last,
E *dst) const;
virtual char do_narrow(E ch, char dflt) const;
virtual const E *do_narrow(const E *first,
const E *last, char dflt, char *dst) const;
};
The template class describes an object that can serve as a locale facet,
to characterize various properties of a ``character'' (element)
of type E. Such a facet also converts between
sequences of E elements and sequences of char.
As with any locale facet, the static object id has an initial stored value of
zero. The first attempt to access its stored value stores a
unique positive value in id.
The Standard C++ library defines two specializations of this template class:
ctype<char>,
an explicit specialization whose differences are
described spparatelyctype<wchar_t>, which treats elements
as wide
charactersIn this implementation,
other specializations of template class ctype<E>:
ch of type E to
a value of type char with the expression (char)chc of type char to a
value of type E with the expression E(c)All other operations are performed on char values the
same as for the explicit specialization ctype<char>.
ctype::char_typetypedef E char_type;
The type is a synonym for the template parameter E.
ctype::ctypeexplicit ctype(size_t refs = 0);
The type is a synonym for the template parameter E.
ctype::do_isvirtual bool do_is(mask msk, E ch) const;
virtual const E *do_is(const E *first, const E *last,
mask *dst) const;
The first protected member template function returns true if MASK(ch)
& msk is nonzero, where MASK(ch)
designates the mapping between an element value ch
and its classification mask, of type mask. The name
MASK is purely symbolic here; it is not defined by
the template class. For an object of class ctype<char>,
the mapping is tab[(unsigned char)(char)ch], where tab
is the stored pointer to the ctype mask table.
The second protected member template function stores in dst[I]
the value MASK(first[I]) & msk, where I
ranges over the interval [0, last - first).
ctype::do_narrowvirtual char do_narrow(E ch, char dflt) const;
virtual const E *do_narrow(const E *first, const E *last,
char dflt, char *dst) const;
The first protected member template function returns (char)ch,
or dflt if that expression is undefined.
The second protected member template function stores in dst[I]
the value do_narrow(first[I], dflt), for I
in the interval [0, last - first).
ctype::do_scan_isvirtual const E *do_scan_is(mask msk, const E *first,
const E *last) const;
The protected member function returns the smallest pointer p
in the range [first, last) for which do_is(msk,
*p) is true. If no such value exists, the function returns
last.
ctype::do_scan_notvirtual const E *do_scan_not(mask msk, const E *first,
const E *last) const;
The protected member function returns the smallest pointer p
in the range [first, last) for which do_is(msk,
*p) is false. If no such value exists, the function
returns last.
ctype::do_tolowervirtual E do_tolower(E ch) const; virtual const E *do_tolower(E *first, E *last) const;
The first protected member template function returns the
lowercase character corresponding to ch, if such a
character exists. Otherwise, it returns ch.
The second protected member template function replaces each
element first[I], for I in the interval
[0, last - first), with do_tolower(first[I].
ctype::do_touppervirtual E do_toupper(E ch) const; virtual const E *do_toupper(E *first, E *last) const;
The first protected member template function returns the
uppercase character corresponding to ch, if such a
character exists. Otherwise, it returns ch.
The second protected member template function replaces each
element first[I], for I in the interval
[0, last - first), with do_toupper(first[I].
ctype::do_widenvirtual E do_widen(char ch) const;
virtual const char *do_widen(char *first, char *last,
E *dst) const;
The first protected member template function returns E(ch).
The second protected member template function stores in dst[I]
the value do_widen(first[I]), for I in
the interval [0, last - first).
ctype::isbool is(mask msk, E ch) const;
const E *is(const E *first, const E *last,
mask *dst) const;
The first member function returns do_is(msk, ch).
The second member function returns do_is(first, last, dst).
ctype::narrowchar narrow(E ch, char dflt) const;
const E *narrow(const E *first, const E *last,
char dflt, char *dst) const;
The first member function returns do_narrow(ch, dflt).
The second member function returns do_narrow(first, last,
dflt, dst).
ctype::scan_isconst E *scan_is(mask msk, const E *first,
const E *last) const;
The member function returns do_scan_is(msk,
first, last).
ctype::scan_notconst E *scan_not(mask msk, const E *first,
const E *last) const;
The member function returns do_scan_not(msk,
first, last).
ctype::tolowerE tolower(E ch) const; const E *tolower(E *first, E *last) const;
The member function returns do_tolower(first,
last).
ctype::toupperE toupper(E ch) const; const E *toupper(E *first, E *last) const;
The member function returns do_toupper(first,
last).
ctype::widenE widen(char ch) const; const char *widen(char *first, char *last, E *dst) const;
The member function returns do_widen(first, last,
dst).
ctype<char>template<>
class ctype<char>
: public locale::facet, public ctype_base {
public:
typedef char char_type;
explicit ctype(const mask *tab = 0, bool del = false,
size_t refs = 0);
bool is(mask msk, char ch) const;
const char *is(const char *first, const char *last,
mask *dst) const;
const char *scan_is(mask msk,
const char *first, const char *last) const;
const char *scan_not(mask msk,
const char *first, const char *last) const;
char toupper(char ch) const;
const char *toupper(char *first, char *last) const;
char tolower(char ch) const;
const char *tolower(char *first, char *last) const;
char widen(char ch) const;
const char *widen(char *first, char *last,
char *dst) const;
char narrow(char ch, char dflt) const;
const char *narrow(const char *first,
const char *last, char dflt, char *dst) const;
static locale::id id;
protected:
~ctype();
virtual char do_toupper(char ch) const;
virtual const char *do_toupper(char *first,
char *last) const;
virtual char do_tolower(char ch) const;
virtual const char *do_tolower(char *first,
char *last) const;
virtual char do_widen(char ch) const;
virtual const char *do_widen(char *first, char *last,
char *dst) const;
virtual char do_narrow(char ch, char dflt) const;
virtual const char *do_narrow(const char *first,
const char *last, char dflt, char *dst) const;
const mask *table() const throw();
static const mask *classic_table() const throw();
static const size_t table_size;
};
The class is an explicit specialization of template class ctype
for type char. Hence, it describes an object that can
serve as a locale facet, to
characterize various properties of a ``character'' (element) of
type char. The explicit specialization differs from the
template class in several ways:
ctype<char> stores
a pointer to the first element of a ctype mask table, an
array of UCHAR_MAX
+ 1 elements of type ctype_base::mask.
It also stores a boolean object that indicates whether
the array should be deleted when the ctype<E>
object is destroyed.tab,
the ctype mask table, and del, the boolean
object that is true if the array should be deleted when
the ctype<char> object is destroyed --
as well as the usual reference-count parameter refs.table()
returns the stored ctype mask table.table_size
specifies the minimum number of elements in a ctype mask
table.classic_table()
returns the ctype mask table appropriate to the "C"
locale.do_is,
do_scan_is,
or do_scan_not.
The corresponding public member functions perform the
equivalent operations themselves.do_narrow
and do_widen
simply copy elements unaltered.ctype_baseclass ctype_base {
public:
enum mask;
static const mask space, print, cntrl,
upper, lower, digit, punct, xdigit,
alpha, alnum, graph;
};
The class serves as a base class for facets of template class ctype.
It defines just the enumerated type mask and several constants
of this type. Each of the constants characterizes a different way
to classify characters, as defined by the functions with similar
names declared in the header <ctype.h>. The
constants are:
space
(function isspace)print
(function isprint)cntrl
(function iscntrl)upper
(function isupper)lower
(function islower)digit
(function isdigit)punct
(function ispunct)xdigit
(function isxdigit)alpha
(function isalpha)alnum
(function isalnum)graph
(function isgraph)You can charaterize a combination of classifications by ORing
these constants. In particular, it is always true that alnum
== (alpha | digit) and graph == (alnum | punct).
ctype_bynametemplate<class E>
class ctype_byname : public ctype<E> {
public:
explicit ctype_byname(const char *s,
size_t refs = 0);
protected:
~ctype_byname();
};
The template class describes an object that can serve as a locale facet
of type ctype<E>.
Its behavior is determined by the named locale s.
The constructor initializes its base object with ctype<E>(refs)
(or the equivalent for base class ctype<char>).
has_facettemplate<class Facet>
bool has_facet(const locale& loc);
The template function returns true if a locale facet of class Facet
is listed within the locale object loc.
isalnumtemplate<class E>
bool isalnum(E c, const locale& loc) const;
The template function returns use_facet< ctype<E>
>(loc). is(ctype<E>::
alnum,
c).
isalphatemplate<class E>
bool isalpha(E c, const locale& loc) const;
The template function returns use_facet< ctype<E>
>(loc). is(ctype<E>::
alpha,
c).
iscntrltemplate<class E>
bool iscntrl(E c, const locale& loc) const;
The template function returns use_facet< ctype<E>
>(loc). is(ctype<E>::
cntrl,
c).
isdigittemplate<class E>
bool isdigit(E c, const locale& loc) const;
The template function returns use_facet< ctype<E>
>(loc). is(ctype<E>::
digit,
c).
isgraphtemplate<class E>
bool isgraph(E c, const locale& loc) const;
The template function returns use_facet< ctype<E>
>(loc). is(ctype<E>::
graph,
c).
islowertemplate<class E>
bool islower(E c, const locale& loc) const;
The template function returns use_facet< ctype<E>
>(loc). is(ctype<E>::
lower,
c).
isprinttemplate<class E>
bool isprint(E c, const locale& loc) const;
The template function returns use_facet< ctype<E>
>(loc). is(ctype<E>::
print,
c).
ispuncttemplate<class E>
bool ispunct(E c, const locale& loc) const;
The template function returns use_facet< ctype<E>
>(loc). is(ctype<E>::
punct,
c).
isspacetemplate<class E>
bool isspace(E c, const locale& loc) const;
The template function returns use_facet< ctype<E>
>(loc). is(ctype<E>::
space,
c).
isuppertemplate<class E>
bool isupper(E c, const locale& loc) const;
The template function returns use_facet< ctype<E>
>(loc). is(ctype<E>::
upper,
c).
isxdigittemplate<class E>
bool isxdigit(E c, const locale& loc) const;
The template function returns use_facet< ctype<E>
>(loc). is(ctype<E>::
xdigit,
c).
localecategory · classic
· combine
· facet
· global
· id
· locale
· name
· operator!=
· operator()
· operator==
class locale {
public:
class facet;
class id;
typedef int category;
static const category none, collate, ctype, monetary,
numeric, time, messages, all;
locale();
explicit locale(const char *s);
locale(const locale& x, const locale& y,
category cat);
locale(const locale& x, const char *s, category cat);
template<class Facet>
locale(const locale& x, Facet *fac);
template<class Facet>
locale combine(const locale& x) const;
template<class E, class T, class A>
bool operator()(const basic_string<E, T, A>& lhs,
const basic_string<E, T, A>& rhs) const;
string name() const;
bool operator==(const locale& x) const;
bool operator!=(const locale& x) const;
static locale global(const locale& x);
static const locale& classic();
};
The class describes a locale object
that encapsulates a locale. It
represents culture-specific information as a list of facets. A facet is a pointer to an
object of a class derived from class facet that has a
public object of the form:
static locale::id id;
You can define an open-ended set of these facets. You can also construct a locale object that designates an arbitrary number of facets.
Predefined groups of these facets represent the locale categories
traditionally managed in the Standard C library by the function setlocale.
Category collate (LC_COLLATE) includes the
facets:
collate<char> collate<wchar_t>
Category ctype (LC_CTYPE) includes the
facets:
ctype<char> ctype<wchar_t> codecvt<char, char, mbstate_t> codecvt<wchar_t, char, mbstate_t>
Category monetary (LC_MONETARY) includes
the facets:
moneypunct<char, false> moneypunct<wchar_t, false> moneypunct<char, true> moneypunct<wchar_t, true> money_get<char, istreambuf_iterator<char> > money_get<wchar_t, istreambuf_iterator<wchar_t> > money_put<char, ostreambuf_iterator<char> > money_put<wchar_t, ostreambuf_iterator<wchar_t> >
Category numeric (LC_NUMERIC) includes the
facets:
num_get<char, istreambuf_iterator<char> > num_get<wchar_t, istreambuf_iterator<wchar_t> > num_put<char, ostreambuf_iterator<char> > num_put<wchar_t, ostreambuf_iterator<wchar_t> > numpunct<char> numpunct<wchar_t>
Category time (LC_TIME) includes the
facets:
time_get<char, istreambuf_iterator<char> > time_get<wchar_t, istreambuf_iterator<wchar_t> > time_put<char, ostreambuf_iterator<char> > time_put<wchar_t, ostreambuf_iterator<wchar_t> >
Category messages
[sic] (LC_MESSAGE) includes the facets:
messages<char> messages<wchar_t>
(The last category is required by Posix, but not the C Standard.)
Some of these predefined facets are used by the iostreams classes, to control the conversion of numeric values to and from text sequences.
An object of class locale also stores a locale name as an object of class string. Using an invalid
locale name to construct a locale facet or a locale
object throws an object of class runtime_error. The
stored locale name is "*" if the locale
object cannot be certain that a C-style locale corresponds
exactly to that represented by the object. Otherwise, you can
establish a matching locale within the Standard C library, for
the locale object x, by calling setlocale( LC_ALL, x.name. c_str()).
In this implementation, you can also call the static member function:
static locale empty();
to construct a locale object that has no facets. It is also a transparent locale -- if the
template functions has_facet and use_facet
cannot find the requested facet in a transparent locale, they
consult first the global locale and then,
if that is transparent, the classic locale. Thus,
you can write:
cout.imbue(locale::empty());
Subsequent insertions to cout
are mediated by the current state of the global locale. You can
even write:
locale loc(locale::empty(), locale::classic(),
locale::numeric);
cout.imbue(loc);
Numeric formatting rules for subsequent insertions to cout
remain the same as in the C locale,
even as the global locale supplies changing rules for inserting
dates and monetary amounts.
locale::categorytypedef int category;
static const category none, collate, ctype, monetary,
numeric, time, messages, all;
The type is a synonym for int, so that it can represent
any of the C locale
categories. It can also represent a group of constants local
to class locale:
none,
corresponding to none of the the C categoriescollate,
corresponding to the C category LC_COLLATEctype,
corresponding to the C category LC_CTYPEmonetary,
corresponding to the C category LC_MONETARYnumeric,
corresponding to the C category LC_NUMERICtime,
corresponding to the C category LC_TIMEmessages,
corresponding to the Posix category LC_MESSAGEall,
corresponding to the C union of all categories LC_ALLYou can represent an arbitrary group of categories by ORing
these constants, as in monetary | time.
locale::classicstatic const locale& classic();
The static member function returns a locale object that represents the classic locale, which behaves the same as the C locale within the Standard C library.
locale::combinetemplate<class Facet>
locale combine(const locale& x) const;
The member function returns a locale object that replaces (or
adds) to *this the facet Facet listed
in x.
locale::facetclass facet {
protected:
explicit facet(size_t refs = 0);
virtual ~facet();
private:
facet(const facet&) // not defined
void operator=(const facet&) // not defined
};
The member class serves as the base class for all locale
facets. Note that you can neither copy nor assign an object
of class facet. You can construct and destroy
objects derived from class locale::facet, but not
objects of the base class proper. Typically, you construct an
object myfac derived from facet when
you construct a locale, as in:
locale loc(locale::classic(), new myfac);
In such cases, the constructor for the base class facet
should have a zero refs argument. When the object is
no longer needed, it is deleted. Thus, you supply a nonzero refs
argument only in those rare cases where you take responsibility
for the lifetime of the object.
locale::globalstatic locale global(const locale& x);
The static member function stores a copy of x as
the global locale. It also
calls setlocale( LC_ALL, x.name. c_str()), to
establishing a matching locale within the Standard C library. The
function then returns the previous global locale. At program startup,
the global locale is the same as the classic locale.
locale::idclass id {
protected:
id();
private:
id(const id&) // not defined
void operator=(const id&) // not defined
};
The member class describes the static member object required
by each unique locale facet. Note that
you can neither copy nor assign an object of class id.
locale::localelocale();
explicit locale(const char *s);
locale(const locale& x, const locale& y,
category cat);
locale(const locale& x, const char *s, category cat);
template<class Facet>
locale(const locale& x, Facet *fac);
The first constructor initializes the object to match the global
locale. The second constructor initializes all the locale categories to have
behavior consistent with the locale name s.
The remaining constructors copy x, with the
exceptions noted:
locale(const locale& x, const locale& y,
category cat);
replaces from y those facets corresponding to a
category c for which c & cat is
nonzero.
locale(const locale& x, const char *s, category cat);
replaces from locale(s, all) those facets
corresponding to a category c for which c
& cat is nonzero.
template<class Facet>
locale(const locale& x, Facet *fac);
replaces (or adds) the facet Facet with fac,
if fac is not a null pointer.
If a locale name s is a null pointer or otherwise
invalid, the function throws runtime_error.
locale::namestring name() const;
The member function returns the stored locale name.
locale::operator!=bool operator!=(const locale& x) const;
The member function returns !(*this == x).
locale::operator()template<class E, class T, class A>
bool operator()(const basic_string<E, T, A>& lhs,
const basic_string<E, T, A>& rhs);
The member function effectively executes:
const collate<E>& fac = use_fac<collate<E> >(*this);
return (fac.compare(lhs.begin(), lhs.end(),
rhs.begin(), rhs.end()) < 0);
Thus, you can use a locale object as a function object.
locale::operator==bool operator==(const locale& x) const;
The member function returns true only if *this and x
are copies of the same locale or have the same name (other than "*").
messagestemplate<class E>
class messages
: public locale::facet, public messages_base {
public:
typedef E char_type;
typedef basic_string<E> string_type;
explicit messages(size_t refs = 0);
catalog open(const string& name,
const locale& loc) const;
string_type get(catalog cat, int set, int msg,
const string_type& dflt) const;
void close(catalog cat) const;
static locale::id id;
protected:
~messages();
virtual catalog do_open(const string& name,
const locale& loc) const;
virtual string_type do_get(catalog cat, int set,
int msg, const string_type& dflt) const;
virtual void do_close(catalog cat) const;
};
The template class describes an object that can serve as a locale facet,
to characterize various properties of a message catalog that can supply
messages represented as sequences of elements of type E.
As with any locale facet, the static object id has an initial stored value
of zero. The first attempt to access its stored value stores a
unique positive value in id.
messages::char_typetypedef E char_type;
The type is a synonym for the template parameter E.
messages::closevoid close(catalog cat) const;
The member function calls do_close(cat);.
messages::do_closevirtual void do_close(catalog cat) const;
The protected member function closes the message
catalog, which must have been opened by an earlier
call to do_open.
messages::do_getvirtual string_type do_get(catalog cat, int set, int msg,
const string_type& dflt) const;
The protected member function endeavors to obtain a message
sequence from the message catalog
cat. It may make use of set, msg,
and dflt in doing so. It returns a copy of dflt
on failure. Otherwise, it returns a copy of the specified message
sequence.
messages::do_openvirtual catalog do_open(const string& name,
const locale& loc) const;
The protected member function endeavors to open a message
catalog whose name is name. It may make
use of the locale loc in doing so. It returns a
value that compares less than zero on failure. Otherwise, the
returned value can be used as the first argument on a later call
to get.
It should in any case be used as the argument on a later call to close.
In this implementation, the function always returns zero.
messages::getstring_type get(catalog cat, int set, int msg,
const string_type& dflt) const;
The member function returns do_get(cat, set, msg,
dflt);.
messages::messagesexplicit messages(size_t refs = 0);
The constructor initializes its base object with locale::facet(refs).
messages::opencatalog open(const string& name,
const locale& loc) const;
The member function returns do_open(name, loc);.
messages::string_typetypedef basic_string<E> string_type;
The type describes a specialization of template class basic_string whose
objects can store copies of the message sequences.
messages_baseclass messages_base {
typedef int catalog;
};
The class describes a type common to all specializations of
template class messages. The type catalog is a synonym
for type int that describes the possible return values
from messages::do_open.
messages_bynametemplate<class E>
class messages_byname : public messages<E> {
public:
explicit messages_byname(const char *s,
size_t refs = 0);
protected:
~messages_byname();
};
The template class describes an object that can serve as a locale facet
of type messages<E>.
Its behavior is determined by the named locale s.
The constructor initializes its base object with messages<E>(refs).
money_baseclass money_base {
enum part {none, sign, space, symbol, value};
struct pattern {
char field[4];
};
};
The class describes an enumeration and a structure common to
all specializations of template class moneypunct. The
enumeration part
describes the possible values in elements of the array field in the structure pattern. The values of part
are:
none
to match zero or more spaces or generate nothingsign
to match or generate a positive or negative signspace
to match zero or more spaces or generate a spacesymbol
to match or generate a currency symbolvalue
to match or generate a monetary valuemoney_gettemplate<class E,
class InIt = istreambuf_iterator<E> >
class money_get : public locale::facet {
public:
typedef E char_type;
typedef InIt iter_type;
typedef basic_string<E> string_type;
explicit money_get(size_t refs = 0);
iter_type get(iter_type first, iter_type last,
bool intl, ios_base& x, ios_base::iostate& st,
long double& val) const;
iter_type get(iter_type first, iter_type last,
bool intl, ios_base& x, ios_base::iostate& st,
string_type& val) const;
static locale::id id;
protected:
~money_get();
virtual iter_type do_get(iter_type first,
iter_type last, bool intl, ios_base& x,
ios_base::iostate& st, string_type& val) const;
virtual iter_type do_get(iter_type first,
iter_type last, bool intl, ios_base& x,
ios_base::iostate& st, long double& val) const;
};
The template class describes an object that can serve as a locale facet,
to control conversions of sequences of type E to
monetary values.
As with any locale facet, the static object id has an initial stored
value of zero. The first attempt to access its stored value
stores a unique positive value in id.
money_get::char_typetypedef E char_type;
The type is a synonym for the template parameter E.
money_get::do_getvirtual iter_type do_get(iter_type first, iter_type last,
bool intl, ios_base& x, ios_base::iostate& st,
string_type& val) const;
virtual iter_type do_get(iter_type first, iter_type last,
bool intl, ios_base& x, ios_base::iostate& st,
long double& val) const;
The first virtual protected member function endeavors to match
sequential elements beginning at first in the
sequence [first, last) until it has recognized a
complete, nonempty monetary
input field. If successful, it converts this field to a
sequence of one or more decimal digits, optionally preceded by a
minus sign (-), to represent the amount and stores
the result in the string_type
object val. It returns an iterator designating the
first element beyond the monetary input field. Otherwise, the
function stores an empty sequence in val and sets ios_base::failbit
in st. It returns an iterator designating the first
element beyond any prefix of a valid monetary input field. In
either case, if the return value equals last, the
function sets ios_base::eofbit in st.
The second virtual protected member function behaves the same
as the first, except that if successful it converts the
optionally-signed digit sequence to a value of type long
double and stores that value in val.
The format of a monetary input field is determined by the locale facet
fac returned by the (effective) call use_facet
<moneypunct<E,
intl>(x. getloc()).
Specifically:
fac.neg_format()
determines the order in which components of the field
occurfac.curr_symbol()
determines the sequence of elements that constitutes a
currency symbolfac.positive_sign()
determines the sequence of elements that constitutes a
positive signfac.negative_sign()
determines the sequence of elements that constitutes a
negative signfac.grouping()
determines how digits are grouped to the left of any
decimal pointfac.thousands_sep()
determines the element that separates groups of digits to
the left of any decimal pointfac.decimal_point()
determines the element that separates the integer digits
from the fraction digitsfac.frac_digits()
determines the number of significant fraction digits to
the right of any decimal pointIf the sign string (fac.negative_sign or fac.positive_sign)
has more than one element, only the first element is matched
where the element equal to money_base::sign
appears in the format pattern (fac.neg_format). Any
remaining elements are matched at the end of the monetary input
field. If neither string has a first element that matches the
next element in the monetary input field, the sign string is
taken as empty and the sign is positive.
If x.flags() &
showbase is
nonzero, the string fac.curr_symbol must
match where the element equal to money_base::symbol
appears in the format pattern. Otherwise, if money_base::symbol
occurs at the end of the format pattern, and if no elements of
the sign string remain to be matched, the currency symbol is not
matched. Otherwise, the currency symbol is optionally
matched.
If no instances of fac.thousands_sep() occur in
the value portion of the monetary input field (where the element
equal to money_base::value
appears in the format pattern), no grouping constraint is
imposed. Otherwise, any grouping constraints imposed by fac.grouping()
is enforced. Note that the resulting digit sequence represents an
integer whose low-order fac.frac_digits() decimal
digits are considered to the right of the decimal point.
Arbitrary white
space is matched where the element equal to money_base::space
appears in the format pattern, if it appears other than at the
end of the format pattern. Otherwise, no internal white space is
matched. An element c is considered white space if use_facet
<ctype<E>(x.
getloc()). is(ctype_base::
space,
c) is true.
money_get::getiter_type get(iter_type first, iter_type last,
bool intl, ios_base& x, ios_base::iostate& st,
long double& val) const;
iter_type get(iter_type first, iter_type last,
bool intl, ios_base& x, ios_base::iostate& st,
string_type& val) const;
Both member functions return do_get(first, last,
intl, x, st, val).
money_get::iter_typetypedef InIt iter_type;
The type is a synonym for the template parameter InIt.
money_get::money_getexplicit money_get(size_t refs = 0);
The constructor initializes its base object with locale::facet(refs).
money_get::string_typetypedef basic_string<E> string_type;
The type describes a specialization of template class basic_string whose
objects can store sequences of elements from the source sequence.
money_puttemplate<class E,
class OutIt = ostreambuf_iterator<E> >
class money_put : public locale::facet {
public:
typedef E char_type;
typedef OutIt iter_type;
typedef basic_string<E> string_type;
explicit money_put(size_t refs = 0);
iter_type put(iter_type next, bool intl, ios_base& x,
E fill, long double& val) const;
iter_type put(iter_type next, bool intl, ios_base& x,
E fill, string_type& val) const;
static locale::id id;
protected:
~money_put();
virtual iter_type do_put(iter_type next, bool intl,
ios_base& x, E fill, string_type& val) const;
virtual iter_type do_put(iter_type next, bool intl,
ios_base& x, E fill, long double& val) const;
};
The template class describes an object that can serve as a locale facet,
to control conversions of monetary values to sequences of type E.
As with any locale facet, the static object id has an initial stored
value of zero. The first attempt to access its stored value
stores a unique positive value in id.
money_put::char_typetypedef E char_type;
The type is a synonym for the template parameter E.
money_put::do_putvirtual iter_type do_put(iter_type next, bool intl,
ios_base& x, E fill, string_type& val) const;
virtual iter_type do_put(iter_type next, bool intl,
ios_base& x, E fill, long double& val) const;
The first virtual protected member function generates
sequential elements beginning at next to produce a monetary output field from
the string_type
object val. The sequence controlled by val
must begin with one or more decimal digits, optionally preceded
by a minus sign (-), which represents the amount.
The function returns an iterator designating the first element
beyond the generated monetary output field.
The second virtual protected member function behaves the same
as the first, except that it effectively first converts val
to a sequence of decimal digits, optionally preceded by a minus
sign, then converts that sequence as above.
The format of a monetary output field is determined by the locale facet
fac returned by the (effective) call use_facet
<moneypunct<E,
intl>(x. getloc()).
Specifically:
fac.pos_format()
determines the order in which components of the field are
generated for a non-negative valuefac.neg_format()
determines the order in which components of the field are
generated for a negative valuefac.curr_symbol()
determines the sequence of elements to generate for a
currency symbolfac.positive_sign()
determines the sequence of elements to generate for a
positive signfac.negative_sign()
determines the sequence of elements to generate for a
negative signfac.grouping()
determines how digits are grouped to the left of any
decimal pointfac.thousands_sep()
determines the element that separates groups of digits to
the left of any decimal pointfac.decimal_point()
determines the element that separates the integer digits
from any fraction digitsfac.frac_digits()
determines the number of significant fraction digits to
the right of any decimal pointIf the sign string (fac.negative_sign or fac.positive_sign)
has more than one element, only the first element is generated
where the element equal to money_base::sign
appears in the format pattern (fac.neg_format or fac.pos_format).
Any remaining elements are generated at the end of the monetary
output field.
If x.flags() &
showbase is
nonzero, the string fac.curr_symbol is generated
where the element equal to money_base::symbol
appears in the format pattern. Otherwise, no currency symbol is
generated.
If no grouping constraints are imposed by fac.grouping()
(its first element has the value CHAR_MAX) then no instances
of fac.thousands_sep() are generated in the value
portion of the monetary output field (where the element equal to money_base::value
appears in the format pattern). If fac.frac_digits()
is zero, then no instance of fac.decimal_point() is
generated after the decimal digits. Otherwise, the resulting
monetary output field places the low-order fac.frac_digits()
decimal digits to the right of the decimal point.
Padding
occurs as for any numeric output field, except that if x.flags()
& x.internal
is nonzero, any internal padding is generated where the element
equal to money_base::space
appears in the format pattern, if it does appear. Otherwise,
internal padding occurs before the generated sequence. The
padding character is fill.
The function calls x.width(0) to reset the field
width to zero.
money_put::putiter_type put(iter_type next, bool intl, ios_base& x,
E fill, long double& val) const;
iter_type put(iter_type next, bool intl, ios_base& x,
E fill, string_type& val) const;
Both member functions return do_put(next, intl,
x, fill, val).
money_put::iter_typetypedef InIt iter_type;
The type is a synonym for the template parameter OutIt.
money_put::money_putexplicit money_put(size_t refs = 0);
The constructor initializes its base object with locale::facet(refs).
money_put::string_typetypedef basic_string<E> string_type;
The type describes a specialization of template class basic_string whose
objects can store sequences of elements from the source sequence.
moneypunctchar_type · curr_symbol
· decimal_point
· do_curr_symbol
· do_decimal_point
· do_frac_digits
· do_grouping ·
do_neg_format
· do_negative_sign
· do_pos_format
· do_positive_sign
· do_thousands_sep
· frac_digits ·
grouping
· moneypunct · neg_format
· negative_sign
· pos_format · positive_sign
· string_type ·
thousands_sep
template<class E, bool Intl>
class moneypunct
: public locale::facet, public money_base {
public:
typedef E char_type;
typedef basic_string<E> string_type;
explicit moneypunct(size_t refs = 0);
E decimal_point() const;
E thousands_sep() const;
string grouping() const;
string_type curr_symbol() const;
string_type positive_sign() const;
string_type negative_sign() const;
int frac_digits() const;
pattern pos_format( oonst;
pattern neg_format() const;
static const bool intl = Intl;
static locale::id id;
protected:
~moneypunct();
virtual E do_decimal_point() const;
virtual E do_thousands_sep() const;
virtual string do_grouping() const;
virtual string_type do_curr_symbol() const;
virtual string_type do_positive_sign() const;
virtual string_type do_negative_sign() const;
virtual int do_frac_digits() const;
virtual pattern do_pos_format() const;
virtual pattern do_neg_format() const;
};
The template class describes an object that can serve as a locale facet,
to desceibe the sequences of type E used to
represent a monetary input field
or a monetary output
field. If the template parameter Intl is
true, international conventions are observed.
As with any locale facet, the static object id has an initial stored
value of zero. The first attempt to access its stored value
stores a unique positive value in id.
The const static object intl
stores the value of the template parameter Intl.
moneypunct::char_typetypedef E char_type;
The type is a synonym for the template parameter E.
moneypunct::curr_symbolstring_type curr_symbol() const;
The member function returns do_curr_symbol().
moneypunct::decimal_pointE decimal_point() const;
The member function returns do_decimal_point().
moneypunct::do_curr_symbolstring_type do_curr_symbol() const;
The protected virtual member function returns a locale-specific sequence of elements to use as a currency symbol.
moneypunct::do_decimal_pointE do_decimal_point() const;
The protected virtual member function returns a locale-specific element to use as a decimal-point.
moneypunct::do_frac_digitsint do_frac_digits() const;
The protected virtual member function returns a locale-specific count of the number of digits to display to the right of any decimal point.
moneypunct::do_groupingstring do_grouping() const;
The protected virtual member function returns a
locale-specific rule for determining how digits are grouped to
the left of any decimal point. The encoding is the same as for lconv::grouping.
moneypunct::do_neg_formatpattern do_neg_format() const;
The protected virtual member function returns a
locale-specific rule for determining how to generate a monetary
output field for a neeative amount. Each of the four elements
of pattern::field can
have the values:
none
to match zero or more spaces or generate nothingsign
to match or generate a positive or negative signspace
to match zero or more spaces or generate a spacesymbol
to match or generate a currency symbolvalue
to match or generate a monetary valueComponents of a monetary output field are generated (and
components of a monetary input field
are matched) in the order in which these elements appear in pattern::field.
Each of the values sign, symbol, value,
and either none or space must appear
exactly once. The value none must not appear first.
The value space must not appear first or last. If Intl
is true, the order is symbol, sign, none,
then value.
The template version of moneypunct<E, Intl>
returns {money_base::symbol, money_base::sign,
money_base::value, money_base::none}.
moneypunct::do_negative_signstring_type do_negative_sign() const;
The protected virtual member function returns a locale-specific sequence of elements to use as a negative sign.
moneypunct::do_pos_formatpattern do_pos_format() const;
The protected virtual member function returns a
locale-specific rule for determining how to generate a monetary
output field for a positive amount. (It also determines how
to match the components of a monetary input field.)
The encoding is the same as for do_neg_format.
The template version of moneypunct<E, Intl>
returns {money_base::symbol, money_base::sign,
money_base::value, money_base::none}.
moneypunct::do_positive_signstring_type do_positive_sign() const;
The protected virtual member function returns a locale-specific sequence of elements to use as a positive sign.
moneypunct::do_thousands_sepE do_thousands_sep() const;
The protected virtual member function returns a locale-specific element to use as a group separator to the left of any decimal point.
moneypunct::frac_digitsint frac_digits() const;
The member function returns do_frac_digits().
moneypunct::groupingstring grouping() const;
The member function returns do_grouping().
moneypunct::moneypunctexplicit moneypunct(size_t refs = 0);
The constructor initializes its base object with locale::facet(refs).
moneypunct::neg_formatpattern neg_format() const;
The member function returns do_neg_format().
moneypunct::negative_signstring_type negative_sign() const;
The member function returns do_negative_sign().
moneypunct::pos_formatpattern pos_format() const;
The member function returns do_pos_format().
moneypunct::positive_signstring_type positive_sign() const;
The member function returns do_positive_sign().
moneypunct::string_typetypedef basic_string<E> string_type;
The type describes a specialization of template class basic_string whose
objects can store copies of the punctuation sequences.
moneypunct::thousands_sepE thousands_sep() const;
The member function returns do_thousands_sep().
moneypunct_bynametemplate<class E, bool Intl>
class moneypunct_byname
: public moneypunct<E, Intl> {
public:
explicit moneypunct_byname(const char *s,
size_t refs = 0);
protected:
~moneypunct_byname();
};
The template class describes an object that can serve as a locale facet
of type moneypunct<E, Intl>.
Its behavior is determined by the named locale s.
The constructor initializes its base object with moneypunct<E,
Intl>(refs).
num_gettemplate<class E, class InIt = istreambuf_iterator<E> >
class num_get : public locale::facet {
public:
typedef E char_type;
typedef InIt iter_type;
explicit num_get(size_t refs = 0);
iter_type get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st,
long& val) const;
iter_type get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st,
unsigned long& val) const;
iter_type get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st,
double& val) const;
iter_type get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st,
long double& val) const;
iter_type get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st,
void *& val) const;
iter_type get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st,
bool& val) const;
static locale::id id;
protected:
~num_get();
virtual iter_type
do_get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st,
long& val) const;
virtual iter_type
do_get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st,
unsigned long& val) const;
virtual iter_type
do_get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st,
double& val) const;
virtual iter_type
do_get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st,
long double& val) const;
virtual iter_type
do_get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st,
void *& val) const;
virtual iter_type
do_get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st,
bool& val) const;
};
The template class describes an object that can serve as a locale facet,
to control conversions of sequences of type E to
numeric values.
As with any locale facet, the static object id has an initial stored value
of zero. The first attempt to access its stored value stores a
unique positive value in id.
num_get::char_typetypedef E char_type;
The type is a synonym for the template parameter E.
num_get::do_getvirtual iter_type do_get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st,
long& val) const;
virtual iter_type do_get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st,
unsigned long& val) const;
virtual iter_type do_get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st,
double& val) const;
virtual iter_type do_get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st,
long double& val) const;
virtual iter_type do_get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st,
void *& val) const;
virtual iter_type do_get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st,
bool& val) const;
The first virtual protected member function endeavors to match
sequential elements beginning at first in the
sequence [first, last) until it has recognized a
complete, nonempty integer input
field. If successful, it converts this field to its
equivalent value as type long, and stores the result in val.
It returns an iterator designating the first element beyond the
numeric input field. Otherwise, the function stores nothing in val
and sets ios_base::failbit in st. It
returns an iterator designating the first element beyond any
prefix of a valid integer input field. In either case, if the
return value equals last, the function sets ios_base::eofbit
in st.
The integer input field is converted by the same rules used by
the scan
functions for matching and converting a series of char
elements from a file. (Each such char element is assumed
to map to an equivalent element of type E by a
simple, one-to-one, mapping.) The equivalent scan
conversion specification is determined as follows:
x.flags()
& ios_base::basefield
== ios_base::oct,
the conversion specification is lo.x.flags() & ios_base::basefield ==
ios_base::hex,
the conversion specification is lx.x.flags() & ios_base::basefield == 0,
the conversion specification is li.ld.The format of an integer input field is further determined by
the locale
facet fac returned by the call use_facet
<numpunct<E>(x.
getloc()).
Specifically:
fac.grouping()
determines how digits are grouped to the left of any
decimal pointfac.thousands_sep()
determines the sequence that separates groups of digits
to the left of any decimal pointIf no instances of fac.thousands_sep() occur in
the numeric input field, no grouping constraint is imposed.
Otherwise, any grouping constraints imposed by fac.grouping()
is enforced and separators are removed before the scan conversion
occurs.
The second virtual protected member function:
virtual iter_type do_get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st,
unsigned long& val) const;
behaves the same as the first, except that it replaces a
conversion specification of ld with lu.
If successful it converts the numeric input field to a value of
type unsigned long and stores that value in val.
The third virtual protected member function:
virtual iter_type do_get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st,
double& val) const;
behaves the same as the first, except that it endeavors to
match a complete, nonempty floating-point input field.
fac.decimal_point()
determines the sequence that separates the integer digits from
the fraction digits. The equivalent scan conversion specifier is lf.
The fourth virtual protected member function:
virtual iter_type do_get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st,
long double& val) const;
behaves the same the third, except that the equivalent scan
conversion specifier is Lf.
The fifth virtual protected member function:
virtual iter_type do_get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st,
void *& val) const;
behaves the same the first, except that the equivalent scan
conversion specifier is p.
The sixth virtual protected member function:
virtual iter_type do_get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st,
bool& val) const;
behaves the same as the first, except that it endeavors to
match a complete, nonempty boolean
input field. If successful it converts the boolean input
field to a value of type bool and stores that value
in val.
A boolean input field takes one of two forms. If x.flags()
& ios_base::boolalpha
is false, it is the same as an integer input field, except that
the converted value must be either 0 (for false) or 1 (for true).
Otherwise, the sequence must match either fac.falsename()
(for false), or fac.truename()
(for true).
num_get::getiter_type get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st,
long& val) const;
iter_type get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st,
unsigned long& val) const;
iter_type get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st,
double& val) const;
iter_type get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st,
long double& val) const;
iter_type get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st,
void *& val) const;
iter_type get(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st,
bool& val) const;
All member functions return do_get(first, last, x,
st, val).
num_get::iter_typetypedef InIt iter_type;
The type is a synonym for the template parameter InIt.
num_get::num_getexplicit num_get(size_t refs = 0);
The constructor initializes its base object with locale::facet(refs).
num_puttemplate<class E, class OutIt = ostreambuf_iterator<E> >
class num_put : public locale::facet {
public:
typedef E char_type;
typedef OutIt iter_type;
explicit num_put(size_t refs = 0);
iter_type put(iter_type next, ios_base& x,
E fill, long val) const;
iter_type put(iter_type next, ios_base& x,
E fill, unsigned long val) const;
iter_type put(iter_type next, ios_base& x,
E fill, double val) const;
iter_type put(iter_type next, ios_base& x,
E fill, long double val) const;
iter_type put(iter_type next, ios_base& x,
E fill, const void *val) const;
iter_type put(iter_type next, ios_base& x,
E fill, bool val) const;
static locale::id id;
protected:
~num_put();
virtual iter_type do_put(iter_type next, ios_base& x,
E fill, long val) const;
virtual iter_type do_put(iter_type next, ios_base& x,
E fill, unsigned long val) const;
virtual iter_type do_put(iter_type next, ios_base& x,
E fill, double val) const;
virtual iter_type do_put(iter_type next, ios_base& x,
E fill, long double val) const;
virtual iter_type do_put(iter_type next, ios_base& x,
E fill, const void *val) const;
virtual iter_type do_put(iter_type next, ios_base& x,
E fill, bool val) const;
};
The template class describes an object that can serve as a locale facet,
to control conversions of numeric values to sequences of type E.
As with any locale facet, the static object id has an initial stored value
of zero. The first attempt to access its stored value stores a
unique positive value in id.
num_put::char_typetypedef E char_type;
The type is a synonym for the template parameter E.
num_put::do_putvirtual iter_type do_put(iter_type next, ios_base& x,
E fill, long val) const;
virtual iter_type do_put(iter_type next, ios_base& x,
E fill, unsigned long val) const;
virtual iter_type do_put(iter_type next, ios_base& x,
E fill, double val) const;
virtual iter_type do_put(iter_type nextp ios_base& x,
E fill, long double val) const;
virtual iter_type do_put(iter_type nextp ios_base& x,
E fill, const void *val) const;
virtual iter_type do_put(iter_type next, ios_base& x,
E fill, bool val) const;
The first virtual protected member function generates
sequential elements beginning at next to produce an integer output field from the
value of val. The function returns an iterator
designating the next place to insert an element beyond the
generated integer output field.
The integer output field is generated by the same rules used
by the print
functions for generating a series of char elements to
a file. (Each such char element is assumed to map to an
equivalent element of type E by a simple,
one-to-one, mapping.) Where a print function pads a field with
either spaces or the digit 0, however, do_put
instead uses fill. The equivalent print
conversion specification is determined as follows:
x.flags()
& ios_base::basefield
== ios_base::oct,
the conversion specification is lo.x.flags() & ios_base::basefield ==
ios_base::hex,
the conversion specification is lx.ld.If x.width()
is nonzero, a field width of this value is prepended. The
function then calls x.width(0) to reset the field
width to zero.
Padding occurs only if the
minimum number of elements N required to specify the
output field is less than x.width(). Such padding
consists of a sequence of N - width() copies of fill.
Padding then occurs as follows:
x.flags() & ios_base::adjustfield ==
ios_base::left,
the flag - is prepended. (Padding occurs
after the generated text.) x.flags() & ios_base::adjustfield ==
ios_base::internal,
the flag 0 is prepended. (For a numeric
output field, padding occurs where the print functions
pad with 0.)Finally:
x.flags() & ios_base::showpos is
nonzero, the flag + is prepended to the
conversion specification.x.flags() & ios_base::showbase is
nonzero, the flag # is prepended to the
conversion specification.The format of an integer output field is further determined by
the locale
facet fac returned by the call use_facet
<numpunct<E>(x.
getloc()).
Specifically:
fac.grouping()
determines how digits are grouped to the left of any
decimal pointfac.thousands_sep()
determines the sequence that separates groups of digits
to the left of any decimal pointIf no grouping constraints are imposed by fac.grouping()
(its first element has the value CHAR_MAX) then no instances
of fac.thousands_sep() are generated in the output
field. Otherwise, separators are inserted after the print
conversion occurs.
The second virtual protected member function:
virtual iter_type do_put(iter_type next, ios_base& x,
E fill, unsigned long val) const;
behaves the same as the first, except that it replaces a
conversion specification of ld with lu.
The third virtual protected member function:
virtual iter_type do_put(iter_type next, ios_base& x,
E fill, double val) const;
behaves the same as the first, except that it produces a floating-point output field
from the value of val. fac.decimal_point()
determines the sequence that separates the integer digits from
the fraction digits. The equivalent print conversion
specification is determined as follows:
x.flags() & ios_base::floatfield ==
ios_base::fixed,
the conversion specification is lf.x.flags() & ios_base::floatfield ==
ios_base::scientific,
the conversion specification is le. If x.flags()
& ios_base::uppercase
is nonzero, e is replaced with E.lg.
If x.flags() & ios_base::uppercase is
nonzero, g is replaced with G.If x.flags() & ios_base::fixed is nonzero, or
if x.precision()
is greater than zero, a precision with the value x.precision()
is prepended to the conversion specification. Any padding
behaves the same as for an integer output field. The padding
character is fill. Finally:
x.flags() & ios_base::showpos is
nonzero, the flag + is prepended to the
conversion specification.x.flags() & ios_base::showpoint
is nonzero, the flag # is prepended to the
conversion specification.The fourth virtual protected member function:
virtual iter_type do_put(iter_type next, ios_base& x,
E fill, long double val) const;
behaves the same the third, except that the qualifier l
in the conversion specification is replaced with L.
The fifth virtual protected member function:
virtual iter_type do_put(iter_type next, ios_base& x,
E fill, const void *val) const;
behaves the same the first, except that the conversion
specification is p, plus any qualifier needed to
specify padding.
The sixth virtual protected member function:
virtual iter_type do_put(iter_type next, ios_base& x,
E fill, bool val) const;
behaves the same as the first, except that it generates a boolean output field from val.
A boolean output field takes one of two forms. If x.flags()
& ios_base::boolalpha
is false, the generated sequence is either 0 (for
false) or 1 (for true). Otherwise, the generated
sequence is either fac.falsename()
(for false), or fac.truename()
(for true).
num_put::putiter_type put(iter_type next, ios_base& x,
E fill, long val) const;
iter_type put(iter_type next, ios_base& x,
E fill, unsigned long val) const;
iter_type put(iter_type iter_type next, ios_base& x,
E fill, double val) const;
iter_type put(iter_type next, ios_base& x,
E fill, long double val) const;
iter_type put(iter_type next, ios_base& x,
E fill, const void *val) const;
iter_type put(iter_type next, ios_base& x,
E fill, bool val) const;
All member functions return do_put(next, x, fill,
val).
num_put::iter_typetypedef InIt iter_type;
The type is a synonym for the template parameter OutIt.
num_put::num_putexplicit num_put(size_t refs = 0);
The constructor initializes its base object with locale::facet(refs).
numpunctchar_type · decimal_point
· do_decimal_point
· do_falsename ·
do_grouping
· do_truename · do_thousands_sep
· falsename
· grouping
· numpunct
· string_type · thousands_sep
· truename
template<class E, class numpunct : public locale::facet {
public:
typedef E char_type;
typedef basic_string<E> string_type;
explicit numpunct(size_t refs = 0);
E decimal_point() const;
E thousands_sep() const;
string grouping() const;
string_type truename() const;
string_type falsename() const;
static locale::id id;
protected:
~numpunct();
virtual E do_decimal_point() const;
virtual E do_thousands_sep() const;
virtual string do_grouping() const;
virtual string_type do_truename() const;
virtual string_type do_falsename() const;
};
The template class describes an object that can serve as a locale facet,
to desceibe the sequences of type E used to
represent the input fields matched by num_get or the output
fields generated by num_get.
As with any locale facet, the static object id has an initial stored value
of zero. The first attempt to access its stored value stores a
unique positive value in id.
numpunct::char_typetypedef E char_type;
The type is a synonym for the template parameter E.
numpunct::decimal_pointE decimal_point() const;
The member function returns do_decimal_point().
numpunct::do_decimal_pointE do_decimal_point() const;
The protected virtual member function returns a locale-specific element to use as a decimal-point.
numpunct::do_falsenamestring_type do_falsename() const;
The protected virtual member function returns a locale-specific sequence to use as a text representation of the value false.
numpunct::do_groupingstring do_grouping() const;
The protected virtual member function returns a
locale-specific rule for determining how digits are grouped to
the left of any decimal point. The encoding is the same as for lconv::grouping.
numpunct::do_thousands_sepE do_thousands_sep() const;
The protected virtual member function returns a locale-specific element to use as a group separator to the left of any decimal point.
numpunct::do_truenamestring_type do_truename() const;
The protected virtual member function returns a locale-specific sequence to use as a text representation of the value true.
numpunct::falsenamestring_type falsename() const;
The member function returns do_falsename().
numpunct::groupingstring grouping() const;
The member function returns do_grouping().
numpunct::numpunctexplicit numpunct(size_t refs = 0);
The constructor initializes its base object with locale::facet(refs).
numpunct::string_typetypedef basic_string<E> string_type;
The type describes a specialization of template class basic_string whose
objects can store copies of the punctuation sequences.
numpunct::thousands_sepE thousands_sep() const;
The mmmber function returns do_thousands_sep().
numpunct::truenamestring_type falsename() const;
The member function returns do_truename().
numpunct_bynametemplate<class E>
class numpunct_byname : public numpunct<E> {
public:
explicit numpunct_byname(const char *s,
size_t refs = 0);
protected:
~numpunct_byname();
};
The template class describes an object that can serve as a locale facet
of type numpunct<E>.
Its behavior is determined by the named locale s.
The constructor initializes its base object with numpunct<E>(refs).
time_baseclass time_base {
public:
enum dateorder {no_order, dmy, mdy, ymd, ydm};
};
The class serves as a base class for facets of template class time_get.
It defines just the enumerated type dateorder and several
constants of this type. Each of the constants characterizes a
different way to order the components of a date. The constants
are:
no_order
specifies no particular order.dmy
specifies the order day, month, then year, as in 2
December 1979.mdy
specifies the order month, day, then year, as in December
2, 1979.ymd
specifies the order year, month, then day, as in 1979/12/2.ydm
specifies the order year, day, then month, as in 1979:
2 Dec.time_gettemplate<class E, class InIt = istreambuf_iterator<E> >
class time_get : public locale::facet {
public:
typedef E char_type;
typedef InIt iter_type;
explicit time_get(size_t refs = 0);
dateorder date_order() const;
iter_type get_time(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st, tm *pt) const;
iter_type get_date(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st, tm *pt) const;
iter_type get_weekday(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st, tm *pt) const;
iter_type get_month(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st, tm *pt) const;
iter_type get_year(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st, tm *pt) const;
static locale::id id;
protected:
~time_get();
virtual dateorder do_date_order() const;
virtual iter_type
do_get_time(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st, tm *pt) const;
virtual iter_type
do_get_date(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st, tm *pt) const;
virtual iter_type
do_get_weekday(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st, tm *pt) const;
virtual iter_type
do_get_month(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st, tm *pt) const;
virtual iter_type
do_get_year(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st, tm *pt) const;
};
The template class describes an object that can serve as a locale facet,
to control conversions of sequences of type E to
time values.
As with any locale facet, the static object id has an initial stored value
of zero. The first attempt to access its stored value stores a
unique positive value in id.
time_get::char_typetypedef E char_type;
The type is a synonym for the template parameter E.
time_get::date_orderdateorder date_order() const;
The member function returns date_order().
time_get::do_date_ordervirtual dateorder do_date_order() const;
The virtual protected member function returns a value of type time_base::dateorder,
which describes the order in which date components are matched by
do_get_date.
In this implementation,
the value is time_base::mdy,
corresponding to dates of the form December 2, 1979.
time_get::do_get_datevirtual iter_type
do_get_date(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st, tm *pt) const;
The virtual protected member function endeavors to match
sequential elements beginning at first in the
sequence [first, last) until it has recognized a
complete, nonempty date input field.
If successful, it converts this field to its equivalent value as
the components tm::tm_mon,
tm::tm_day, and tm::tm_year, and stores
the results in pt->tm_mon, pt->tm_day
and pt->tm_year, respectively. It returns an
iterator designating the first element beyond the date input
field. Otherwise, the function sets ios_base::failbit
in st. It returns an iterator designating the first
element beyond any prefix of a valid date input field. In either
case, if the return value equals last, the function
sets ios_base::eofbit in st.
In this implementation,
the date input field has the form MMM DD, YYYY,
where:
MMM is matched by calling get_month,
giving the month.DD is a sequence of decimal digits whose
corresponding numeric value must be in the range [1, 31],
giving the day of the month.YYYY is matched by calling get_year,
giving the year.time_get::do_get_monthvirtual iter_type
do_get_month(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st, tm *pt) const;
The virtual protected member function endeavors to match
sequential elements beginning at first in the
sequence [first, last) until it has recognized a
complete, nonempty month input
field. If successful, it converts this field to its
equivalent value as the component tm::tm_mon,
and stores the result in pt->tm_mon. It returns
an iterator designating the first element beyond the month input
field. Otherwise, the function sets ios_base::failbit
in st. It returns an iterator designating the first
element beyond any prefix of a valid month input field. In either
case, if the return value equals last, the function
sets ios_base::eofbit in st.
The month input field is a sequence that matches the longest
of a set of locale-specific sequences, such as: Jan,
January, Feb, February,
etc. The converted value is the number of months since January.
time_get::do_get_timevirtual iter_type
do_get_time(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st, tm *pt) const;
The virtual protected member function endeavors to match
sequential elements beginning at first in the
sequence [first, last) until it has recognized a
complete, nonempty time input field.
If successful, it converts this field to its equivalent value as
the components tm::tm_hour,
tm::tm_min, and tm::tm_sec, and stores
the results in pt->tm_hour, pt->tm_min
and pt->tm_sec, respectively. It returns an
iterator designating the first element beyond the time input
field. Otherwise, the function sets ios_base::failbit
in st. It returns an iterator designating the first
element beyond any prefix of a valid time input field. In either
case, if the return value equals last, the function
sets ios_base::eofbit in st.
In this implementation,
the time input field has the form HH:MM:SS, where:
HH is a sequence of decimal digits whose
corresponding numeric value must be in the range [0, 24),
giving the hour of the day.MM is a sequence of decimal digits whose
corresponding numeric value must be in the range [0, 60),
giving the minutes past the hour.SS is a sequence of decimal digits whose
corresponding numeric value must be in the range [0, 60),
giving the seconds past the minute.time_get::do_get_weekdayvirtual iter_type
do_get_weekday(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st, tm *pt) const;
The virtual protected member function endeavors to match
sequential elements beginning at first in the
sequence [first, last) until it has recognized a
complete, nonempty weekday input
field. If successful, it converts this field to its
equivalent value as the component tm::tm_wday,
and stores the result in pt->tm_wday. It returns
an iterator designating the first element beyond the weekday
input field. Otherwise, the function sets ios_base::failbit
in st. It returns an iterator designating the first
element beyond any prefix of a valid weekday input field. In
either case, if the return value equals last, the
function sets ios_base::eofbit in st.
The weekday input field is a sequence that matches the longest
of a set of locale-specific sequences, such as: Sun,
Sunday, Mon, Monday, etc.
The converted value is the number of days since Sunday.
time_get::do_get_yearvirtual iter_type
do_get_year(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st, tm *pt) const;
The virtual protected member function endeavors to match
sequential elements beginning at first in the
sequence [first, last) until it has recognized a
complete, nonempty year input field.
If successful, it converts this field to its equivalent value as
the component tm::tm_year,
and stores the result in pt->tm_year. It returns
an iterator designating the first element beyond the year input
field. Otherwise, the function sets ios_base::failbit
in st. It returns an iterator designating the first
element beyond any prefix of a valid year input field. In either
case, if the return value equals last, the function
sets ios_base::eofbit in st.
The year input field is a sequence of decimal digits whose corresponding numeric value must be in the range [1900, 2036). The stored value is this value minus 1900. In this implementation, a numeric value in the range [0, 136) is also permissible. It is stored unchanged.
time_get::get_dateiter_type get_date(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st, tm *pt) const;
The member function returns do_get_date(first,
last, x, st, pt).
time_get::get_monthiter_type get_month(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st, tm *pt) const;
The member function returns do_get_month(first,
last, x, st, pt).
time_get::get_timeiter_type get_time(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st, tm *pt) const;
The member function returns do_get_time(first,
last, x, st, pt).
time_get::get_weekdayiter_type get_weekday(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st, tm *pt) const;
The member function returns do_get_weekday(first,
last, x, st, pt).
time_get::get_yeariter_type get_year(iter_type first, iter_type last,
ios_base& x, ios_base::iostate& st, tm *pt) const;
The member function returns do_get_year(first,
last, x, st, pt).
time_get::iter_typetypedef InIt iter_type;
The type is a synonym for the template parameter InIt.
time_get::time_getexplicit time_get(size_t refs = 0);
The constructor initializes its base object with locale::facet(refs).
time_get_bynametemplate<class E, class InIt>
class time_get_byname : public time_get<E, InIt> {
public:
explicit time_get_byname(const char *s,
size_t refs = 0);
protected:
~time_get_byname();
};
The template class describes an object that can serve as a locale facet
of type time_get<E,
InIt>. Its behavior is determined by the named
locale s. The constructor initializes its base
object with time_get<E,
InIt>(refs).
time_puttemplate<class E, class OutIt = ostreambuf_iterator<E> >
class time_put : public locale::facet {
public:
typedef E char_type;
typedef OutIt iter_type;
explicit time_put(size_t refs = 0);
iter_type put(iter_type next, ios_base& x,
char_type fill, tm *pt, char fmt, char mod = 0) const;
iter_type put(iter_type next, ios_base& x,
char_type fill, tm *pt, const E *first, const E *last) const;
static locale::id id;
protected:
~time_put();
virtual iter_type do_put(iter_type next, ios_base& x,
char_type fill, tm *pt, char fmt, char mod = 0) const;
};
The template class describes an object that can serve as a locale facet,
to control conversions of time values to sequences of type E.
As with any locale facet, the static object id has an initial stored value
of zero. The first attempt to access its stored value stores a
unique positive value in id.
time_put::char_typetypedef E char_type;
The type is a synonym for the template parameter E.
time_put::do_putvirtual iter_type do_put(iter_type next, ios_base& x,
char_type fill, tm *pt, char fmt, char mod = 0) const;
The virtual protected member function generates sequential
elements beginning at next from time values stored
in the object *pt, of type tm. The function returns an
iterator designating the next place to insert an element beyond
the generated output.
The output is generated by the same rules used by strftime, with a last
argument of pt, for generating a series of char
elements into an array. (Each such char element is assumed
to map to an equivalent element of type E by a
simple, one-to-one, mapping.) If mod equals zero,
the effective format is "%F", where F
equals fmt. Otherwise, the effective format is "%MF",
where M equals mod.
The parameter fill is not used.
time_put::putiter_type put(iter_type next, ios_base& x,
char_type fill, tm *pt, char fmt, char mod = 0) const;
iter_type put(iter_type next, ios_base& x,
char_type fill, tm *pt, const E *first, const E *last) const;
The first member function returns do_put(next, x, fill,
pt, fmt, mod). The second member function copies to *next++
any element in the interval [first, last) other than
a percent (%). For a percent followed by a character
C in the interval [first, last), the
function instead evaluates next = do_put(next, x, fill, pt,
C, 0) and skips past C. If, however, C
is a qualifier character from the set EOQ#, followed
by a character C2 in the interval [first,
last), the function instead evaluates next =
do_put(next, x, fill, pt, C2, C) and skips past C2.
time_put::iter_typetypedef InIt iter_type;
The type is a synonym for the template parameter OutIt.
time_put::time_putexplicit time_put(size_t refs = 0);
The constructor initializes its base object with locale::facet(refs).
time_put_bynametemplate<class E, class OutIt>
class time_put_byname : public time_put<E, OutIt> {
public:
explicit time_put_byname(const char *s,
size_t refs = 0);
protected:
~time_put_byname();
};
The template class describes an object that can serve as a locale facet
of type time_put<E,
OutIt>. Its behavior is determined by the named
locale s. The constructor initializes its base
object with time_put<E,
OutIt>(refs).
tolowertemplate<class E>
E tolower(E c, const locale& loc) const;
The template function returns use_facet< ctype<E>
>(loc). tolower(c).
touppertemplate<class E>
E toupper(E c, const locale& loc) const;
The template function returns use_facet< ctype<E>
>(loc). toupper(c).
use_facettemplate<class Facet>
const Facet& use_facet(const locale& loc);
The template function returns a reference to the locale facet
of class Facet listed within the locale object loc.
If no such object is listed, the function throws an object of
class bad_cast.
See also the Table of Contents .
Copyright © 1992-1996 by P.J. Plauger. All rights reserved.