STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
_Mpunct< _Elem > Class Template Reference
Inheritance diagram for _Mpunct< _Elem >:
money_base locale::facet _Facet_base _Crt_new_delete moneypunct< _Elem, _Intl > moneypunct_byname< _Elem, _Intl >

Public Types

typedef _Elem char_type
 
typedef basic_string< _Elem, char_traits< _Elem >, allocator< _Elem > > string_type
 
- Public Types inherited from money_base
enum  {
  symbol = '$', sign = '+', space = ' ', value = 'v',
  none = 'x'
}
 
typedef int part
 

Public Member Functions

_Elem decimal_point () const
 
_Elem 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
 
 _Mpunct (size_t _Refs, bool _Intl)
 
 _Mpunct (const _Locinfo &_Lobj, size_t _Refs, bool _Intl, bool _Isdef=false)
 
- Public Member Functions inherited from money_base
 money_base (size_t _Refs=0)
 
- Public Member Functions inherited from locale::facet
virtual void __CLR_OR_THIS_CALL _Incref ()
 
virtual _Facet_base *__CLR_OR_THIS_CALL _Decref ()
 
__CLR_OR_THIS_CALL facet (const facet &)=delete
 
facet &__CLR_OR_THIS_CALL operator= (const facet &)=delete
 
- Public Member Functions inherited from _Facet_base
virtual __CLR_OR_THIS_CALL ~_Facet_base () _NOEXCEPT
 

Protected Member Functions

 _Mpunct (const char *_Locname, size_t _Refs, bool _Intl, bool _Isdef=false)
 
virtual __CLR_OR_THIS_CALL ~_Mpunct () _NOEXCEPT
 
template<class _Elem2 >
void _Getvals (_Elem2, const lconv *_Ptr)
 
template<>
void _Getvals (wchar_t, const lconv *_Ptr)
 
void _Init (const _Locinfo &_Lobj, bool _Isdef=false)
 
virtual _Elem __CLR_OR_THIS_CALL do_decimal_point () const
 
virtual _Elem __CLR_OR_THIS_CALL do_thousands_sep () const
 
virtual string __CLR_OR_THIS_CALL do_grouping () const
 
virtual string_type __CLR_OR_THIS_CALL do_curr_symbol () const
 
virtual string_type __CLR_OR_THIS_CALL do_positive_sign () const
 
virtual string_type __CLR_OR_THIS_CALL do_negative_sign () const
 
virtual int __CLR_OR_THIS_CALL do_frac_digits () const
 
virtual pattern __CLR_OR_THIS_CALL do_pos_format () const
 
virtual pattern __CLR_OR_THIS_CALL do_neg_format () const
 
- Protected Member Functions inherited from locale::facet
__CLR_OR_THIS_CALL facet (size_t _Initrefs=0)
 
virtual __CLR_OR_THIS_CALL ~facet () _NOEXCEPT
 

Private Member Functions

void _Makpat (pattern &_Pattern, unsigned int _Sepbyspace, unsigned int _Symbolprecedes, unsigned int _Signposition)
 
void _Tidy ()
 

Private Attributes

const char_Grouping
 
_Elem _Decimalpoint
 
_Elem _Kseparator
 
const _Elem * _Currencysign
 
const _Elem * _Plussign
 
const _Elem * _Minussign
 
int _Fracdigits
 
pattern _Plusformat
 
pattern _Minusformat
 
bool _International
 
_Locinfo::_Cvtvec _Cvt
 

Additional Inherited Members

- Static Public Member Functions inherited from locale::facet
static size_t __CLRCALL_OR_CDECL _Getcat (const facet **=0, const locale *=0)
 

Member Typedef Documentation

template<class _Elem >
typedef _Elem _Mpunct< _Elem >::char_type
template<class _Elem >
typedef basic_string<_Elem, char_traits<_Elem>, allocator<_Elem> > _Mpunct< _Elem >::string_type

Constructor & Destructor Documentation

template<class _Elem >
_Mpunct< _Elem >::_Mpunct ( size_t  _Refs,
bool  _Intl 
)
inlineexplicit
93  : money_base(_Refs), _International(_Intl)
94  { // construct from current locale
95  _BEGIN_LOCINFO(_Lobj)
96  _Init(_Lobj);
97  _END_LOCINFO()
98  }
money_base(size_t _Refs=0)
Definition: xlocmon:31
void _Init(const _Locinfo &_Lobj, bool _Isdef=false)
Definition: xlocmon:150
bool _International
Definition: xlocmon:268
template<class _Elem >
_Mpunct< _Elem >::_Mpunct ( const _Locinfo _Lobj,
size_t  _Refs,
bool  _Intl,
bool  _Isdef = false 
)
inline
102  : money_base(_Refs), _International(_Intl)
103  { // construct from specified locale
104  _Init(_Lobj, _Isdef);
105  }
money_base(size_t _Refs=0)
Definition: xlocmon:31
void _Init(const _Locinfo &_Lobj, bool _Isdef=false)
Definition: xlocmon:150
bool _International
Definition: xlocmon:268
template<class _Elem >
_Mpunct< _Elem >::_Mpunct ( const char _Locname,
size_t  _Refs,
bool  _Intl,
bool  _Isdef = false 
)
inlineprotected
110  : money_base(_Refs), _International(_Intl)
111  { // construct from specified locale
112  _BEGIN_LOCINFO(_Lobj(_Locname))
113  _Init(_Lobj, _Isdef);
114  _END_LOCINFO()
115  }
money_base(size_t _Refs=0)
Definition: xlocmon:31
void _Init(const _Locinfo &_Lobj, bool _Isdef=false)
Definition: xlocmon:150
bool _International
Definition: xlocmon:268
template<class _Elem >
virtual __CLR_OR_THIS_CALL _Mpunct< _Elem >::~_Mpunct ( )
inlineprotectedvirtual
118  { // destroy the object
119  _Tidy();
120  }
void _Tidy()
Definition: xlocmon:251

Member Function Documentation

template<class _Elem >
template<class _Elem2 >
void _Mpunct< _Elem >::_Getvals ( _Elem2  ,
const lconv _Ptr 
)
inlineprotected
124  { // get values
126  ? _Ptr->int_curr_symbol : _Ptr->currency_symbol, _Cvt);
127  _Plussign = _MAKLOCSTR(_Elem2, 4 < (unsigned int)_Ptr->p_sign_posn
128  ? "" : _Ptr->positive_sign, _Cvt);
129  _Minussign = _MAKLOCSTR(_Elem2, 4 < (unsigned int)_Ptr->n_sign_posn
130  ? "-" : _Ptr->negative_sign, _Cvt);
131  _Decimalpoint = _MAKLOCCHR(_Elem2, _Ptr->mon_decimal_point[0], _Cvt);
132  _Kseparator = _MAKLOCCHR(_Elem2, _Ptr->mon_thousands_sep[0], _Cvt);
133  }
char * mon_thousands_sep
Definition: locale.h:37
char * mon_decimal_point
Definition: locale.h:36
const _Elem * _Currencysign
Definition: xlocmon:262
char p_sign_posn
Definition: locale.h:47
char * negative_sign
Definition: locale.h:40
const _Elem * _Plussign
Definition: xlocmon:263
const _Elem * _Minussign
Definition: xlocmon:264
char n_sign_posn
Definition: locale.h:48
char * positive_sign
Definition: locale.h:39
bool _International
Definition: xlocmon:268
char * currency_symbol
Definition: locale.h:35
_Elem _Decimalpoint
Definition: xlocmon:260
char * int_curr_symbol
Definition: locale.h:34
#define _MAKLOCCHR(Elem, chr, cvt)
Definition: xlocale:626
_Locinfo::_Cvtvec _Cvt
Definition: xlocmon:270
#define _MAKLOCSTR(Elem, str, cvt)
Definition: xlocale:659
_Elem _Kseparator
Definition: xlocmon:261
template<class _Elem >
template<>
void _Mpunct< _Elem >::_Getvals ( wchar_t  ,
const lconv _Ptr 
)
inlineprotected
137  { // get values
138  _Currencysign = (const _Elem *)_Maklocwcs(_International
139  ? _Ptr->_W_int_curr_symbol : _Ptr->_W_currency_symbol);
140  _Plussign = (const _Elem *)_Maklocwcs(
141  4 < (unsigned int)_Ptr->p_sign_posn
142  ? L"" : _Ptr->_W_positive_sign);
143  _Minussign = (const _Elem *)_Maklocwcs(
144  4 < (unsigned int)_Ptr->n_sign_posn
145  ? L"-" : _Ptr->_W_negative_sign);
146  _Decimalpoint = (_Elem)_Ptr->_W_mon_decimal_point[0];
147  _Kseparator = (_Elem)_Ptr->_W_mon_thousands_sep[0];
148  }
wchar_t * _W_currency_symbol
Definition: locale.h:52
const _Elem * _Currencysign
Definition: xlocmon:262
char p_sign_posn
Definition: locale.h:47
wchar_t * _Maklocwcs(const wchar_t *_Ptr)
Definition: xlocnum:96
const _Elem * _Plussign
Definition: xlocmon:263
wchar_t * _W_positive_sign
Definition: locale.h:55
const _Elem * _Minussign
Definition: xlocmon:264
char n_sign_posn
Definition: locale.h:48
bool _International
Definition: xlocmon:268
_Elem _Decimalpoint
Definition: xlocmon:260
wchar_t * _W_mon_thousands_sep
Definition: locale.h:54
wchar_t * _W_negative_sign
Definition: locale.h:56
wchar_t * _W_int_curr_symbol
Definition: locale.h:51
wchar_t * _W_mon_decimal_point
Definition: locale.h:53
_Elem _Kseparator
Definition: xlocmon:261
template<class _Elem >
void _Mpunct< _Elem >::_Init ( const _Locinfo _Lobj,
bool  _Isdef = false 
)
inlineprotected
151  { // initialize from _Lobj
152  _Cvt = _Lobj._Getcvt();
153  const lconv *_Ptr = _Lobj._Getlconv();
154 
155  _Grouping = 0;
156  _Currencysign = 0;
157  _Plussign = 0;
158  _Minussign = 0;
159 
160  _TRY_BEGIN
161  _Grouping = _MAKLOCSTR(char, _Ptr->mon_grouping, _Cvt);
162  _Getvals((_Elem)0, _Ptr);
163  _CATCH_ALL
164  _Tidy();
165  _RERAISE;
166  _CATCH_END
167 
169  : _Ptr->frac_digits;
170  if (_Fracdigits < 0 || CHAR_MAX <= _Fracdigits)
171  _Fracdigits = 0;
172 
174  _Ptr->p_cs_precedes, _Ptr->p_sign_posn);
176  _Ptr->n_cs_precedes, _Ptr->n_sign_posn);
177 
178  if (_Isdef)
179  { // apply defaults for required facets
180  _CSTD memcpy(&_Plusformat, "$+xv", 4);
181  _CSTD memcpy(&_Minusformat, "$+xv", 4);
182  }
183  }
pattern _Minusformat
Definition: xlocmon:267
int _Fracdigits
Definition: xlocmon:265
const lconv *__CLR_OR_THIS_CALL _Getlconv() const
Definition: xlocinfo:124
const _Elem * _Currencysign
Definition: xlocmon:262
char p_sign_posn
Definition: locale.h:47
#define _TRY_BEGIN
Definition: xstddef:26
const _Elem * _Plussign
Definition: xlocmon:263
#define _CATCH_END
Definition: xstddef:29
_Cvtvec __CLR_OR_THIS_CALL _Getcvt() const
Definition: xlocinfo:119
pattern _Plusformat
Definition: xlocmon:266
char * mon_grouping
Definition: locale.h:38
const _Elem * _Minussign
Definition: xlocmon:264
const char * _Grouping
Definition: xlocmon:259
char int_frac_digits
Definition: locale.h:41
char n_sep_by_space
Definition: locale.h:46
Definition: locale.h:29
char n_sign_posn
Definition: locale.h:48
bool _International
Definition: xlocmon:268
void _Getvals(_Elem2, const lconv *_Ptr)
Definition: xlocmon:123
void _Tidy()
Definition: xlocmon:251
void _Makpat(pattern &_Pattern, unsigned int _Sepbyspace, unsigned int _Symbolprecedes, unsigned int _Signposition)
Definition: xlocmon:231
char p_sep_by_space
Definition: locale.h:44
char p_cs_precedes
Definition: locale.h:43
#define _CATCH_ALL
Definition: xstddef:28
_Locinfo::_Cvtvec _Cvt
Definition: xlocmon:270
memcpy(_Destination, _Source, _SourceSize)
#define CHAR_MAX
Definition: limits.h:24
#define _MAKLOCSTR(Elem, str, cvt)
Definition: xlocale:659
#define _CSTD
Definition: yvals.h:570
#define _RERAISE
Definition: xstddef:32
char frac_digits
Definition: locale.h:42
char n_cs_precedes
Definition: locale.h:45
template<class _Elem >
void _Mpunct< _Elem >::_Makpat ( pattern _Pattern,
unsigned int  _Sepbyspace,
unsigned int  _Symbolprecedes,
unsigned int  _Signposition 
)
inlineprivate
233  { // make format pattern from locale information
234  const char *_Ptr = _International || 2 < _Sepbyspace
235  || 1 < _Symbolprecedes || 4 < _Signposition
236  ? "$+xv" // international or bad parameters
237  : &(
238  "+v$x" "+v$x" "v$+x" "v+$x" "v$+x"
239  "+$vx" "+$vx" "$v+x" "+$vx" "$+vx"
240  "+v $" "+v $" "v $+" "v +$" "v $+"
241  "+$ v" "+$ v" "$ v+" "+$ v" "$+ v"
242  "+xv$" "+ v$" "v$ +" "v+ $" "v$ +"
243  "+x$v" "+ $v" "$v +" "+ $v" "$ +v")
244  [_Signposition * 4 // pick even/odd column
245  + _Symbolprecedes * 20 // pick even/odd row
246  + _Sepbyspace * 40]; // pick first/second/third group
247 
248  _CRT_SECURE_MEMCPY(_Pattern.field, sizeof (_Pattern.field), _Ptr, 4);
249  }
bool _International
Definition: xlocmon:268
#define _CRT_SECURE_MEMCPY(dest, destsize, source, count)
Definition: yvals.h:438
template<class _Elem >
void _Mpunct< _Elem >::_Tidy ( )
inlineprivate
252  { // free all storage
253  _CSTD free((void *)_Grouping);
254  _CSTD free((void *)_Currencysign);
255  _CSTD free((void *)_Plussign);
256  _CSTD free((void *)_Minussign);
257  }
_ACRTIMP void __cdecl free(_Pre_maybenull_ _Post_invalid_ void *_Block)
const _Elem * _Currencysign
Definition: xlocmon:262
const _Elem * _Plussign
Definition: xlocmon:263
const _Elem * _Minussign
Definition: xlocmon:264
const char * _Grouping
Definition: xlocmon:259
#define _CSTD
Definition: yvals.h:570
template<class _Elem >
string_type _Mpunct< _Elem >::curr_symbol ( ) const
inline
63  { // return currency symbol string
64  return (do_curr_symbol());
65  }
virtual string_type __CLR_OR_THIS_CALL do_curr_symbol() const
Definition: xlocmon:200
template<class _Elem >
_Elem _Mpunct< _Elem >::decimal_point ( ) const
inline
48  { // return decimal point
49  return (do_decimal_point());
50  }
virtual _Elem __CLR_OR_THIS_CALL do_decimal_point() const
Definition: xlocmon:185
template<class _Elem >
virtual string_type __CLR_OR_THIS_CALL _Mpunct< _Elem >::do_curr_symbol ( ) const
inlineprotectedvirtual
201  { // return currency symbol string
202  return (string_type(_Currencysign));
203  }
const _Elem * _Currencysign
Definition: xlocmon:262
basic_string< _Elem, char_traits< _Elem >, allocator< _Elem > > string_type
Definition: xlocmon:45
template<class _Elem >
virtual _Elem __CLR_OR_THIS_CALL _Mpunct< _Elem >::do_decimal_point ( ) const
inlineprotectedvirtual
186  { // return decimal point
187  return (_Decimalpoint);
188  }
_Elem _Decimalpoint
Definition: xlocmon:260
template<class _Elem >
virtual int __CLR_OR_THIS_CALL _Mpunct< _Elem >::do_frac_digits ( ) const
inlineprotectedvirtual
216  { // return number of fraction digits
217  return (_Fracdigits);
218  }
int _Fracdigits
Definition: xlocmon:265
template<class _Elem >
virtual string __CLR_OR_THIS_CALL _Mpunct< _Elem >::do_grouping ( ) const
inlineprotectedvirtual
196  { // return grouping string
197  return (string(_Grouping));
198  }
const char * _Grouping
Definition: xlocmon:259
template<class _Elem >
virtual pattern __CLR_OR_THIS_CALL _Mpunct< _Elem >::do_neg_format ( ) const
inlineprotectedvirtual
226  { // return format for negative values
227  return (_Minusformat);
228  }
pattern _Minusformat
Definition: xlocmon:267
template<class _Elem >
virtual string_type __CLR_OR_THIS_CALL _Mpunct< _Elem >::do_negative_sign ( ) const
inlineprotectedvirtual
211  { // return minus sign
212  return (string_type(_Minussign));
213  }
basic_string< _Elem, char_traits< _Elem >, allocator< _Elem > > string_type
Definition: xlocmon:45
const _Elem * _Minussign
Definition: xlocmon:264
template<class _Elem >
virtual pattern __CLR_OR_THIS_CALL _Mpunct< _Elem >::do_pos_format ( ) const
inlineprotectedvirtual
221  { // return format for positive values
222  return (_Plusformat);
223  }
pattern _Plusformat
Definition: xlocmon:266
template<class _Elem >
virtual string_type __CLR_OR_THIS_CALL _Mpunct< _Elem >::do_positive_sign ( ) const
inlineprotectedvirtual
206  { // return plus sign
207  return (string_type(_Plussign));
208  }
basic_string< _Elem, char_traits< _Elem >, allocator< _Elem > > string_type
Definition: xlocmon:45
const _Elem * _Plussign
Definition: xlocmon:263
template<class _Elem >
virtual _Elem __CLR_OR_THIS_CALL _Mpunct< _Elem >::do_thousands_sep ( ) const
inlineprotectedvirtual
191  { // return thousands separator
192  return (_Kseparator);
193  }
_Elem _Kseparator
Definition: xlocmon:261
template<class _Elem >
int _Mpunct< _Elem >::frac_digits ( ) const
inline
78  { // return number of fraction digits
79  return (do_frac_digits());
80  }
virtual int __CLR_OR_THIS_CALL do_frac_digits() const
Definition: xlocmon:215
template<class _Elem >
string _Mpunct< _Elem >::grouping ( ) const
inline
58  { // return grouping string
59  return (do_grouping());
60  }
virtual string __CLR_OR_THIS_CALL do_grouping() const
Definition: xlocmon:195
template<class _Elem >
pattern _Mpunct< _Elem >::neg_format ( ) const
inline
88  { // return format for negative values
89  return (do_neg_format());
90  }
virtual pattern __CLR_OR_THIS_CALL do_neg_format() const
Definition: xlocmon:225
template<class _Elem >
string_type _Mpunct< _Elem >::negative_sign ( ) const
inline
73  { // return minus sign
74  return (do_negative_sign());
75  }
virtual string_type __CLR_OR_THIS_CALL do_negative_sign() const
Definition: xlocmon:210
template<class _Elem >
pattern _Mpunct< _Elem >::pos_format ( ) const
inline
83  { // return format for positive values
84  return (do_pos_format());
85  }
virtual pattern __CLR_OR_THIS_CALL do_pos_format() const
Definition: xlocmon:220
template<class _Elem >
string_type _Mpunct< _Elem >::positive_sign ( ) const
inline
68  { // return plus sign
69  return (do_positive_sign());
70  }
virtual string_type __CLR_OR_THIS_CALL do_positive_sign() const
Definition: xlocmon:205
template<class _Elem >
_Elem _Mpunct< _Elem >::thousands_sep ( ) const
inline
53  { // return thousands separator
54  return (do_thousands_sep());
55  }
virtual _Elem __CLR_OR_THIS_CALL do_thousands_sep() const
Definition: xlocmon:190

Member Data Documentation

template<class _Elem >
const _Elem* _Mpunct< _Elem >::_Currencysign
private
template<class _Elem >
_Locinfo::_Cvtvec _Mpunct< _Elem >::_Cvt
private
template<class _Elem >
_Elem _Mpunct< _Elem >::_Decimalpoint
private
template<class _Elem >
int _Mpunct< _Elem >::_Fracdigits
private
template<class _Elem >
const char* _Mpunct< _Elem >::_Grouping
private
template<class _Elem >
bool _Mpunct< _Elem >::_International
private
template<class _Elem >
_Elem _Mpunct< _Elem >::_Kseparator
private
template<class _Elem >
pattern _Mpunct< _Elem >::_Minusformat
private
template<class _Elem >
const _Elem* _Mpunct< _Elem >::_Minussign
private
template<class _Elem >
pattern _Mpunct< _Elem >::_Plusformat
private
template<class _Elem >
const _Elem* _Mpunct< _Elem >::_Plussign
private

The documentation for this class was generated from the following file: