blob: 48294a0c69c4766f05bbb7c97779118a34459678 [file] [log] [blame]
<HTML>
<HEAD>
<TITLE>An Example of a Derived Facet Class</TITLE>
<LINK REL=StyleSheet HREF="../rw.css" TYPE="text/css" TITLE="Apache stdcxx Stylesheet"></HEAD>
<BODY BGCOLOR=#FFFFFF>
<A HREF="26-5.html"><IMG SRC="images/bprev.gif" WIDTH=20 HEIGHT=21 ALT="Previous file" BORDER=O></A><A HREF="noframes.html"><IMG SRC="images/btop.gif" WIDTH=56 HEIGHT=21 ALT="Top of Document" BORDER=O></A><A HREF="booktoc.html"><IMG SRC="images/btoc.gif" WIDTH=56 HEIGHT=21 ALT="Contents" BORDER=O></A><A HREF="tindex.html"><IMG SRC="images/bindex.gif" WIDTH=56 HEIGHT=21 ALT="Index page" BORDER=O></A><A HREF="26-7.html"><IMG SRC="images/bnext.gif" WIDTH=25 HEIGHT=21 ALT="Next file" BORDER=O></A><DIV CLASS="DOCUMENTNAME"><B>Apache C++ Standard Library User's Guide</B></DIV>
<H2>26.6 An Example of a Derived Facet Class</H2>
<A NAME="idx601"><!></A>
<P>As mentioned previously, the phone _put facet class is intended to serve as a base class. The facet does not format phone numbers in a locale-specific fasion.. Let's now present an example of a derived facet class, the US phone number formatting facet. This facet initializes the base class with the string "US" and its own locality, and the prefix for dialing foreign numbers, "011"; it works by default with the static country code table. Here is the class declaration for the facet:</P>
<UL><PRE>
class US_phone_put : public phone_put {
public:
US_phone_put (CodeMap* codeMap = 0, bool delete_it = false,
std::size_t refs = 0)
: phone_put ("US", "011", codeMap, delete_it, refs) { }
};
</PRE></UL>
<P>Other concrete facet classes are built similarly.</P>
<BR>
<HR>
<A HREF="26-5.html"><IMG SRC="images/bprev.gif" WIDTH=20 HEIGHT=21 ALT="Previous file" BORDER=O></A><A HREF="noframes.html"><IMG SRC="images/btop.gif" WIDTH=56 HEIGHT=21 ALT="Top of Document" BORDER=O></A><A HREF="booktoc.html"><IMG SRC="images/btoc.gif" WIDTH=56 HEIGHT=21 ALT="Contents" BORDER=O></A><A HREF="tindex.html"><IMG SRC="images/bindex.gif" WIDTH=56 HEIGHT=21 ALT="Index page" BORDER=O></A><A HREF="26-7.html"><IMG SRC="images/bnext.gif" WIDTH=20 HEIGHT=21 ALT="Next file" BORDER=O></A>
<!-- Google Analytics tracking code -->
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-1775151-1";
urchinTracker();
</script>
<!-- end of Google Analytics tracking code -->
</BODY>
</HTML>