📄 locale2.html
字号:
<H3><CODE><A NAME="collate::transform">collate::transform</A></CODE></H3><PRE>string_type <B>transform</B>(const Elem *first, const Elem *last) const;</PRE><P>The member function returns<CODE><A HREF="#collate::do_transform">do_transform</A>(first,last)</CODE>.</P><H2><CODE><A NAME="collate_byname">collate_byname</A></CODE></H2><PRE>template<class Elem> class <B>collate_byname</B> : public collate<Elem> {public: explicit <B>collate_byname</B>(const char *locname, size_t refs = 0);protected: <B>~collate_byname</B>(); };</PRE><P>The template class describes an object that can serve as a<A HREF="#locale facet">locale facet</A> of type<CODE><A HREF="#collate">collate</A><Elem></CODE>.Its behavior is determined by the<A HREF="#locale name">named</A> locale <CODE>locname</CODE>.The constructor initializes its base object with<CODE><A HREF="#collate::collate">collate</A><Elem>(refs)</CODE>.</P><H2><CODE><A NAME="ctype">ctype</A></CODE></H2><HR><P><B><CODE><A HREF="#ctype::char_type">char_type</A>· <A HREF="#ctype::ctype">ctype</A>· <A HREF="#ctype::do_is">do_is</A>· <A HREF="#ctype::do_narrow">do_narrow</A>· <A HREF="#ctype::do_scan_is">do_scan_is</A>· <A HREF="#ctype::do_scan_not">do_scan_not</A>· <A HREF="#ctype::do_tolower">do_tolower</A>· <A HREF="#ctype::do_toupper">do_toupper</A>· <A HREF="#ctype::do_widen">do_widen</A>· <A HREF="#ctype::is">is</A>· <A HREF="#ctype::narrow">narrow</A>· <A HREF="#ctype::scan_is">scan_is</A>· <A HREF="#ctype::scan_not">scan_not</A>· <A HREF="#ctype::tolower">tolower</A>· <A HREF="#ctype::toupper">toupper</A>· <A HREF="#ctype::widen">widen</A></CODE></B></P><HR><PRE>template<class Elem> class <B>ctype</B> : public locale::facet, public ctype_base {public: typedef Elem <B><A HREF="#ctype::char_type">char_type</A></B>; explicit <B><A HREF="#ctype::ctype">ctype</A></B>(size_t refs = 0); bool <B><A HREF="#ctype::is">is</A></B>(mask maskval, Elem ch) const; const Elem *<B><A HREF="#ctype::is">is</A></B>(const Elem *first, const Elem *last, mask *dest) const; const Elem *<B><A HREF="#ctype::scan_is">scan_is</A></B>(mask maskval, const Elem *first, const Elem *last) const; const Elem *<B><A HREF="#ctype::scan_not">scan_not</A></B>(mask maskval, const Elem *first, const Elem *last) const; Elem <B><A HREF="#ctype::toupper">toupper</A></B>(Elem ch) const; const Elem *<B><A HREF="#ctype::toupper">toupper</A></B>(Elem *first, Elem *last) const; Elem <B><A HREF="#ctype::tolower">tolower</A></B>(Elem ch) const; const Elem *<B><A HREF="#ctype::tolower">tolower</A></B>(Elem *first, Elem *last) const; Elem <B><A HREF="#ctype::widen">widen</A></B>(char byte) const; const char *<B><A HREF="#ctype::widen">widen</A></B>(char *first, char *last, Elem *dest) const; char <B><A HREF="#ctype::narrow">narrow</A></B>(Elem ch, char dflt) const; const Elem *<B><A HREF="#ctype::narrow">narrow</A></B>(const Elem *first, const Elem *last, char dflt, char *dest) const; static locale::id <B><A HREF="#ctype::id">id</A></B>;protected: <B>~ctype()</B>; virtual bool <B><A HREF="#ctype::do_is">do_is</A></B>(mask maskval, Elem ch) const; virtual const Elem *<B><A HREF="#ctype::do_is">do_is</A></B>(const Elem *first, const Elem *last, mask *dest) const; virtual const Elem *<B><A HREF="#ctype::do_scan_is">do_scan_is</A></B>(mask maskval, const Elem *first, const Elem *last) const; virtual const Elem *<B><A HREF="#ctype::do_scan_not">do_scan_not</A></B>(mask maskval, const Elem *first, const Elem *last) const; virtual Elem <B><A HREF="#ctype::do_toupper">do_toupper</A></B>(Elem ch) const; virtual const Elem *<B><A HREF="#ctype::do_toupper">do_toupper</A></B>(Elem *first, Elem *last) const; virtual Elem <B><A HREF="#ctype::do_tolower">do_tolower</A></B>(Elem ch) const; virtual const Elem *<B><A HREF="#ctype::do_tolower">do_tolower</A></B>(Elem *first, Elem *last) const; virtual Elem <B><A HREF="#ctype::do_widen">do_widen</A></B>(char byte) const; virtual const char *<B><A HREF="#ctype::do_widen">do_widen</A></B>(char *first, char *last, Elem *dest) const; virtual char <B><A HREF="#ctype::do_narrow">do_narrow</A></B>(Elem ch, char dflt) const; virtual const Elem *<B><A HREF="#ctype::do_narrow">do_narrow</A></B>(const Elem *first, const Elem *last, char dflt, char *dest) const; };</PRE><P>The template class describes an object that can serve as a<A HREF="#locale facet">locale facet</A>, to characterizevarious properties of a ``character'' (element) of type <CODE>Elem</CODE>.Such a facet also converts between sequences of <CODE>Elem</CODE>elements and sequences of <I>char.</I></P><P>As with any locale facet, the static object<B><CODE><A NAME="ctype::id">id</A></CODE></B> has an initialstored value of zero. The first attempt to access its stored valuestores a unique positive value in <CODE>id</CODE>.</P><P>The Standard C++ library defines two explicit specializationsof this template class:</P><UL><LI><CODE><A HREF="#ctype<char>">ctype<char></A></CODE>,an explicit specialization whose differences are described separately</LI><LI><CODE>ctype<wchar_t></CODE>, which treats elements as<A HREF="charset.html#Wide-Character Encoding">wide characters</A></LI></UL><P>In this<A HREF="index.html#implementation">implementation</A>,other specializations of template class <CODE>ctype<Elem></CODE>:</P><UL><LI>convert a value <CODE>ch</CODE> of type <CODE>Elem</CODE> toa value of type <I>char</I> with the expression <CODE>(char)ch</CODE></LI><LI>convert a value <CODE>byte</CODE> of type <I>char</I> toa value of type <CODE>Elem</CODE> with the expression<CODE>Elem(byte)</CODE></LI></UL><P>All other operations are performed on <I>char</I> values the sameas for the explicit specialization <CODE>ctype<char></CODE>.</P><H3><A NAME="ctype::char_type"><CODE>ctype::char_type</CODE></A></H3><PRE>typedef Elem <B>char_type</B>;</PRE><P>The type is a synonym for the template parameter <CODE>Elem</CODE>.</P><H3><A NAME="ctype::ctype"><CODE>ctype::ctype</CODE></A></H3><PRE>explicit <B>ctype</B>(size_t refs = 0);</PRE><P>The constructor initializes its<CODE>locale::facet</CODE> base object with<CODE>locale::<A HREF="#locale::facet">facet</A>(refs)</CODE>.</P><H3><A NAME="ctype::do_is"><CODE>ctype::do_is</CODE></A></H3><PRE>virtual bool <B>do_is</B>(mask maskval, Elem ch) const;virtual const Elem *<B>do_is</B>(const Elem *first, const Elem *last, mask *dest) const;</PRE><P>The first protected member template function returns true if<CODE>MASK(ch) & maskval</CODE> is nonzero,where <CODE>MASK(ch)</CODE> designates the mapping between an elementvalue <CODE>ch</CODE> and its classification mask, of type<CODE><A HREF="#ctype_base::mask">mask</A></CODE>.The name <CODE>MASK</CODE> is purely symbolic here; it is notdefined by the template class. For an object of class<CODE><A HREF="#ctype<char>">ctype<char></A></CODE>,the mapping is <CODE>tab[(unsigned char)(char)ch]</CODE>,where <CODE>tab</CODE> is the stored pointer to the<A HREF="#ctype mask table">ctype mask table</A>.</P><P>The second protected member template function stores in<CODE>dest[I]</CODE> the value<CODE>MASK(first[I]) & maskval</CODE>, where<CODE>I</CODE> ranges over the interval <CODE>[0, last - first)</CODE>.</P><H3><A NAME="ctype::do_narrow"><CODE>ctype::do_narrow</CODE></A></H3><PRE>virtual char <B>do_narrow</B>(Elem ch, char dflt) const;virtual const Elem *<B>do_narrow</B>(const Elem *first, const Elem *last, char dflt, char *dest) const;</PRE><P>The first protected member template function returns<CODE>(char)ch</CODE>, or <CODE>dflt</CODE> if that expressionis undefined.</P><P>The second protected member template function stores in<CODE>dest[I]</CODE> the value <CODE>do_narrow(first[I], dflt)</CODE>, for<CODE>I</CODE> in the interval <CODE>[0, last - first)</CODE>.</P><H3><A NAME="ctype::do_scan_is"><CODE>ctype::do_scan_is</CODE></A></H3><PRE>virtual const Elem *<B>do_scan_is</B>(mask maskval, const Elem *first, const Elem *last) const;</PRE><P>The protected member function returns the smallest pointer<CODE>ptr</CODE> in the range <CODE>[first, last)</CODE> for which<CODE><A HREF="#ctype::do_is">do_is</A>(maskval, *ptr)</CODE> is true.If no such value exists, the function returns <CODE>last</CODE>.</P><H3><A NAME="ctype::do_scan_not"><CODE>ctype::do_scan_not</CODE></A></H3><PRE>virtual const Elem *<B>do_scan_not</B>(mask maskval, const Elem *first, const Elem *last) const;</PRE><P>The protected member function returns the smallest pointer<CODE>ptr</CODE> in the range <CODE>[first, last)</CODE> for which<CODE><A HREF="#ctype::do_is">do_is</A>(maskval, *ptr)</CODE> is false.If no such value exists, the function returns <CODE>last</CODE>.</P><H3><A NAME="ctype::do_tolower"><CODE>ctype::do_tolower</CODE></A></H3><PRE>virtual Elem <B>do_tolower</B>(Elem ch) const;virtual const Elem *<B>do_tolower</B>(Elem *first, Elem *last) const;</PRE><P>The first protected member template function returnsthe lowercase character corresponding to <CODE>ch</CODE>,if such a character exists. Otherwise, it returns <CODE>ch</CODE>.</P><P>The second protected member template function replaces eachelement <CODE>first[I]</CODE>, for <CODE>I</CODE> in the interval<CODE>[0, last - first)</CODE>, with <CODE>do_tolower(first[I])</CODE>.</P><H3><A NAME="ctype::do_toupper"><CODE>ctype::do_toupper</CODE></A></H3><PRE>virtual Elem <B>do_toupper</B>(Elem ch) const;virtual const Elem *<B>do_toupper</B>(Elem *first, Elem *last) const;</PRE><P>The first protected member template function returnsthe uppercase character corresponding to <CODE>ch</CODE>,if such a character exists. Otherwise, it returns <CODE>ch</CODE>.</P><P>The second protected member template function replaces eachelement <CODE>first[I]</CODE>, for <CODE>I</CODE> in the interval<CODE>[0, last - first)</CODE>, with <CODE>do_toupper(first[I])</CODE>.</P><H3><A NAME="ctype::do_widen"><CODE>ctype::do_widen</CODE></A></H3><PRE>virtual Elem <B>do_widen</B>(char byte) const;virtual const char *<B>do_widen</B>(char *first, char *last, Elem *dest) const;</PRE><P>The first protected member template function returns<CODE>Elem(byte)</CODE>.</P><P>The second protected member template function stores in<CODE>dest[I]</CODE> the value <CODE>do_widen(first[I])</CODE>, for<CODE>I</CODE> in the interval <CODE>[0, last - first)</CODE>.</P><H3><A NAME="ctype::is"><CODE>ctype::is</CODE></A></H3><PRE>bool <B>is</B>(mask maskval, Elem ch) const;const Elem *<B>is</B>(const Elem *first, const Elem *last, mask *dest) const;</PRE><P>The first member function returns<CODE><A HREF="#ctype::do_is">do_is</A>(maskval, ch)</CODE>.The second member function returns <CODE>do_is(first, last, dest)</CODE>.</P><H3><A NAME="ctype::narrow"><CODE>ctype::narrow</CODE></A></H3><PRE>char <B>narrow</B>(Elem ch, char dflt) const;const Elem *<B>narrow</B>(const Elem *first, const Elem *last, char dflt, char *dest) const;</PRE><P>The first member function returns<CODE><A HREF="#ctype::do_narrow">do_narrow</A>(ch, dflt)</CODE>.The second member function returns <CODE>do_narrow(first, last,dflt, dest)</CODE>.</P><H3><A NAME="ctype::scan_is"><CODE>ctype::scan_is</CODE></A></H3><PRE>const Elem *<B>scan_is</B>(mask maskval, const Elem *first, const Elem *last) const;</PRE><P>The member function returns<CODE><A HREF="#ctype::do_scan_is">do_scan_is</A>(maskval,first, last)</CODE>.</P><H3><A NAME="ctype::scan_not"><CODE>ctype::scan_not</CODE></A></H3><PRE>const Elem *<B>scan_not</B>(mask maskval, const Elem *first, const Elem *last) const;</PRE><P>The member function returns<CODE><A HREF="#ctype::do_scan_not">do_scan_not</A>(maskval,first, last)</CODE>.</P><H3><A NAME="ctype::tolower"><CODE>ctype::tolower</CODE></A></H3><PRE>Elem <B>tolower</B>(Elem ch) const;const Elem *<B>tolower</B>(Elem *first, Elem *last) const;</PRE><P>The first member function returns<CODE><A HREF="#ctype::do_tolower">do_tolower</A>(ch)</CODE>.The second member function returns<CODE><A HREF="#ctype::do_tolower">do_tolower</A>(first,last)</CODE>.</P><H3><A NAME="ctype::toupper"><CODE>ctype::toupper</CODE></A></H3><PRE>Elem <B>toupper</B>(Elem ch) const;const Elem *<B>toupper</B>(Elem *first, Elem *last) const;</PRE><P>The first member function returns<CODE><A HREF="#ctype::do_toupper">do_toupper</A>(ch)</CODE>.The second member function returns<CODE><A HREF="#ctype::do_toupper">do_toupper</A>(first,last)</CODE>.</P><H3><A NAME="ctype::widen"><CODE>ctype::widen</CODE></A></H3><PRE>Elem <B>widen</B>(char byte) const;const char *<B>widen</B>(char *first, char *last, Elem *dest) const;</PRE><P>The first member function returns<CODE><A HREF="#ctype::do_widen">do_widen</A>(byte)</CODE>.The second member function returns<CODE><A HREF="#ctype::do_widen">do_widen</A>(first,last, dest)</CODE>.</P><H2><CODE><A NAME="ctype<char>">ctype<char></A></CODE></H2><PRE>template<> class <B>ctype<char></B>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -