Tools.h++ Manual

21-140 104011 Tandem Computers Incorporated
21
Enumerations
enum RWDateOrder { DMY, MDY, YDM, YMD }
;
Public constructor
RWLocaleSnapshot(const char* localeName = 0)
;
Constructs an
RWLocale
object by extracting formats from the global locale
environment. It uses the Standard C Library function
setlocale()
to set the
named locale, and then restores the previous global locale after formats have
been extracted. If
localeName
is 0, it simply uses the current locale. The
most useful locale name is the empty string, ““, which is a synonym for the
user’s chosen locale (usually specified by the environment variable
LANG
).
Public member functions
virtual RWCString asString( long) const;
virtual RWCString asString(unsigned long) const;
virtual RWCString asString(double f, int precision = 6,
RWBoolean showpoint = 0) const;
virtual RWCString asString(struct tm* tmbuf,
char format,
const RWZone& zone) const;
virtual RWCString moneyAsString(double value,
enum CurrSymbol = LOCAL) const;
virtual RWBoolean stringToNum (const RWCString&,
double* fp) const;
virtual RWBoolean stringToNum (const RWCString&,
long* ip ) const;
virtual RWBoolean stringToDate (const RWCString&,
struct tm*) const;
virtual RWBoolean stringToTime (const RWCString&, struct
tm*) const;
cout << locale.asString(1234567.6543) << endl;
// Now get and print a date:
cout << "enter a date: " << flush;
RWDate date;
cin >> date;
if (date.isValid())
cout << date << endl;
else
cout << "bad date" << endl;
return 0; }
}
Code Example 21-3 (Continued)