moneypunct::neg_format


public member function
pattern neg_format() const;

Return format of negative monetary expressions

Returns the pattern that specifies the format for negative monetary expressions.

The pattern is expressed as an object of member type moneypunct::pattern, which contains an array of four char elements.

During its operation, the version of this function in the generic template simply calls the virtual protected member do_neg_format, which is the member function in charge of performing the actions described above.

Parameters

none

Return value

An object of type moneypunct::pattern which contains an array of four fields.

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// moneypunct example
#include <iostream>
#include <locale>
using namespace std;

// overload inserter to print patterns:
ostream& operator<< (ostream& os, moneypunct<char>::pattern p)
{
  for (int i=0; i<4; i++)
    switch (p.field[i]) {
      case moneypunct<char>::space: cout << "space "; break;
      case moneypunct<char>::symbol: cout << "symbol "; break;
      case moneypunct<char>::sign: cout << "sign "; break;
      case moneypunct<char>::value: cout << "value "; break;
    }
  return os;
}

int main ()
{
  locale mylocale;
  const moneypunct<char>& mp = use_facet<moneypunct<char> >(mylocale);

  cout << "moneypunct in locale \"" << mylocale.name() << "\":\n";

  cout << "decimal_point: " << mp.decimal_point() << endl;
  cout << "thousands_sep: " << mp.thousands_sep() << endl;
  cout << "grouping: " << mp.grouping() << endl;
  cout << "curr_symbol: " << mp.curr_symbol() << endl;
  cout << "positive_sign: " << mp.positive_sign() << endl;
  cout << "negative_sign: " << mp.negative_sign() << endl;
  cout << "frac_digits: " << mp.frac_digits() << endl;
  cout << "pos_format: " << mp.pos_format() << endl;
  cout << "neg_format: " << mp.neg_format() << endl;
  
  return 0;
} 


Possible output:

moneypunct in locale "C":
decimal_point:
thousands_sep:
grouping:
curr_symbol:
positive_sign:
negative_sign: -
frac_digits: 0
pos_format: symbol sign value
neg_format: symbol sign value


See also