Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
5134 serge 1
// std::moneypunct implementation details, generic version -*- C++ -*-
2
 
3
// Copyright (C) 2001-2013 Free Software Foundation, Inc.
4
//
5
// This file is part of the GNU ISO C++ Library.  This library is free
6
// software; you can redistribute it and/or modify it under the
7
// terms of the GNU General Public License as published by the
8
// Free Software Foundation; either version 3, or (at your option)
9
// any later version.
10
 
11
// This library is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
// GNU General Public License for more details.
15
 
16
// Under Section 7 of GPL version 3, you are granted additional
17
// permissions described in the GCC Runtime Library Exception, version
18
// 3.1, as published by the Free Software Foundation.
19
 
20
// You should have received a copy of the GNU General Public License and
21
// a copy of the GCC Runtime Library Exception along with this program;
22
// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
23
// .
24
 
25
//
26
// ISO C++ 14882: 22.2.6.3.2  moneypunct virtual functions
27
//
28
 
29
// Written by Benjamin Kosnik 
30
 
31
#include 
32
 
33
namespace std _GLIBCXX_VISIBILITY(default)
34
{
35
_GLIBCXX_BEGIN_NAMESPACE_VERSION
36
 
37
  // Construct and return valid pattern consisting of some combination of:
38
  // space none symbol sign value
39
  money_base::pattern
40
  money_base::_S_construct_pattern(char, char, char) throw()
41
  { return _S_default_pattern; }
42
 
43
  template<>
44
    void
45
    moneypunct::_M_initialize_moneypunct(__c_locale, const char*)
46
    {
47
      // "C" locale.
48
      if (!_M_data)
49
	_M_data = new __moneypunct_cache;
50
 
51
      _M_data->_M_decimal_point = '.';
52
      _M_data->_M_thousands_sep = ',';
53
      _M_data->_M_grouping = "";
54
      _M_data->_M_grouping_size = 0;
55
      _M_data->_M_curr_symbol = "";
56
      _M_data->_M_curr_symbol_size = 0;
57
      _M_data->_M_positive_sign = "";
58
      _M_data->_M_positive_sign_size = 0;
59
      _M_data->_M_negative_sign = "";
60
      _M_data->_M_negative_sign_size = 0;
61
      _M_data->_M_frac_digits = 0;
62
      _M_data->_M_pos_format = money_base::_S_default_pattern;
63
      _M_data->_M_neg_format = money_base::_S_default_pattern;
64
 
65
      for (size_t __i = 0; __i < money_base::_S_end; ++__i)
66
	_M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
67
    }
68
 
69
  template<>
70
    void
71
    moneypunct::_M_initialize_moneypunct(__c_locale, const char*)
72
    {
73
      // "C" locale.
74
      if (!_M_data)
75
	_M_data = new __moneypunct_cache;
76
 
77
      _M_data->_M_decimal_point = '.';
78
      _M_data->_M_thousands_sep = ',';
79
      _M_data->_M_grouping = "";
80
      _M_data->_M_grouping_size = 0;
81
      _M_data->_M_curr_symbol = "";
82
      _M_data->_M_curr_symbol_size = 0;
83
      _M_data->_M_positive_sign = "";
84
      _M_data->_M_positive_sign_size = 0;
85
      _M_data->_M_negative_sign = "";
86
      _M_data->_M_negative_sign_size = 0;
87
      _M_data->_M_frac_digits = 0;
88
      _M_data->_M_pos_format = money_base::_S_default_pattern;
89
      _M_data->_M_neg_format = money_base::_S_default_pattern;
90
 
91
      for (size_t __i = 0; __i < money_base::_S_end; ++__i)
92
	_M_data->_M_atoms[__i] = money_base::_S_atoms[__i];
93
    }
94
 
95
  template<>
96
    moneypunct::~moneypunct()
97
    { delete _M_data; }
98
 
99
  template<>
100
    moneypunct::~moneypunct()
101
    { delete _M_data; }
102
 
103
#ifdef _GLIBCXX_USE_WCHAR_T
104
  template<>
105
    void
106
    moneypunct::_M_initialize_moneypunct(__c_locale,
107
							const char*)
108
    {
109
      // "C" locale
110
      if (!_M_data)
111
	_M_data = new __moneypunct_cache;
112
 
113
      _M_data->_M_decimal_point = L'.';
114
      _M_data->_M_thousands_sep = L',';
115
      _M_data->_M_grouping = "";
116
      _M_data->_M_grouping_size = 0;
117
      _M_data->_M_curr_symbol = L"";
118
      _M_data->_M_curr_symbol_size = 0;
119
      _M_data->_M_positive_sign = L"";
120
      _M_data->_M_positive_sign_size = 0;
121
      _M_data->_M_negative_sign = L"";
122
      _M_data->_M_negative_sign_size = 0;
123
      _M_data->_M_frac_digits = 0;
124
      _M_data->_M_pos_format = money_base::_S_default_pattern;
125
      _M_data->_M_neg_format = money_base::_S_default_pattern;
126
 
127
      for (size_t __i = 0; __i < money_base::_S_end; ++__i)
128
	_M_data->_M_atoms[__i] =
129
	  static_cast(money_base::_S_atoms[__i]);
130
    }
131
 
132
  template<>
133
    void
134
    moneypunct::_M_initialize_moneypunct(__c_locale,
135
							 const char*)
136
    {
137
      // "C" locale
138
      if (!_M_data)
139
	_M_data = new __moneypunct_cache;
140
 
141
      _M_data->_M_decimal_point = L'.';
142
      _M_data->_M_thousands_sep = L',';
143
      _M_data->_M_grouping = "";
144
      _M_data->_M_grouping_size = 0;
145
      _M_data->_M_curr_symbol = L"";
146
      _M_data->_M_curr_symbol_size = 0;
147
      _M_data->_M_positive_sign = L"";
148
      _M_data->_M_positive_sign_size = 0;
149
      _M_data->_M_negative_sign = L"";
150
      _M_data->_M_negative_sign_size = 0;
151
      _M_data->_M_frac_digits = 0;
152
      _M_data->_M_pos_format = money_base::_S_default_pattern;
153
      _M_data->_M_neg_format = money_base::_S_default_pattern;
154
 
155
      for (size_t __i = 0; __i < money_base::_S_end; ++__i)
156
	_M_data->_M_atoms[__i] =
157
	  static_cast(money_base::_S_atoms[__i]);
158
    }
159
 
160
  template<>
161
    moneypunct::~moneypunct()
162
    { delete _M_data; }
163
 
164
  template<>
165
    moneypunct::~moneypunct()
166
    { delete _M_data; }
167
#endif
168
 
169
_GLIBCXX_END_NAMESPACE_VERSION
170
} // namespace