📄 locale2.html
字号:
: public locale::facet, public ctype_base {public: typedef char <B>char_type</B>; explicit <B>ctype</B>(const mask *tab = 0, bool del = false, size_t refs = 0); bool <B>is</B>(mask maskval, char ch) const; const char *<B>is</B>(const char *first, const char *last, mask *dest) const; const char *<B>scan_is</B>(mask maskval, const char *first, const char *last) const; const char *<B>scan_not</B>(mask maskval, const char *first, const char *last) const; char <B>toupper</B>(char ch) const; const char *<B>toupper</B>(char *first, char *last) const; char <B>tolower</B>(char ch) const; const char *<B>tolower</B>(char *first, char *last) const; char <B>widen</B>(char byte) const; const char *<B>widen</B>(char *first, char *last, char *dest) const; char <B>narrow</B>(char ch, char dflt) const; const char *<B>narrow</B>(const char *first, const char *last, char dflt, char *dest) const; static locale::id <B>id</B>;protected: <B>~ctype()</B>; virtual char <B>do_toupper</B>(char ch) const; virtual const char *<B>do_toupper</B>(char *first, char *last) const; virtual char <B>do_tolower</B>(char ch) const; virtual const char *<B>do_tolower</B>(char *first, char *last) const; virtual char <B>do_widen</B>(char ch) const; virtual const char *<B>do_widen</B>(char *first, char *last, char *dest) const; virtual char <B>do_narrow</B>(char ch, char dflt) const; virtual const char *<B>do_narrow</B>(const char *first, const char *last, char dflt, char *dest) const; const mask *<B><A HREF="#ctype<char>::table">table</A></B>() const throw(); static const mask *<B><A HREF="#ctype<char>::classic_table">classic_table</A></B>() const throw(); static const size_t <B><A HREF="#ctype<char>::table_size">table_size</A></B>; };</PRE><P>The class is an explicit specialization of template class<CODE><A HREF="#ctype">ctype</A></CODE> for type <I>char.</I>Hence, it describes an object that can serve as a<A HREF="#locale facet">locale facet</A>, to characterizevarious properties of a ``character'' (element) of type <I>char.</I>The explicit specialization differs from the template class in severalways:</P><UL><LI>An object of class <CODE>ctype<char></CODE> stores apointer to the first element of a<B><A NAME="ctype mask table">ctype mask table</A></B>, an array of<CODE><A HREF="limits.html#UCHAR_MAX">UCHAR_MAX</A> + 1</CODE>elements of type<CODE>ctype_base::<A HREF="#ctype_base::mask">mask</A></CODE>.It also stores a boolean object that indicates whether the arrayshould be deleted (using <CODE>operator delete[]</CODE>)when the <CODE>ctype<Elem></CODE> objectis destroyed.</LI><LI>Its sole public constructor lets you specify <CODE>tab</CODE>, thectype mask table, and <CODE>del</CODE>,the boolean object that is true if the arrayshould be deleted when the <CODE>ctype<char></CODE> objectis destroyed -- as well as the usual reference-count parameter<CODE>refs</CODE>.</LI><LI>The protected member function<CODE><A NAME="ctype<char>::table">table</A>()</CODE>returns the stored ctype mask table.</LI><LI>The static member object<CODE><A NAME="ctype<char>::table_size">table_size</A></CODE>specifies the minimum number of elements in a ctype mask table.</LI><LI>The protected static member function<CODE><A NAME="ctype<char>::classic_table">classic_table</A>()</CODE>returns the ctype mask table appropriate to the<A HREF="locale.html#C locale"><CODE>"C"</CODE> locale</A>.</LI><LI>There are no protected virtual member functions<CODE><A HREF="#ctype::do_is">do_is</A></CODE>,<CODE><A HREF="#ctype::do_scan_is">do_scan_is</A></CODE>, or<CODE><A HREF="#ctype::do_scan_not">do_scan_not</A></CODE>.The corresponding public member functions perform theequivalent operations themselves.</LI><LI>The member functions<CODE><A HREF="#ctype::do_narrow">do_narrow</A></CODE> and<CODE><A HREF="#ctype::do_widen">do_widen</A></CODE> simplycopy elements unaltered.</LI></UL><H2><CODE><A NAME="ctype_base">ctype_base</A></CODE></H2><PRE>class <B>ctype_base</B> {public: enum <B>mask</B> { <B>space</B> = 1 << 0, // EXAMPLE VALUES ONLY <B>print</B> = 1 << 1, <B>cntrl</B> = 1 << 2, <B>upper</B> = 1 << 3, <B>lower</B> = 1 << 4, <B>digit</B> = 1 << 5, <B>punct</B> = 1 << 6, <B>xdigit</B> = 1 << 7, <B>alpha</B> = 1 << 8, <B>alnum</B> = 0x9 << 5, <B>graph</B> = 0xB << 5};</PRE><P>The class serves as a base class for facets of template class<CODE><A HREF="#ctype">ctype</A></CODE>.It defines just the enumeration<B><CODE><A NAME="ctype_base::mask">mask</A></CODE></B>.Each of the enumeration constants characterizesa different way to classify characters, as defined by the functionswith similar names declared in the header<CODE><A HREF="ctype.html#<ctype.h>"><ctype.h></A></CODE>.The constants are:</P><UL><LI><B><CODE><A NAME="ctype_base::space">space</A></CODE></B>(function <CODE><A HREF="ctype.html#isspace">isspace</A></CODE>)</LI><LI><B><CODE><A NAME="ctype_base::print">print</A></CODE></B>(function <CODE><A HREF="ctype.html#isprint">isprint</A></CODE>)</LI><LI><B><CODE><A NAME="ctype_base::cntrl">cntrl</A></CODE></B>(function <CODE><A HREF="ctype.html#iscntrl">iscntrl</A></CODE>)</LI><LI><B><CODE><A NAME="ctype_base::upper">upper</A></CODE></B>(function <CODE><A HREF="ctype.html#isupper">isupper</A></CODE>)</LI><LI><B><CODE><A NAME="ctype_base::lower">lower</A></CODE></B>(function <CODE><A HREF="ctype.html#islower">islower</A></CODE>)</LI><LI><B><CODE><A NAME="ctype_base::digit">digit</A></CODE></B>(function <CODE><A HREF="ctype.html#isdigit">isdigit</A></CODE>)</LI><LI><B><CODE><A NAME="ctype_base::punct">punct</A></CODE></B>(function <CODE><A HREF="ctype.html#ispunct">ispunct</A></CODE>)</LI><LI><B><CODE><A NAME="ctype_base::xdigit">xdigit</A></CODE></B>(function <CODE><A HREF="ctype.html#isxdigit">isxdigit</A></CODE>)</LI><LI><B><CODE><A NAME="ctype_base::alpha">alpha</A></CODE></B>(function <CODE><A HREF="ctype.html#isalpha">isalpha</A></CODE>)</LI><LI><B><CODE><A NAME="ctype_base::alnum">alnum</A></CODE></B>(function <CODE><A HREF="ctype.html#isalnum">isalnum</A></CODE>)</LI><LI><B><CODE><A NAME="ctype_base::graph">graph</A></CODE></B>(function <CODE><A HREF="ctype.html#isgraph">isgraph</A></CODE>)</LI></UL><P>You can charaterize a combination of classifications byORing these constants. In particular, it is always true that<CODE>alnum == (alpha | digit)</CODE> and<CODE>graph == (alnum | punct)</CODE>.</P><H2><CODE><A NAME="ctype_byname">ctype_byname</A></CODE></H2><PRE>template<class Elem> class <B>ctype_byname</B> : public ctype<Elem> {public: explicit <B>ctype_byname</B>(const char *locname, size_t refs = 0);protected: <B>~ctype_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="#ctype">ctype</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="#ctype::ctype">ctype</A><Elem>(refs)</CODE>(or the equivalent for base class<CODE><A HREF="#ctype<char>">ctype<char></A></CODE>).</P><H2><CODE><A NAME="has_facet">has_facet</A></CODE></H2><PRE>template<class Facet> bool <B>has_facet</B>(const locale& loc);</PRE><P>The template function returns true if a<A HREF="#locale facet">locale facet</A> of class <CODE>Facet</CODE>is listed within the<A HREF="#locale object">locale object</A> <CODE>loc</CODE>.</P><H2><CODE><A NAME="isalnum">isalnum</A></CODE></H2><PRE>template<class Elem> bool <B>isalnum</B>(Elem ch, const locale& loc) const;</PRE><P>The template function returns<CODE><A HREF="#use_facet">use_facet</A><<A HREF="#ctype">ctype</A><Elem> >(loc).<A HREF="#ctype::is">is</A>(ctype<Elem>::<A HREF="#ctype_base::alnum">alnum</A>, ch)</CODE>.</P><H2><CODE><A NAME="isalpha">isalpha</A></CODE></H2><PRE>template<class Elem> bool <B>isalpha</B>(Elem ch, const locale& loc) const;</PRE><P>The template function returns<CODE><A HREF="#use_facet">use_facet</A><<A HREF="#ctype">ctype</A><Elem> >(loc).<A HREF="#ctype::is">is</A>(ctype<Elem>::<A HREF="#ctype_base::alpha">alpha</A>, ch)</CODE>.</P><H2><CODE><A NAME="iscntrl">iscntrl</A></CODE></H2><PRE>template<class Elem> bool <B>iscntrl</B>(Elem ch, const locale& loc) const;</PRE><P>The template function returns<CODE><A HREF="#use_facet">use_facet</A><<A HREF="#ctype">ctype</A><Elem> >(loc).<A HREF="#ctype::is">is</A>(ctype<Elem>::<A HREF="#ctype_base::cntrl">cntrl</A>, ch)</CODE>.</P><H2><CODE><A NAME="isdigit">isdigit</A></CODE></H2><PRE>template<class Elem> bool <B>isdigit</B>(Elem ch, const locale& loc) const;</PRE><P>The template function returns<CODE><A HREF="#use_facet">use_facet</A><<A HREF="#ctype">ctype</A><Elem> >(loc).<A HREF="#ctype::is">is</A>(ctype<Elem>::<A HREF="#ctype_base::digit">digit</A>, ch)</CODE>.</P><H2><CODE><A NAME="isgraph">isgraph</A></CODE></H2><PRE>template<class Elem> bool <B>isgraph</B>(Elem ch, const locale& loc) const;</PRE><P>The template function returns<CODE><A HREF="#use_facet">use_facet</A><<A HREF="#ctype">ctype</A><Elem> >(loc).<A HREF="#ctype::is">is</A>(ctype<Elem>::<A HREF="#ctype_base::graph">graph</A>, ch)</CODE>.</P><H2><CODE><A NAME="islower">islower</A></CODE></H2><PRE>template<class Elem> bool <B>islower</B>(Elem ch, const locale& loc) const;</PRE><P>The template function returns<CODE><A HREF="#use_facet">use_facet</A><<A HREF="#ctype">ctype</A><Elem> >(loc).<A HREF="#ctype::is">is</A>(ctype<Elem>::<A HREF="#ctype_base::lower">lower</A>, ch)</CODE>.</P><H2><CODE><A NAME="isprint">isprint</A></CODE></H2><PRE>template<class Elem> bool <B>isprint</B>(Elem ch, const locale& loc) const;</PRE><P>The template function returns<CODE><A HREF="#use_facet">use_facet</A><<A HREF="#ctype">ctype</A><Elem> >(loc).<A HREF="#ctype::is">is</A>(ctype<Elem>::<A HREF="#ctype_base::print">print</A>, ch)</CODE>.</P><H2><CODE><A NAME="ispunct">ispunct</A></CODE></H2><PRE>template<class Elem> bool <B>ispunct</B>(Elem ch, const locale& loc) const;</PRE><P>The template function returns<CODE><A HREF="#use_facet">use_facet</A><<A HREF="#ctype">ctype</A><Elem> >(loc).<A HREF="#ctype::is">is</A>(ctype<Elem>::<A HREF="#ctype_base::punct">punct</A>, ch)</CODE>.</P><H2><CODE><A NAME="isspace">isspace</A></CODE></H2><PRE>template<class Elem> bool <B>isspace</B>(Elem ch, const locale& loc) const;</PRE><P>The template function returns<CODE><A HREF="#use_facet">use_facet</A><<A HREF="#ctype">ctype</A><Elem> >(loc).<A HREF="#ctype::is">is</A>(ctype<Elem>::<A HREF="#ctype_base::space">space</A>, ch)</CODE>.</P><H2><CODE><A NAME="isupper">isupper</A></CODE></H2><PRE>template<class Elem> bool <B>isupper</B>(Elem ch, const locale& loc) const;</PRE><P>The template function returns<CODE><A HREF="#use_facet">use_facet</A><<A HREF="#ctype">ctype</A><Elem> >(loc).<A HREF="#ctype::is">is</A>(ctype<Elem>::<A HREF="#ctype_base::upper">upper</A>, ch)</CODE>.</P><H2><CODE><A NAME="isxdigit">isxdigit</A></CODE></H2><PRE>template<class Elem> bool <B>isxdigit</B>(Elem ch, const locale& loc) const;</PRE><P>The template function returns<CODE><A HREF="#use_facet">use_facet</A><<A HREF="#ctype">ctype</A><Elem> >(loc).<A HREF="#ctype::is">is</A>(ctype<Elem>::<A HREF="#ctype_base::xdigit">xdigit</A>, ch)</CODE>.</P><H2><CODE><A NAME="locale">locale</A></CODE></H2><HR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -