Rogue Wave バナー
前へマニュアルの先頭へ目次次へ

5.8 電話番号の書式設定

この段階でも、ファセットクラスの実装は未完成です。実際の電話番号の書式設定の実装について、以下に説明します。以下の例に示すように、書式設定は、2 つの仮想関数 put_country_code() と 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;
};

関数 put_country_code() と put_domestic_area_code() は、基底クラスでは純粋な仮想関数なので、派生ファセットクラスで設定します。複雑になるので、ここでは派生クラスの詳しい説明は省略します。詳細については、このソフトウェアとともにディスクに同梱されているサンプルコードのディレクトリを参照してください。


前へマニュアルの先頭へ目次次へ

Copyright (c) 1998, Rogue Wave Software, Inc.
このマニュアルに関する誤りのご指摘やご質問は、電子メールにてお送りください。


OEM リリース, 1998 年 6 月