Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Essential Tools Module Reference Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

RWLocaleSnapshot

Module:  Essential Tools Module   Group:  Internationalization Classes


RWLocaleSnapshotRWLocale

Local Index

Members

Synopsis

#include <locale.h>
#include <rw/locale.h>
RWLocaleSnapshot ourLocale("");  // encapsulate user's formats

Description

The class RWLocaleSnapshot implements the RWLocale interface using Standard C Library facilities. To use it, the program creates an RWLocaleSnapshot instance. The constructor of the instance queries the program's environment (using Standard C Library functions such as localeconv(), strftime(), and, if available, vendor specific library functions) to determine the formatting conventions in effect at the moment of instantiation. When done, the locale can then be switched and another instance of RWLocaleSnapshot created.

By creating multiple instances of RWLocaleSnapshot, your program can have more than one locale active at the same time, something that is difficult to do with the Standard C Library facilities.

Note: RWLocaleSnapshot does not encapsulate character set, collation, or message information.

Class RWLocaleSnapshot contains a set of public data members initialized by its constructor with information extracted from its execution environment.

For a description of the static members of the RWLocale interface that operate on objects of type RWLocaleSnapshot, see the RWLocale class description.

Persistence

None

Example


NOTE -- To ensure that the asString() methods in this example correctly format the output, you must first install on your system any locale you request before invoking RWLocaleSnapshot().

Program output:

Public Constructor

RWLocaleSnapshot(const char* localeName = 0);

Public Member Functions

virtual RWCString
asString(long) const;
virtual RWCString
asString(unsigned long) const;
virtual RWCString
asString(double f, int precision = 6,
bool showpoint = 0) const; virtual RWCString asString(long double val, int precision = 6, bool showpoint = 0) const; virtual RWCString asString(struct tm* tmbuf,char format, const RWZone& zone); const; virtual RWCString asString(struct tm* tmbuf,char* format, const RWZone& zone) const; virtual RWCString moneyAsString(double value,enum CurrSymbol = LOCAL) const; virtual bool stringToNum (const RWCString&, double* fp) const; virtual bool stringToNum (const RWCString&, long* ip ) const; virtual bool stringToNum (const RWCString&, unsigned long*) const; virtual bool
stringToDate (const RWCString&, struct tm*) const; virtual bool stringToTime (const RWCString&, struct tm*) const; virtual bool stringToMoney(const RWCString&, double* , RWLocale::CurrSymbol=LOCAL) const;

Note: All previous member functions are redefined from class RWLocale. These virtual functions follow the interface described under class RWLocale. They generally work by converting values to and from strings using the rules specified by the struct lconv values (see <locale.h>) encapsulated in self.

virtual const RWCString& 
currency_symbol() const
virtual const RWCString& 
decimal_point() const
virtual const RWCString& 
grouping() const
virtual const RWCString& 
int_curr_symbol() const
virtual const RWCString& 
locale_name() const
virtual const RWCString& 
mon_decimal_point() const
virtual const RWCString& 
mon_thousands_sep() const
virtual const RWCString& 
mon_grouping() const
virtual const RWCString& 
positive_sign() const
virtual const RWCString& 
negative_sign() const
virtual const RWCString& 
thousands_sep() const

Public Data Members

These are defined identically as the correspondingly-named members of the Standard C Library type lconv, from <locale.h>.



Previous fileTop of DocumentContentsIndex pageNext file

© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.