Previous fileTop of DocumentContentsIndex pageNext file
Apache C++ Standard Library Reference Guide

moneypunct, moneypunct_byname

Library:  Localization


locale::facet moneypunct_byname moneypunct money_base

Local Index

Members

Summary

Monetary punctuation facets

Synopsis

#include <locale>

namespace std {
  class money_base;
  template <class charT, bool International = false>
  class moneypunct;
  template <class charT, bool International = false>
  class moneypunct_byname;
}

Specializations

Description

The moneypunct facets include formatting specifications and punctuation character for monetary values. The moneypunct facet is used with the C locale, while the moneypunct_byname facet is used with named locales.

The facet is used by money_put for outputting formatted representations of monetary values and by money_get for reading these strings back in.

money_base defines a structure, pattern, that specifies the order of syntactic elements in a monetary value and enumeration values representing those elements. The pattern struct includes a simple array of characters, field. Each index in field is taken up by an enumeration value indicating the location of a syntactic element. The enumeration values are described below:

Table 28: Enumeration values of field indexes in the money_base pattern struct

Format Flag Value Meaning

none

0

No grouping separator.

space

1

Use space for grouping separator.

symbol

2

Currency symbol.

sign

3

Sign of monetary value.

value

4

The monetary value itself.

The do_pos_format() and do_neg_format() member functions of moneypunct both return values of the pattern type. See the description of these functions for further elaboration.

Interface

Member Types

char_type
string_type

Constructors

explicit moneypunct(size_t refs = 0) 
explicit moneypunct_byname(const char* name, 
                             size_t refs = 0); 

Static Members

static locale::id id;
static const bool intl = Intl; 

Public Member Functions

The public members of the moneypunct and moneypunct_byname facets include an interface to protected members. Each public member function xxx() calls the corresponding protected virtual protected member function do_xxx(). For instance, the public member function decimal_point() function calls its protected cousin do_decimal_point().

string_type  curr_symbol()   const; 
charT        decimal_point() const; 
int          frac_digits()   const; 
string       grouping()      const; 
pattern      neg_format()    const; 
string_type  negative_sign() const; 
pattern      pos_format()    const; 
string_type  positive_sign() const; 
charT        thousands_sep() const; 

Protected Member Functions

virtual string_type 
do_curr_symbol() const; 
virtual charT
do_decimal_point() const; 
virtual int
do_frac_digits() const; 
virtual string
do_grouping() const; 
virtual string_type 
do_negative_sign() const; 
virtual pattern 
do_neg_format() const; 
virtual pattern 
do_pos_format() const; 
virtual string_type 
do_positive_sign() const; 
virtual charT
do_thousands_sep() const; 

Example

See Also

locale, Facets, money_put, money_get

Standards Conformance

ISO/IEC 14882:1998 -- International Standard for Information Systems -- Programming Language C++, Section 22.2.6.3



Previous fileTop of DocumentContentsIndex pageNext file