Even now, however, the implementation of our facet class is incomplete. We still need to mention how the actual formatting of a phone number is implemented. In the example below, it is done by calling two virtual functions, put_country_code() and put_domestic_area_code():
class phone_put: public locale::facet { public: // ... string put(const string& ext, const string& area, const string& cnt) const; protected: // ... virtual string_t put_country_code (const string_t& country) const = 0; virtual string_t put_domestic_area_code (const string_t& area) const = 0; };
Note that the functions put_country_code() and put_domestic_area_code() are purely virtual in the base class, and thus must be provided by the derived facet classes. For the sake of brevity, we spare you here the details of the functions of the derived classes. For more information, please consult the directory of sample code delivered on disk with this product.
OEM Edition, ©Copyright 1999, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.