バナーをクリックすれば目次に戻ります
Copyright 1999 Rogue Wave Software
Copyright 1999 Sun Microsystems, Inc.
RWLocale
#include <locale.h> #include <rw/locale.h> (抽象基底クラス)
このクラスは抽象基底クラスなので、実際の処理は行いません。ここでは、RWLocale から派生したクラスの動作のモデルを説明しているだけです。
RWLocale オブジェクトを使用するには、次の 3 つの方法があります。
RWLocale の実装として、ライブラリには次の 2 つがあります。
enum
CurrSymbol { NONE, LOCAL, INTL };
virtual RWCString asString(long) const = 0; virtual RWCString asString(unsigned long) const = 0;
virtual RWCString asString(double f, int precision = 6, RWBoolean showpoint = 0) const = 0;
virtual RWCString asString(const struct tm* tmbuf,char format, const RWZone& zone) const = 0;
strftime() の書式指定文字の要約については、表 2-1 を参照してください。
RWCString
asString(const struct tm* tmbuf,const char* format,
const RWZone& zone) const;
strftime() の書式指定文字の要約については、表 2-1 を参照してください。この関数は、以前のライブラリバージョンとリンクの互換性を保つために、仮想関数ではありません。
virtual RWCString
moneyAsString(double value,
enum CurrSymbol = LOCAL) const = 0;
virtual int monthIndex(const RWCString&) const = 0;
virtual RWBoolean stringToNum(const RWCString&, double* fp) const = 0;
"1" " -02. " ".3"
"1234.56" "1e10" "+ 19,876.2E+20"
virtual RWBoolean stringToNum(const RWCString&, long* ip) const = 0;
"1" " -02. " "+ 1,234"
"1234545" "1,234,567"
| フォーマット文字 | 意味 | 例 |
|---|---|---|
| a | 曜日名の省略形 [tm::tm_wday] | Sun |
| A | 曜日名 [tm::tm_wday] | Sunday |
| b | 月名の省略形 | Feb |
| B | 月名 | February |
| c | 日付と時刻 [全メンバーを使用可能] | Feb 29 14:34:56 1984 |
| d | 月の通し日 | 29 |
| H | 24 時間単位の時刻 | 14 |
| I | 12 時間単位の時刻 | 02 |
| j | 年の通し日 (001 から) [tm::tm_yday] | 60 |
| m | 月番号 (01 から) | 02 |
| M | 分 | 34 |
| p | 午前・午後の印 (存在する場合) | AM |
| S | 秒 | 56 |
| U | 日曜を先頭にした週の通し番号 (00 から) [tm::tm_yday と tm::tm_wday] | |
| w | 曜日 (日曜を 0) | 0 |
| W | 月曜を先頭にした週の通し番号 (00 から) [tm::tm_yday と tm::tm_wday] | |
| x | 日付 [ロケールによって tm::tm_yday を使用] | Feb 29 1984 |
| X | 時刻 | 14:34:56 |
| y | 世紀の通し年 (0 から) | 84 |
| Y | 年 | 1984 |
| Z (大文字) | タイムゾーン名 [tm::tm_isdst] | PST または PDT |
virtual RWBoolean stringToDate(const RWCString&, struct tm*) const = 0;
"Jan 9, 62" "1/9/62" "January 9 1962"
"09Jan62" "010962"
virtual RWBoolean stringToTime(const RWCString&, struct tm*) const = 0;
"1:10 AM" "13:45:30" "12.30.45pm"
"PM 3:15" "1430"
virtual RWBoolean
stringToMoney(const RWCString&, double*,
RWLocale::CurrSymbol=LOCAL) const = 0;
const RWLocale* imbue(ios& stream) const;
virtual int weekdayIndex(const RWCString&) const = 0;
static const RWLocale& of(ios&);
static const RWLocale* global(const RWLocale* loc);
static const RWLocale& global();
const RWLocale* defaultLocale();
