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

RWLocale

Module:  Essential Tools Module   Group:  Internationalization Classes


Does not inherit

Local Index

Members

Synopsis

#include <locale.h>
#include <rw/locale.h>
(Abstract base class)

Description

RWLocale is an abstract base class. It defines an interface that formats the conversion of strings to and from dates and times. It formats dates (including day and month names), times, currency, and numbers (including digit grouping).

Note that because it is an abstract base class, there is no way to actually enforce these goals -- the description here is merely the model of how a class derived from RWLocale should act.

There are three ways to use an RWLocale object:

The library provides two main implementations of RWLocale. These subclasses each allow more than one locale to be active at a time, and they also support conversion from strings to other types. They include:

Persistence

None

Enumeration

enum 
CurrSymbol { NONE, LOCAL, INTL };

Public Member Functions

virtual RWCString
asString(long) const = 0;
virtual RWCString
asString(unsigned long) const = 0;
virtual RWCString
asString(double f, int precision = 6,
         bool showpoint = 0) const = 0;
virtual RWCString 
asString(long double val, int precision = 10, Boolean
         showpoint = 0) const;
virtual RWCString
asString(const struct tm* tmbuf,char format, 
         const RWZone& zone=RWZone::local()) const = 0;
RWCString
asString(const struct tm* tmbuf,const char* format, 
         const RWZone& zone) const;
const RWLocale*
imbue(ios& stream) const;
virtual const RWCString& 
locale_name() const
virtual RWCString
moneyAsString(double value,enum CurrSymbol = LOCAL) 
              const = 0;
virtual int
monthIndex(const RWCString&) const = 0;
virtual bool
stringToNum(const RWCString&, double* fp) const = 0;
virtual bool
stringToNum(const RWCString&, long* ip) const = 0;
virtual bool 
stringToNum (const RWCString&, unsigned long*) const = 0;

NOTE -- If you are using the C locale, you must omit commas as thousands separators. Because the default locale is likely to be C for many English-speaking programmers, numbers with commas separating the thousands may be rejected. This is true even in a locale where English is the dominant language.
virtual bool
stringToDate(const RWCString&, struct tm*) const = 0;
virtual bool
stringToMoney(const RWCString&, double*,
              RWLocale::CurrSymbol=LOCAL) const = 0;
virtual bool
stringToTime(const RWCString&, struct tm*) const = 0;
virtual int
weekdayIndex(const RWCString&) const = 0;

Static Public Member Functions

const RWLocale*
defaultLocale();
static const RWLocale*
global(const RWLocale* loc);
static const RWLocale&
global();
static const RWLocale*
imbue(std::ios& s);
static const RWLocale&
of(ios&);
static const RWLocale*
unimbue(std::ios& s);


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.