[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

 

Chapter 7.

 

22 Localization Library



This chapter describes components that C + + library that may use for porting to different cultures.


Overview of Localization library

The locale facility includes internationalization support for


22.1 Locales

The header <locale> defines classes used to contain and manipulate information for a locale.


22.1.1 Class locale

The class locale contains a set of facets for locale implementation. These facets are as if they were and index and an interface at the same time.

Class Locale:


namespace std {
class locale {
public:
class facet;
class id;
typedef int category;
static const category 
none = 0,
collate = 0x010, ctype = 0x020,
monetary = 0x040, numeric = 0x080,
time = 0x100, messages = 0x200,
all = collate | ctype | monetary | numeric | time | messages;

locale() throw()
locale(const locale& other) throw()
explicit locale(const char* std_name);
locale(const locale& other, const char* std_name, category);
template <class Facet> locale(const locale& other, Facet* f);
locale(const locale& other, const locale& one, category);
~locale() throw(); 

const locale& operator=(const locale& other) throw();
template <class Facet> locale combine(const locale& other);

basic_string<char> name() const;
bool operator==(const locale& other) const;
bool operator!=(const locale& other) const;
template <class charT, class Traits, class Allocator>
bool operator()(const basic_string<charT,Traits,Allocator>& s1,
const basic_string<charT,Traits,Allocator>& s2) const; 

static locale global(const locale&);
static const locale& classic();
};
}


22.1.1.1 Locale Types

This library contains various types specific for locale implementation.


22.1.1.1.1 Type locale::Category

An integral type used as a mask for all types.

Prototype:

typedef int category;

Each locale member function takes a locale::category argument based on a corresponding facet.

Locale Category Facets:

 

Category
Includes Facets
collate  
collate<char>, collate<wchar_t>  
ctype  
ctype<char>, ctype<wchar_t>, codecvt<char,char,mbstate_t>,   codecvt<wchar_t,char,mbstate_t>  
messages  
messages<char>, messages<wchar_t>  
monetary  
moneypunct<char>, moneypunct<wchar_t>   moneypunct<char,true>, moneypunct<wchar_t,true>,   money_get<char>, money_get<wchar_t>   money_put<char>, money_put<wchar_t>  
numeric  
numpunct<char>, numpunct<wchar_t>,   num_get<char>, num_get<wchar_t>   num_put<char>, num_put<wchar_t>  
time  
time_get<char>, time_get<wchar_t>,   time_put<char>, time_put<wchar_t>  

An implementation is included for each facet template member of a category.

Required Instantiations:

 

Category
Includes Facets
collate  
collate_byname<char>, collate_byname<wchar_t>  
ctype  
ctype_byname<char>, ctype_byname<wchar_t>  
messages  
messages_byname<char>, messages_byname<wchar_t>  
monetary  
moneypunct_byname<char,International>,   moneypunct_byname<wchar_t,International>,   money_get<C,InputIterator>,   money_put<C,OutputIterator>  
numeric  
numpunct_byname<char>, numpunct_byname<wchar_t>   num_get<C,InputIterator>, num_put<C,OutputIterator>  
time  
time_get<char,InputIterator>,   time_get_byname<char,InputIterator>,   time_get<wchar_t,OutputIterator>,   time_get_byname<wchar_t,OutputIterator>,   time_put<char,OutputIterator>,   time_put_byname<char,OutputIterator>,   time_put<wchar_t,OutputIterator>   time_put_byname<wchar_t,OutputIterator>  


22.1.1.1.2 Class Locale::facet

The class facet is the base class for locale feature sets.

class locale:: facet synopsis:


namespace std {
class locale::facet {
protected:
explicit facet(size_t refs = 0);
virtual ~facet();
private:
facet(const facet&); // not defined void operator=(const facet&); // not defined };
}


22.1.1.1.3 Class locale::id

The class locale::id is used for an index for locale facet identification.

class locale::id synopsis:


namespace std {
class locale::id {
public:
id();
private:
void operator=(const id&); // not defined id(const id&); // not defined };
}


22.1.1.2 Locale Constructors


Constructors

Constructs an object of locale.

Prototype:

locale() throw();


locale(const locale& other) throw();


explicit locale(const char* std_name);


locale(const locale& other, 
  const char* std_name, category);
template <class Facet> locale
  (const locale& other, Facet* f);
locale(const locale& other, 
  const locale& one, category cats);

If a locale object is created with an empty string the LANG environmental variable is used to determine the Language.


destructor

Removes a locale object.

Prototype:

~locale() throw();


22.1.1.3 Locale Members

Member functions of the class locale.


combine

Creates a copy of the locale except for the type Facet of the argument.

Prototype:

template <class Facet> locale combine(const 
locale& other);
Return:

The newly created locale is returned.


name

Returns the name of the locale.

Prototype:

basic_string<char> name() const;
Return:

Returns the name of the locale or "*" if there is none.


22.1.1.4 Locale Operators

The class locale has overloaded operators.


operator ==

The locale equality operator.

Prototype:

bool operator==(const locale& other) const;
Return:

The equality operator returns true if both arguments are the same locale.


operator !=

The locale non-equality operator

Prototype:

bool operator!=(const locale& other) const;
Return:

The non-equality operator returns true if the locales are not the same.


operator ()

Compares two strings using use_facet<collate<> >.

Prototype:

template <class charT, 
  class Traits, class Allocator>
bool operator()(
  const basic_string<charT,Traits,Allocator>& s1,
  const basic_string<charT,Traits,Allocator>& s2)
  const;
Return:

Returns true if the first argument is less than the second argument for ordering.


22.1.1.5 Locale Static Members


global

Installs a new global locale.

Prototype:

static locale global(const locale& loc);
Return:

Global returns the previous locale.


classic

Sets the locale to "C" locale equivalent to locale("C").

Prototype:

static const locale& classic();

Return:

This function returns the "C" locale.


22.1.2 Locale Globals

Locale has two global functions.


use_facet

Retrieves a reference to a facet of a locale.

Prototype:

template <class Facet> const Facet& use_facet
  (const locale& loc);

Throws a bad_cast exception if has_facet is false.

Return:

The function returns a facet reference to corresponding to its argument.


has_facet

Tests a locale to see if a facet is present

Prototype:

template <class Facet> bool has_facet
  (const locale& loc) throw();
Return:

If a facet requested is present has_facet returns true.


22.1.3 Convenience Interfaces

Character classification functionality is provided for in the locale class.


22.1.3.1 Character Classification

Character Classification:


template <class charT> bool isspace (charT c, const locale& loc);
template <class charT> bool isprint (charT c, const locale& loc);
template <class charT> bool iscntrl (charT c, const locale& loc);
template <class charT> bool isupper (charT c, const locale& loc);
template <class charT> bool islower (charT c, const locale& loc);
template <class charT> bool isalpha (charT c, const locale& loc);
template <class charT> bool isdigit (charT c, const locale& loc);
template <class charT> bool ispunct (charT c, const locale& loc);
template <class charT> bool isxdigit(charT c, const locale& loc);
template <class charT> bool isalnum (charT c, const locale& loc);
template <class charT> bool isgraph (charT c, const locale& loc);

In the character classification functions true is returned if the function evaluates to true.


22.1.3.2 Character Conversions

Character conversion functionality is provided for in the locale class.


toupper

Converts to upper case character using the locale specified.

Prototype:

template <class charT> charT toupper
  (charT c, const locale& loc) const;
Return:

Returns the upper case character.


tolower

Converts to a lower case character using the locale specified.

Prototype:

template <class charT> charT tolower
  (charT c, const locale& loc) const;
Return:

Returns the lower case character.


22.2 Standard Locale Categories

The standard provides for various locale categories for providing formatting and manipulation of data and streams.


22.2.1 The Ctype Category

The type ctype_base provides for const enumerations.

Ctype Category:


namespace std {
class ctype_base {
public:
enum mask { 
space=1<<0, print=1<<1, cntrl=1<<2, upper=1<<3, lower=1<<4,
alpha=1<<5, digit=1<<6, punct=1<<7, xdigit=1<<8,
alnum=alpha|digit, graph=alnum|punct
};
};
}

The class ctype provides for character classifications.


22.2.1.1 Template Class Ctype


template <class charT>
class ctype : public locale::facet, public ctype_base {
public:
typedef charT char_type;
explicit ctype(size_t refs = 0);
bool is(mask m, charT c) const;
const charT* is
	(const charT* low, const charT* high, mask* vec) const;
const charT* scan_is
	(mask m,const charT* low, const charT* high) const; 
const charT* scan_not
	(mask m,const charT* low, const charT* high) const; 
charT toupper(charT c) const;
const charT* toupper(charT* low, const charT* high) const;
charT tolower(charT c) const;
const charT* tolower(charT* low, const charT* high) const;
charT widen(char c) const;
const char* widen
	(const char* low, const char* high, charT* to) const;
char narrow(charT c, char dfault) const;
const charT* narrow
	(const charT* low, const charT*, char dfault, char* to) const;
static locale::id id;
protected:
~ctype(); //virtual 
virtual bool do_is(mask m, charT c) const;
virtual const charT* do_is
	(const charT* low, const charT* high, mask* vec) const; 
virtual const charT* do_scan_is
	(mask m, const charT* low, const charT* high) const; 
virtual const charT* do_scan_not
	(mask m, const charT* low, const charT* high) const; 
virtual charT do_toupper(charT) const;
virtual const charT* do_toupper
	(charT* low, const charT* high) const;
virtual charT do_tolower(charT) const;
virtual const charT* do_tolower
	(charT* low, const charT* high) const;
virtual charT do_widen(char) const;
virtual const char* do_widen
	(const char* low, const char* high, charT* dest) const; 
virtual char do_narrow(charT, char dfault) const;
virtual const charT* do_narrow
	(const charT* low, const charT* high, 
	char dfault, char* dest) const; 
};


22.2.1.1.1 Ctype Members


is

An overloaded function that tests for or places a mask.

Prototype:

bool is(mask m, charT c) const;

Test if c matches the mask m.

Return:

Returns true if the char c matches mask.

Prototype:

const charT* is
  (const charT* low, const charT* high,
  mask* vec) const;

Fills between the low and high with the mask argument.

Return:

Returns the second argument.


scan_is

Scans the range for a mask value.

Prototype:

const charT* scan_is
  (mask m, const charT* low,
  const charT* high) const;
Return:

Returns a pointer to the first character in the range that matches the mask, or the high argument if there is no match.


scan_not

Scans the range for exclusion of the mask value.

Prototype:

const charT* scan_not(mask m,
  const charT* low, const charT* high) const;
Return:

Returns a pointer to the first character in the range that does not match the mask, or the high argument if all characters match


toupper

Converts to a character or a range of characters to uppercase.

Prototype:

charT toupper(charT) const;


const charT* toupper
  (charT* low, const charT* high) const;
Return:

Returns the converted char if it exists.


tolower

Converts to a character or a range of characters to lowercase.

Prototype:

charT tolower(charT c) const;


const charT* tolower(charT* low, const charT* 
high) const;
Return:

Returns the converted char if it exists.


widen

Converts a char or range of char type to the charT type.

Prototype:

charT widen(char c) const;


const char* widen(const char* low, const char* 
high, charT* to) const;
Return:

The converted charT is returned.


narrow

Converts a charT or range of charT type to the char type.

Prototype:

char narrow(charT c, char dfault) const;


const charT* narrow(const charT* low, const 
charT*, char dfault,


char* to) const;
Return:

The converted char is returned.


22.2.1.1.2 Ctype Virtual Functions

Virtual functions must be overloaded in the locale.


do_is

Implements is.

Prototype:

bool do_is
  (mask m, charT c) const;
const charT* do_is
  (const charT* low, const charT* high,
  mask* vec) const;

do_scan_is

Implements scan_is.

Prototype:

const charT* do_scan_is(mask m,


const charT* low, const charT* high) const;

do_scan_not

Implements scan_not.

Prototype:

const charT* do_scan_not(mask m,


const charT* low, const charT* high) const;

do_toupper

Implements toupper.

Prototype:

charT do_toupper(charT c) const;


const charT* do_toupper(charT* low, const charT* 
high) const;

do_tolower

Implements tolower.

Prototype:

charT do_tolower(charT c) const;


const charT* do_tolower(charT* low, const charT* 
high) const;

do_widen

Implements widen.

Prototype:

charT do_widen(char c) const;


const char* do_widen(const char* low, const char* 
high,


charT* dest) const;

do_narrow

Implements narrow.

Prototype:

char do_narrow(charT c, char dfault) const;


const charT* do_narrow(const charT* low, const 
charT* high,


char dfault, char* dest) const;

22.2.1.2 Template Class Ctype_byname

Class Ctype_byname:


Template class ctype_byname
namespace std { template <class charT>
class ctype_byname : public ctype<charT> {
public:
typedef ctype<charT>::mask mask; 
explicit ctype_byname(const char*, size_t refs = 0);
protected:
~ctype_byname(); 
// virtual 
virtual bool do_is(mask m, charT c) const;
virtual const charT* do_is
	(const charT* low, const charT* high,mask* vec) const; 
virtual const char* do_scan_is
	(mask m, const charT* low, const charT* high) const; 
virtual const char* do_scan_not
	(mask m, const charT* low, const charT* high) const; 
virtual charT do_toupper(charT) const;
virtual const charT* do_toupper
	(charT* low, const charT* high) const;
virtual charT do_tolower(charT) const;
virtual const charT* do_tolower
	(charT* low, const charT* high) const;
virtual charT do_widen(char) const;
virtual const char* do_widen
	(const char* low, const char* high, charT* dest) const; 
virtual char do_narrow(charT, char dfault) const;
virtual const charT* do_narrow
	(const charT* low, const charT* high,
	char dfault, char* dest) const; 
};
}


22.2.1.3 Ctype Specializations


namespace std {
template <> class ctype<char>
: public locale::facet, public ctype_base {
public:
typedef char char_type;
explicit 
ctype(const mask* tab = 0, bool del = false,
size_t refs = 0); 
bool is(mask m, char c) const;
const char* is(const char* low, const char* high, mask* vec) const;
const char* scan_is (mask m,
const char* low, const char* high) const; 
const char* scan_not(mask m,
const char* low, const char* high) const; 
char toupper(char c) const;
const char* toupper(char* low, const char* high) const;
char tolower(char c) const;
const char* tolower(char* low, const char* high) const;
char widen(char c) const;
const char* widen
	(const char* low, const char* high, char* to) const;
char narrow(char c, char dfault) const;
const char* narrow
	(const char* low, const char* high, 
	char dfault, char* to) const; 
static locale::id id;
static const size_t table_size;
protected:
const mask* table() const throw();
static const mask* classic_table() throw();
~ctype(); //virtual 
virtual char do_toupper(char c) const;
virtual const char* do_toupper
	(char* low, const char* high) const;
virtual char do_tolower(char c) const;
virtual const char* do_tolower
	(char* low, const char* high) const;
virtual char do_widen(char c) const;
virtual const char* do_widen
	(const char* low, const char* high, char* to) const; 
virtual char do_narrow(char c, char dfault) const;
virtual const char* do_narrow
	(const char* low, const char* high, 
	char dfault, char* to) const; };
}


22.2.1.3.1 Ctype<Char> Constructor and Destructor

Specialized ctype<char> constructors and destructor.


Constructor

Constructs a ctype object.

Prototype:

explicit ctype
  (const mask* tbl = 0, bool del = false,
  size_t refs = 0);

destructor

Removes a ctype object.

Prototype:

~ctype();


22.2.1.3.2 Ctype<Char> Members

Specialize ctype<char> member functions are identical functionality to "22.2.1.1.1 Ctype Members."

Prototype:

bool is(mask m, char c) const;


const char* is(const char* low, const char* high,


mask* vec) const;
Prototype:
const char* scan_is(mask m,
  const char* low, const char* high) const;
Prototype:
const char* scan_not(mask m,


const char* low, const char* high) const;
Prototype:
char toupper(char c) const;


const char* toupper(char* low, const char* high) 
const;
Prototype:
char tolower(char c) const;


const char* tolower(char* low, const char* high) 
const;
Prototype:
char widen(char c) const;


const char* widen(const char* low, const char* 
high,


char* to) const;
Prototype:
char narrow(char c, char /*dfault*/) const;


const char* narrow(const char* low, const char* 
high,


char /*dfault*/, char* to) const;
Prototype:

const mask* table() const throw();


22.2.1.3.3 Ctype<Char> Static Members

Specialized ctype<char> static members. are provided.


classic_table

Determines the classification of characters in the "C" locale.

Prototype:

static const mask* classic_table() throw();

Return:

Returns to a table that represents the classification in a "C" locale.


22.2.1.3.4 Ctype<Char> Virtual Functions

Specialize ctype<char> virtual member functions are identical functionality to "22.2.1.1.2 Ctype Virtual Functions."

Prototype:

char do_toupper(char) const;


const char* do_toupper
  (char* low, const char* high) const;
Prototype:
char do_tolower(char) const;


const char* do_tolower
  (char* low, const char* high) const;
Prototype:
virtual char do_widen(char c) const;


virtual const char* do_widen
  (const char* low,const char* high,
  char* to) const;
Prototype:
virtual char do_narrow(char c, char dfault) const;


virtual const char* do_narrow
  (const char* low,const char* high,
  char dfault, char* to) const;

22.2..1.4 Class ctype_byname<char>

A specialization of ctype_byname of type char.

Ctype_byname<char> Synopsis:


namespace std { 
template <> class ctype_byname<char> : public ctype<char> { 
public:
explicit ctype_byname(const char*, size_t refs = 0);
protected:
~ctype_byname(); // virtual 
virtual char do_toupper(char c) const;
virtual const char* do_toupper
	(char* low, const char* high) const;
virtual char do_tolower(char c) const;
virtual const char* do_tolower
	(char* low, const char* high) const;
virtual char do_widen(char c) const;
virtual const char* do_widen
	(char* low,const char* high, char* to) const; 
virtual char do_widen(char c) const;
virtual const char* do_widen(char* low, const char* high) const; 
};
}


22.2.1.5 Template Class Codecvt

A class used for converting one character encoded types to another. For example, from wide character to multibyte character sets.

Template Class Codevect Synopsis:


namespace std {
class codecvt_base { 
public: 
enum result 
	{ ok, partial, error, noconv }; 
}; 
template <class internT, class externT, class stateT> 
class codecvt : public locale::facet, public codecvt_base { 
public: 
typedef internT intern_type; 
typedef externT extern_type; 
typedef stateT state_type; 
explicit codecvt(size_t refs = 0) 
result out
	(stateT& state, const internT* from, const internT* from_end,
	const internT*& from_next, externT* to, externT* to_limit,
	externT*& to_next) const; 
result unshift
	(stateT& state, externT* to, externT* to_limit, 
	externT*& to_next) const; 
result in
	(stateT& state, const externT* from, const externT* from_end,
	const externT*& from_next, internT* to, internT* to_limit,
	internT*& to_next) const; 
int encoding() const throw(); 
bool always_noconv() const throw(); 
int length
	(const stateT&, const externT* from, const externT* end, 
	size_t max) const; 
int max_length() const throw(); 
static locale::id id; 
protected: 
~codecvt(); //virtual 
virtual result do_out
	(stateT& state, const internT* from, const internT* from_end,
	 const internT*& from_next, externT* to, externT* to_limit,
	 externT*& to_next) const; 
virtual result do_in
	(stateT& state, const externT* from, const externT* from_end,
	const externT*& from_next, internT* to, internT* to_limit,
	internT*& to_next) const; 
virtual result do_unshift
	(stateT& state, externT* to, externT* to_limit, 
	externT*& to_next) const; 
virtual int do_encoding() const throw(); 
virtual bool do_always_noconv() const throw(); 
virtual int do_length
	(const stateT&, const externT* from, const externT* end, 
	size_t max) const; 
virtual int do_max_length() const throw(); 
}; 
}


22.2.1.5.1 Codecvt Members

Member functions of the codecvt class.


out

Convert internal representation to external.

Prototype:

result out(
  stateT& state,const internT* from,
  const internT* from_end, const internT*&
  from_next, externT* to, externT* to_limit,
  externT*& to_next) const;

unshift

Converts the shift state.

Prototype:

result unshift(stateT& state,


externT* to, externT* to_limit, externT*& to_next) 
const;

in

Converts external representation to internal.

Prototype:

result in(stateT& state, const externT* from, 
  const externT* from_end, const externT*&
  from_next, internT* to, internT* to_limit,
   internT*& to_next) const;

always_noconv

Determines if no conversion is ever done.

Prototype:

bool always_noconv() const throw();
Return:

Returns true if no conversion will be done.


length

Determines the length between two points.

Prototype:

int length(stateT& state, const externT* from,
  const externT* from_end, size_t max) const;
Return:

The distance between two points is returned.


max_length

Determines the length necessary for conversion.

Prototype:

int max_length() const throw();
Return:

The number of elements to convert from externT to internT is returned.


22.2.1.5.2 Codecvt Virtual Functions

Virtual functions for codecvt implementation.

Prototype:

result do_out(stateT& state, const internT* from,
  const internT* from_end,
  const internT*& from_next, externT* to,
externT* to_limit, externT*& to_next) const;

Implements out.

Return:

The result is returned as a value as in "Convert Result Values."

Prototype:

result do_in(stateT& state, const externT* from,
  const externT* from_end,
  const externT*& from_next, internT* to,
internT* to_limit, internT*& to_next) const;

Implements in.

Return:

The result is returned as a value as in "Convert Result Values."

Prototype:

result do_unshift(stateT& state,


externT* to, externT* to_limit, externT*& to_next) 
const;

Implements unshift.

Return:

The result is returned as a value as in "Convert Result Values."

Prototype:

int do_encoding() const throw();

Implements encoding.

Prototype:

bool do_always_noconv() const throw();

Implements always_noconv.

Prototype:

int do_length(stateT& state, const externT* from, 
const externT* from_end, size_t max) const;

Implements length.

Prototype:

int do_max_length() const throw();

Implements max_length.

Convert Result Values:

 

Value
Meaning
error  
Encountered a from_type character it could not convert  
noconv  
No conversion was needed  
ok  
Completed the conversion  
partial  
Not all source characters converted  


22.2.1.6 Template Class Codecvt_byname

A class for code conversion by name.

Template Class Codecvt_byname Synopsis:


namespace std {
template <class internT, class externT, class stateT> 
class codecvt_byname : public codecvt<internT, externT, stateT> { 
public: 
explicit codecvt_byname(const char*, size_t refs = 0); 
protected: 
~codecvt_byname(); // virtual 
virtual result do_out
	(stateT& state, const internT* from, const internT* from_end,
	const internT*& from_next, externT* to, externT* to_limit,
	externT*& to_next) const; 
virtual result do_in
	(stateT& state, const externT* from, const externT* from_end,
	const externT*& from_next, internT* to, internT* to_limit,
	internT*& to_next) const; 
virtual result do_unshift
	(stateT& state, externT* to, externT* to_limit, 
	externT*& to_next) const; 
virtual int do_encoding() const throw(); 
virtual bool do_always_noconv() const throw(); 
virtual int do_length
	(const stateT&, const externT* from, const externT* end, 
	size_t max) const; 
virtual result do_unshift
	(stateT& state, externT* to, externT* to_limit, 
	externT*& to_next) const; 
virtual int do_max_length() const throw(); 
};
}


22.2.2 The Numeric Category

A class for numeric formatting and manipulation for locales.


22.2.2.1 Template Class Num_get

A class for formatted numeric input.

Template Class num_get Synopsis:


namespace std {
template <class charT, class InputIterator = istreambuf_iterator<charT> >
class num_get : public locale::facet {
public:
typedef charT char_type;
typedef InputIterator iter_type;
explicit num_get(size_t refs = 0);
iter_type get(iter_type in, iter_type end, ios_base&,
	ios_base::iostate& err, bool& v) const; 
iter_type get(iter_type in, iter_type end, ios_base& ,
	ios_base::iostate& err, long& v) const; 
iter_type get(iter_type in, iter_type end, ios_base&,
	ios_base::iostate& err, unsigned short& v) const; 
iter_type get(iter_type in, iter_type end, ios_base&,
	ios_base::iostate& err, unsigned int& v) const; 
iter_type get(iter_type in, iter_type end, ios_base&,
	ios_base::iostate& err, unsigned long& v) const; 
iter_type get(iter_type in, iter_type end, ios_base&,
	ios_base::iostate& err, float& v) const; 
iter_type get(iter_type in, iter_type end, ios_base&,
	ios_base::iostate& err, double& v) const; 
iter_type get(iter_type in, iter_type end, ios_base&,
	ios_base::iostate& err, long double& v) const; 
iter_type get(iter_type in, iter_type end, ios_base&,
	ios_base::iostate& err, void*& v) const; 
static locale::id id;
protected:
~num_get(); //virtual 
virtual iter_type do_get(iter_type, iter_type, ios_base&,
	ios_base::iostate& err, bool& v) const; 
virtual iter_type do_get(iter_type, iter_type, ios_base&,
	ios_base::iostate& err, long& v) const; 
virtual iter_type do_get(iter_type, iter_type, ios_base&,
	ios_base::iostate& err, unsigned short& v) const; 
virtual iter_type do_get(iter_type, iter_type, ios_base&,
	ios_base::iostate& err, unsigned int& v) const; 
virtual iter_type do_get(iter_type, iter_type, ios_base&,
	ios_base::iostate& err, unsigned long& v) const; 
virtual iter_type do_get(iter_type, iter_type, ios_base&,
	ios_base::iostate& err, float& v) const; 
virtual iter_type do_get(iter_type, iter_type, ios_base&,
	ios_base::iostate& err, double& v) const; 
virtual iter_type do_get(iter_type, iter_type, ios_base&,
	ios_base::iostate& err, long double& v) const; 
virtual iter_type do_get(iter_type, iter_type, ios_base&,
	ios_base::iostate& err, void*& v) const; 
};
}


22.2.2.1.1 Num_get Members

The class num_get includes specific functions for parsing and formatting of numbers.


get

The function get is overloaded for un-formatted input.

Prototype:

iter_type get(iter_type in, iter_type end,
  ios_base& str,ios_base::iostate& err,
  long& val) const;
iter_type get(iter_type in, iter_type end,
  ios_base& str,ios_base::iostate& err,
  unsigned short& val) const;
iter_type get(iter_type in, iter_type end,
  ios_base& str,ios_base::iostate& err,
  unsigned int& val) const;
iter_type get(iter_type in, iter_type end,
  ios_base& str,ios_base::iostate& err,
  unsigned long& val) const;
iter_type get(iter_type in, iter_type end,
  ios_base& str,ios_base::iostate& err,
  short& val) const;
iter_type get(iter_type in, iter_type end,
  ios_base& str,ios_base::iostate& err,
  double& val) const;
iter_type get(iter_type in, iter_type end,
  ios_base& str,ios_base::iostate& err,
  long double& val) const;
iter_type get(iter_type in, iter_type end,
  ios_base& str, ios_base::iostate& err,
  void*& val) const;
Return:

returns and iterator type.


22.2.2.1.2 Num_get Virtual Functions

Prototype:

iter_type do_get(iter_type in, iter_type end,
  ios_base& str,ios_base::iostate& err,
  long& val) const;
iter_type do_get(iter_type in, iter_type end,
  ios_base& str, ios_base::iostate& err,
  unsigned short& val) const;
iter_type do_get(iter_type in, iter_type end,
  ios_base& str,ios_base::iostate& err,
  nsigned int& val) const;
iter_type do_get(iter_type in, iter_type end,
  ios_base& str,ios_base::iostate& err,
  unsigned long& val) const;
iter_type do_get(iter_type in, iter_type end,
  ios_base& str,ios_base::iostate& err,
  float& val) const;
iter_type do_get(iter_type in, iter_type end,
  ios_base& str,ios_base::iostate& err,
  double& val) const;
iter_type do_get(iter_type in, iter_type end,
  ios_base& str,ios_base::iostate& err,
  long double& val) const;
iter_type do_get(iter_type in, iter_type end,
  ios_base& str,ios_base::iostate& err,
  void*& val) const;
Prototype:
iiter_type do_get(iter_type in, iter_type end, 
ios_base& str,


ios_base::iostate& err, bool& val) const;

Implements the relative versions of get.


22.2.2.2 Template Class Num_put

A class for formatted numeric output.

Template Class num_put Synopsis:


namespace std {
template <class charT, class OutputIterator = ostreambuf_iterator<charT> >
class num_put : public locale::facet {
public:
typedef charT char_type;
typedef OutputIterator iter_type;
explicit num_put(size_t refs = 0);
iter_type put(iter_type s, ios_base& f, 
	char_type fill, bool v) const;
iter_type put(iter_type s, ios_base& f, 
	char_type fill, long v) const;
iter_type put(iter_type s, ios_base& f, 
	char_type fill, unsigned long v) const; 
iter_type put(iter_type s, ios_base& f, char_type fill,
	double v) const; 
iter_type put(iter_type s, ios_base& f, char_type fill,
	long double v) const; 
iter_type put(iter_type s, ios_base& f, char_type fill,
	const void* v) const; 
static locale::id id;
protected:
~num_put(); //virtual 
virtual iter_type do_put(iter_type, ios_base&, char_type fill,
bool v) const; 
virtual iter_type do_put
	(iter_type, ios_base&, char_type fill, long v) const; 
virtual iter_type do_put
	(iter_type, ios_base&, char_type fill, unsigned long) const; 
virtual iter_type do_put
	(iter_type, ios_base&, char_type fill, double v) const; 
virtual iter_type do_put
	(iter_type, ios_base&, char_type fill,long double v) const; 
virtual iter_type do_put
	(iter_type, ios_base&, char_type fill, const void* v) const; 
};
}


22.2.2.2.1 Num_put Members

The class num_put includes specific functions for parsing and formatting of numbers.


put

The function put is overloaded for un-formatted output.

Prototype:

iter_type put(iter_type out, ios_base& str,
  char_type fill, bool val) const;
iter_type put(iter_type out, ios_base& str,
  char_type fill, long val) const;
iter_type put(iter_type out, ios_base& str,
  char_type fill,unsigned long val) const;
iter_type put(iter_type out, ios_base& str,
  char_type fill, double val) const;
iter_type put(iter_type out, ios_base& str,
  char_type fill,long double val) const;
iter_type put(iter_type out, ios_base& str,
  char_type fill const void* val) const;

22.2.2.2.2 Num_put Virtual Functions

Implementation functions for put.

Prototype:

iter_type do_put(iter_type out, ios_base& str,
  char_type fill, bool val) const;
iter_type do_put(iter_type out, ios_base& str,
  char_type fill, long val) const;
iter_type do_put(iter_type out, ios_base& str,
  char_type fill, unsigned long val) const;
iter_type do_put(iter_type out, ios_base& str,
  char_type fill, double val) const;
iter_type do_put(iter_type out, ios_base& str,
  char_type fill,long double val) const;
iter_type do_put(iter_type out, ios_base& str,
  char_type fill, const void* val) const;

22.2.3 The Numeric Punctuation Facet

A facet for numeric punctuation in formatting and parsing.


22.2.3.1 Template Class Numpunct

A class for numeric punctuation conversion.

Template Class numpunct Synopsis:


namespace std {
template <class charT>
class numpunct : public locale::facet {
public:
typedef charT char_type;
typedef basic_string<charT> string_type;
explicit numpunct(size_t refs = 0);
char_type decimal_point() const;
char_type thousands_sep() const;
string grouping() const;
string_type truename() const;
string_type falsename() const;
static locale::id id;
protected:
~numpunct(); //virtual 
virtual char_type do_decimal_point() const;
virtual char_type do_thousands_sep() const;
virtual string do_grouping() const;
virtual string_type do_truename() const;
virtual string_type do_falsename() const;
};
}


22.2.3.1.1 Numpunct Members

The template class numpunct provides various functions for punctuation localizations.


decimal_point

Determines the character used for a decimal point.

Prototype:

char_type decimal_point() const;
Return:

Returns the character used for a decimal point.


thousands_sep

Determines the character used for a thousand separator.

Prototype:

char_type thousands_sep() const;
Return:

Returns the character used for the thousand separator.


grouping

Describes the thousand separators.

Prototype:

string grouping() const;
Return:

Returns a string describing the thousand separators.


truename

Determines the localization for "true".

Prototype:

string_type truename() const;
Return:

Returns a string describing the localization of the word "true".


falsename

Determines the localization for "false".

Prototype:

string_type falsename() const;
Return:

Returns a string describing the localization of the word "false".


22.2.3.1.2 numpunct virtual functions

Implementation of the public functions.

Prototype:

char_type do_decimal_point() const;

Implements decimal_point.

Prototype:

string_type do_thousands_sep() const;

Implements thousands_sep.

Prototype:

string do_grouping() const;

Implements grouping.

Prototype:

string_type do_truename() const;

Implements truename.

Prototype:

string_type do_falsename() const;

Implements falsename.


22.2.3.2 Template Class Numpunct_byname

Provides for specializations of class numpunct.

Class Numpunct_byname Synopsis:


namespace std {
template <class charT>
class numpunct_byname : public numpunct<charT> {
// this class is specialized for char and wchar_t.
 public:
typedef charT char_type; 
typedef basic_string<charT> string_type; 
explicit numpunct_byname(const char*, size_t refs = 0);
protected:
~numpunct_byname(); // virtual 
virtual char_type do_decimal_point() const;
virtual char_type do_thousands_sep() const;
virtual string do_grouping() const;
virtual string_type do_truename() const; // for bool 
virtual string_type do_falsename() const; // for bool 
};
}


22.2.4 The Collate Category

A class used for the comparison and manipulation of strings.


22.2.4.1 Template Class Collate


namespace std {
template <class charT>
class collate : public locale::facet {
public:
typedef charT char_type;
typedef basic_string<charT> string_type;
explicit collate(size_t refs = 0);
int compare(const charT* low1, const charT* high1,
const charT* low2, const charT* high2) const; 
string_type transform(const charT* low, const charT* high) const;
long hash(const charT* low, const charT* high) const;
static locale::id id;
protected:
~collate(); //virtual 
virtual int do_compare(const charT* low1, const charT* high1,
const charT* low2, const charT* high2) const; 
virtual string_type do_transform 
(const charT* low, const charT* high) const; 
virtual long do_hash (const charT* low, const charT* high) const; 
};
}


22.2.4.1.1 Collate Members

Member functions used for comparison and hashing of strings.


compare

Lexicographical comparison of strings.

Prototype:

int compare(const charT* low1, const charT* high1,


const charT* low2, const charT* high2) const;
Return:

A value of 1 is returned if the first is lexicographically greater than the second. A value of negative 1 is returned if the second is greater than the first. A value of zero is returned if the strings are the same.


transform

Provides a string object to be compared to other transformed strings.

Prototype:

string_type transform
  (const charT* low, const charT* high) const;
Remarks:

The transform member function is used for comparison of a series of strings.

Return:

Returns a string for comparison.


hash

Determines the hash value for the string.

Prototype:

long hash(const charT* low, const charT* high) 
const;
Return:

Returns the hash value of the string


22.2.4.1.2 Collate Virtual Functions

Localized implementation functions for public collate member functions.

Prototype:

int do_compare
  (const charT* low1, const charT* high1,
  const charT* low2, const charT* high2) const;

Implements compare.

Prototype:

string_type do_transform(const charT* low, const 
charT* high) const;

Implements transform

Prototype:

long do_hash(const charT* low, const charT* high) const;

Implements hash.


22.2.4.2 Template Class Collate_byname Synopsis


namespace std {
template <class charT>
class collate_byname : public collate<charT> {
public:
typedef basic_string<charT> string_type; 
explicit collate_byname(const char*, size_t refs = 0);
protected:
~collate_byname(); // virtual 
virtual int do_compare(const charT* low1, const charT* high1,
const charT* low2, const charT* high2) const; 
virtual string_type do_transform 
(const charT* low, const charT* high) const; 
virtual long do_hash (const charT* low, const charT* high) const; 
};
} 


22.2.5 The Time Category

Classes for localized date and time formatting and manipulation.


22.2.5.1 Template Class Time_get Synopsis


namespace std {
class time_base {
public:
enum dateorder { no_order, dmy, mdy, ymd, ydm };
};
template <class charT, class InputIterator = istreambuf_iterator<charT> >
class time_get : public locale::facet, public time_base {
public:
typedef charT char_type;
typedef InputIterator iter_type;
explicit time_get(size_t refs = 0);
dateorder date_order() const { return do_date_order(); }
iter_type get_time(iter_type s, iter_type end, ios_base& f,
ios_base::iostate& err, tm* t) const; 
iter_type get_date(iter_type s, iter_type end, ios_base& f,
ios_base::iostate& err, tm* t) const; 
iter_type get_weekday(iter_type s, iter_type end, ios_base& f,
ios_base::iostate& err, tm* t) const; 
iter_type get_monthname(iter_type s, iter_type end, ios_base& f,
ios_base::iostate& err, tm* t) const; 
iter_type get_year(iter_type s, iter_type end, ios_base& f,
ios_base::iostate& err, tm* t) const; 
static locale::id id;
protected:
~time_get(); //virtual 
virtual dateorder do_date_order() const;
virtual iter_type do_get_time(iter_type s, iter_type end, ios_base&,
ios_base::iostate& err, tm* t) const; 
virtual iter_type do_get_date(iter_type s, iter_type end, ios_base&,
ios_base::iostate& err, tm* t) const; 
virtual iter_type do_get_weekday(iter_type s, iter_type end, ios_base&,
ios_base::iostate& err, tm* t) const; 
virtual iter_type do_get_monthname(iter_type s, ios_base&,
ios_base::iostate& err, tm* t) const; 
virtual iter_type do_get_year(iter_type s, iter_type end, ios_base&,
ios_base::iostate& err, tm* t) const; 
};
}


22.2.5.1.1 Time_get Members

Member functions of time_get.


date_order

Determines how the date, month and year are ordered.

Prototype:

dateorder date_order() const;
Return:

Returns an enumeration representing the date, month, year order. Returns zero if it is un-ordered.


get_time

Determines the localized time.

Prototype:

iter_type get_time
  (iter_type s, iter_type end, ios_base& str,
   ios_base::iostate& err, tm* t) const;
Return:

Returns an iterator immediately beyond the last character recognized as a valid time.


get_date

Determines the localized date.

Prototype:

iter_type get_date
  (iter_type s, iter_type end,ios_base& str,
  ios_base::iostate& err, tm* t) const;
Return:

Returns an iterator immediately beyond the last character recognized as a valid date.


get_weekday

Determines the localized weekday.

Prototype:

iter_type get_weekday
  (iter_type s, iter_type end, ios_base& str,
  ios_base::iostate& err, tm* t) const;
Return:

Returns an iterator immediately beyond the last character recognized as a valid weekday.


get_monthname

Determines the localized month name.

Prototype:

iter_type get_monthname
  (iter_type s, iter_type end, ios_base& str,
  ios_base::iostate& err, tm* t) const;
Return:

Returns an iterator immediately beyond the last character recognized as a valid month name.


get_year

Determines the year

Prototype:

iter_type get_year(iter_type s, iter_type end,
  ios_base& str, ios_base::iostate& err,
  tm* t) const;
Return:

Returns an iterator immediately beyond the last character recognized as a valid year.


22.2.5.1.2 Time_get Virtual Functions

Localized functions for implementation of the public functions.

Prototype:

dateorder do_date_order() const;

Implements date_order.

Prototype:

iter_type do_get_time(iter_type s, iter_type end,
  ios_base& str, ios_base::iostate& err,
  tm* t) const;

Implements get_time.

Prototype:

iter_type do_get_date
  (iter_type s, iter_type end, ios_base& str,
  ios_base::iostate& err, tm* t) const;

Implements get_date.

Prototype:

iter_type do_get_weekday
  (iter_type s, iter_type end, ios_base& str,
  ios_base::iostate& err, tm* t) const;

Implements get_weekday.

Prototype:

iter_type do_get_monthname
  (iter_type s, iter_type end, ios_base& str,
  ios_base::iostate& err, tm* t) const;

Implements get_monthname.

Prototype:

iter_type do_get_year
  (iter_type s, iter_type end, ios_base& str,
  ios_base::iostate& err, tm* t) const;

Implements get_year.


22.2.5.2 Template Class Time_get_byname

Template class Time_get_byname Synopsis:


Template class time_get_byname
namespace std {
template <class charT, class InputIterator = istreambuf_iterator<charT> >
class time_get_byname : public time_get<charT, InputIterator> {
public:
typedef time_base::dateorder dateorder; 
typedef InputIterator iter_type 
explicit time_get_byname(const char*, size_t refs = 0);
protected:
~time_get_byname(); // virtual 
virtual dateorder do_date_order() const;
virtual iter_type do_get_time(iter_type s, iter_type end, ios_base&,
ios_base::iostate& err, tm* t) const; 
virtual iter_type do_get_date(iter_type s, iter_type end, ios_base&,
ios_base::iostate& err, tm* t) const; 
virtual iter_type do_get_weekday(iter_type s, iter_type end, ios_base&,
ios_base::iostate& err, tm* t) const; 
virtual iter_type do_get_monthname(iter_type s, iter_type end, ios_base&,
ios_base::iostate& err, tm* t) const; 
virtual iter_type do_get_year(iter_type s, iter_type end, ios_base&,
ios_base::iostate& err, tm* t) const; 
};
}


22.2.5.3 Template Class Time_put Synopsis


namespace std {
template <class charT, class OutputIterator = ostreambuf_iterator<charT> >
class time_put : public locale::facet {
public:
typedef charT char_type;
typedef OutputIterator iter_type;
explicit time_put(size_t refs = 0);
// the following is implemented in terms of other member functions. 
iter_type put(iter_type s, ios_base& f, char_type fill, const tm* tmb,
const charT* pattern, const charT* pat_end) const; 
iter_type put(iter_type s, ios_base& f, char_type fill,
const tm* tmb, char format, char modifier = 0) const; 
static locale::id id;
protected:
~time_put(); //virtual 
virtual iter_type do_put(iter_type s, ios_base&, char_type, const tm* t,
char format, char modifier) const; 
};
}


22.2.5.3.1 Time_put Members

Functions used for formatting time.


put

Formats a localized time.

Prototype:

iter_type put(iter_type s, ios_base& str, 
  char_type fill, const tm* t, const charT* pattern, const charT* pat_end) const;
iter_type put(iter_type s, ios_base& str, 
  char_type fill, const tm* t, char format,
  char modifier = 0) const;
Return:

Returns an iterator immediately beyond the last character.


22.2.5.3.2 Time_put Virtual Functions

Implements localized time functions.

Prototype:

iter_type do_put(iter_type s, ios_base&, 
  char_type fill, const tm* t, char format,
  char modifier) const;

Implements the public member function put.


22.2.5.4 Template Class Time_put_byname Synopsis


namespace std {
template <class charT, class OutputIterator = ostreambuf_iterator<charT> >
class time_put_byname : public time_put<charT, OutputIterator>
{
public:
typedef charT char_type; 
typedef OutputIterator iter_type; 
explicit time_put_byname(const char*, size_t refs = 0);
protected:
~time_put_byname(); // virtual 
virtual iter_type do_put(iter_type s, ios_base&, char_type, const tm* t,
char format, char modifier) const; 
};
}


22.2.6 The Monetary Category

The monetary category is used for localization of monetary formats.


22.2.6.1 Template Class Money_get Synopsis


namespace std {
template <class charT,
class InputIterator = istreambuf_iterator<charT> > 
class money_get : public locale::facet {
public:
typedef charT char_type;
typedef InputIterator iter_type;
typedef basic_string<charT> string_type;
explicit money_get(size_t refs = 0);
iter_type get(iter_type s, iter_type end, bool intl,
ios_base& f, ios_base::iostate& err, 
long double& units) const; 
iter_type get(iter_type s, iter_type end, bool intl,
ios_base& f, ios_base::iostate& err, 
string_type& digits) const; 
static locale::id id;
protected:
~money_get(); //virtual 
virtual iter_type do_get(iter_type, iter_type, bool, ios_base&,
ios_base::iostate& err, long double& units) const; 
virtual iter_type do_get(iter_type, iter_type, bool, ios_base&,
ios_base::iostate& err, string_type& digits) const; 
};
}


22.2.6.1.1 Money_get Members

Localized member functions for inputting monetary values.


get

Inputs a localized monetary value.

Prototype:

iter_type get(iter_type s, iter_type end, 
  bool intl, ios_base& f, ios_base::iostate& err,
  long double& quant) const;
iter_type get( s, iter_type end, bool intl,
  ios_base& f, ios_base::iostate& err,
   string_type& quant) const;
Return:

Returns an iterator immediately beyond the last character recognized as a valid monetary quantity.


22.2.6.1.2 Money_get Virtual Functions

Implementation functions for localization of the money_get public member functions.

Prototype:

iter_type do_get(iter_type s, iter_type end, 
  bool intl, ios_base& str, ios_base::iostate& err,
  long double& units) const;
iter_type do_get(iter_type s, iter_type end, 
  bool intl, ios_base& str, ios_base::iostate& err
  string_type& digits) const;

Implements a localized monetary get function.


22.2.6.2 Template Class Money_put Synopsis


namespace std {
template <class charT,
class OutputIterator = ostreambuf_iterator<charT> > 
class money_put : public locale::facet {
public:
typedef charT char_type;
typedef OutputIterator iter_type;
typedef basic_string<charT> string_type;
explicit money_put(size_t refs = 0);
iter_type put(iter_type s, bool intl, ios_base& f,
char_type fill, long double units) const; 
iter_type put(iter_type s, bool intl, ios_base& f,
char_type fill, const string_type& digits) const; 
static locale::id id;
protected:
~money_put(); //virtual 
virtual iter_type
do_put(iter_type, bool, ios_base&, char_type fill,
long double units) const; 
virtual iter_type
do_put(iter_type, bool, ios_base&, char_type fill,
const string_type& digits) const; 
};
}


22.2.6.2.1 Money_put Members

Localized member functions for outputting monetary values.


put

Outputs a localized monetary value.

Prototype:

iter_type put(iter_type s, bool intl, ios_base& f,
  char_type fill, long double quant) const;
iter_type put(iter_type s, bool intl, ios_base& f,
  char_type fill, const string_type& quant) const;
Return:

Returns an iterator immediately beyond the last character recognized as a valid monetary quantity.


22.2.6.2.2 Money_put Virtual Functions

Implementation functions for localization of the money_put public member functions.

Prototype:

iter_type do_put(iter_type s, bool intl, 
  ios_base& str, char_type fill,
  long double units) const;
iter_type do_put(iter_type s, bool intl, 
  ios_base& str, char_type fill,
  const string_type& digits) const;

Implements a localized put function.


Class Moneypunct

An object used for localization of monetary punctuation.


22.2.6.3 Template Class Moneypunct Synopsis


namespace std {
class money_base {
public:
enum part { none, space, symbol, sign, value };
struct pattern { char field[4]; };
};
template <class charT, bool International = false>
class moneypunct : public locale::facet, public money_base {
public:
typedef charT char_type;
typedef basic_string<charT> string_type;
explicit moneypunct(size_t refs = 0);
charT decimal_point() const;
charT thousands_sep() const;
string grouping() const;
string_type curr_symbol() const;
string_type positive_sign() const;
string_type negative_sign() const;
int frac_digits() const;
pattern pos_format() const;
pattern neg_format() const;
static locale::id id;
static const bool intl = International;
protected:
~moneypunct(); //virtual 
virtual charT do_decimal_point() const;
virtual charT do_thousands_sep() const;
virtual string do_grouping() const;
virtual string_type do_curr_symbol() const;
virtual string_type do_positive_sign() const;
virtual string_type do_negative_sign() const;
virtual int do_frac_digits() const;
virtual pattern do_pos_format() const;
virtual pattern do_neg_format() const;
};
}


22.2.6.3.1 Moneypunct Members

Member functions to determine the punctuation used for monetary formatting.


decimal_point

Determines what character to use as a decimal point.

Prototype:

charT decimal_point() const;
Return:

Returns a char to be used as a decimal point.


thousands_sep

Determines which character to use for a thousandths separator.

Prototype:

charT thousands_sep() const;
Return:

Returns the character to use for a thousandths separator.


grouping

Determines a string that determines the grouping of thousands.

Prototype:

string grouping() const;
Return:

Returns the string that determines the grouping of thousands.


curr_symbol

Determines a string of the localized currency symbol.

Prototype:

string_type curr_symbol() const;
Return:

Returns the string of the localized currency symbol.


positive_sign

Determines a string of the localized positive sign.

Prototype:

string_type positive_sign() const;
Return:

Returns the string of the localized positive sign.


negative_sign

Determines a string of the localized negative sign.

Prototype:

string_type negative_sign() const;
Return:

Returns the string of the localized negative sign.


frac_digits

Determines a string of the localized fractional digits.

Prototype:

int frac_digits() const;
Return:

Returns the string of the localized fractional digits.


pos_format

Determines the format of the localized non-negative values.

Prototype:

pattern pos_format() const;
Return:

Returns the format of the localized non-negative values.


neg_format

Determines the format of the localized non-negative values.

Prototype:

pattern neg_format() const;
Return:

Returns he format of the localized non-negative values.


22.2.6.3.2 Moneypunct Virtual Functions

Virtual functions that implement the localized public member functions.

Prototype:

charT do_decimal_point() const;

Implements decimal_point.

Prototype:

charT do_thousands_sep() const;

Implements thousands_sep.

Prototype:

string do_grouping() const;

Implements grouping.

Prototype:

string_type do_curr_symbol() const;

Implements cur_symbol.

Prototype:

string_type do_positive_sign() const;

Implements positive_sign.

Prototype:

string_type do_negative_sign() const;


do_negative_sign() 

Implements negative_sign.

Prototype:

int do_frac_digits() const;

Implements frac_digits.

Prototype:

pattern do_pos_format() const;

Implements pos_format.

Prototype:

pattern do_neg_format() const;

Implements neg_format.


Class Moneypunct_byname


22.2.6.4 Template Class Moneypunct_byname Synopsis


namespace std {
template <class charT, bool Intl = false>
class moneypunct_byname : public moneypunct<charT, Intl> {
public:
typedef money_base::pattern pattern; 
typedef basic_string<charT> string_type; 
explicit moneypunct_byname(const char*, size_t refs = 0);
protected:
~moneypunct_byname(); // virtual 
virtual charT do_decimal_point() const;
virtual charT do_thousands_sep() const;
virtual string do_grouping() const;
virtual string_type do_curr_symbol() const;
virtual string_type do_positive_sign() const;
virtual string_type do_negative_sign() const;
virtual int do_frac_digits() const;
virtual pattern do_pos_format() const;
virtual pattern do_neg_format() const;
};
}


22.2.7 The Message Retrieval Category

Implements the retrieval of strings from message catalogs.


22.2.7.1 Template Class Messages Synopsis


namespace std {
class messages_base {
public:
typedef int catalog;
};
template <class charT>
class messages : public locale::facet, public messages_base {
public:
typedef charT char_type;
typedef basic_string<charT> string_type;
explicit messages(size_t refs = 0);
catalog open(const basic_string<char>& fn, const locale&) const;
string_type get(catalog c, int set, int msgid,
const string_type& dfault) const; 
void close(catalog c) const;
static locale::id id;
protected:
~messages(); //virtual 
virtual catalog do_open(const basic_string<char>&, const locale&) const;
virtual string_type do_get(catalog, int set, int msgid,
const string_type& dfault) const; 
virtual void do_close(catalog) const;
};
}


22.2.7.1.1 Messages Members

Public member functions for catalog message retrieval.


open

Opens a message catalog for reading

Prototype:

catalog open(const basic_string<char>& name, 
  const locale& loc) const;
Return:

Returns a value that may be passed to get to retrieve a message from a message catalog.


get

Retrieves a message from a message catalog.

Prototype:

string_type get(catalog cat, int set, int msgid,
  const string_type& dfault) const;
Return:

Returns the message in the form of a string.


close

Closes a message catalog.

Prototype:

void close(catalog cat) const;

22.2.7.1.2 Messages Virtual Functions

Virtual functions used to localize the public member functions.

Prototype:

catalog do_open(const basic_string<char>& name,
  const locale& loc) const;

Implements open.

Prototype:

string_type do_get(catalog cat, int set, int 
msgid,
  const string_type& dfault) const;

Implements get.

Prototype:

void do_close(catalog cat) const;

Implements close.


22.2.7.2 Template Class Messages_byname Synopsis


namespace std {
template <class charT>
class messages_byname : public messages<charT> {
public:
typedef messages_base::catalog catalog; 
typedef basic_string<charT> string_type; 
explicit messages_byname(const char*, size_t refs = 0);
protected:
~messages_byname(); // virtual 
virtual catalog do_open(const basic_string<char>&, const locale&) const;
virtual string_type do_get(catalog, int set, int msgid,
const string_type& dfault) const; 
virtual void do_close(catalog) const;
};
}


22.2.8 Program-defined Facets

A C++ program may add its own locales to be added to and used the same as the built in facets. To do this derive a class from locale::facet with the static member static locael::id.id.


22.3 C Library Locales

The C++ header <clocale> are the same as the C header locale but in standard namespace.

Header <clocale> Synopsis:

 

Type
Name(s)
Name(s)
Macro  
LC_ALL  
LC_COLLATE  
Macro  
LC_CTYPE  
LC_MONETARY  
Macro  
LC_NUMERIC  
LC_TIME  
Macro  
NULL  
 
Struct  
lconv  
 
Function  
localeconv  
setlocale  

 


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: July 21, 2000