1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/tools/stlport/stl/_monetary.h Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -0,0 +1,469 @@
1.4 +/*
1.5 + * Copyright (c) 1999
1.6 + * Silicon Graphics Computer Systems, Inc.
1.7 + *
1.8 + * Copyright (c) 1999
1.9 + * Boris Fomitchev
1.10 + *
1.11 + * This material is provided "as is", with absolutely no warranty expressed
1.12 + * or implied. Any use is at your own risk.
1.13 + *
1.14 + * Permission to use or copy this software for any purpose is hereby granted
1.15 + * without fee, provided the above notices are retained on all copies.
1.16 + * Permission to modify the code and to distribute modified code is granted,
1.17 + * provided the above notices are retained, and a notice that the code was
1.18 + * modified is included with the above copyright notice.
1.19 + *
1.20 + */
1.21 +// WARNING: This is an internal header file, included by other C++
1.22 +// standard library headers. You should not attempt to use this header
1.23 +// file directly.
1.24 +
1.25 +
1.26 +#ifndef _STLP_INTERNAL_MONETARY_H
1.27 +#define _STLP_INTERNAL_MONETARY_H
1.28 +
1.29 +#ifndef _STLP_INTERNAL_CTYPE_H
1.30 +# include <stl/_ctype.h>
1.31 +#endif
1.32 +
1.33 +#ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H
1.34 +# include <stl/_ostreambuf_iterator.h>
1.35 +#endif
1.36 +
1.37 +#ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H
1.38 +# include <stl/_istreambuf_iterator.h>
1.39 +#endif
1.40 +
1.41 +_STLP_BEGIN_NAMESPACE
1.42 +
1.43 +class money_base {
1.44 +public:
1.45 + enum part {none, space, symbol, sign, value};
1.46 + struct pattern {
1.47 + char field[4];
1.48 + };
1.49 +};
1.50 +
1.51 +// moneypunct facets: forward declaration
1.52 +template <class _charT, _STLP_DFL_NON_TYPE_PARAM(bool, _International, false) > class moneypunct {};
1.53 +
1.54 +// money_get facets
1.55 +
1.56 +#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
1.57 +template <class _CharT, class _InputIter>
1.58 +#else
1.59 +template <class _CharT, class _InputIter = istreambuf_iterator<_CharT, char_traits<_CharT> > >
1.60 +#endif
1.61 +class money_get : public locale::facet {
1.62 + friend class _Locale_impl;
1.63 +
1.64 +public:
1.65 + typedef _CharT char_type;
1.66 + typedef _InputIter iter_type;
1.67 + typedef basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > string_type;
1.68 +
1.69 + money_get(size_t __refs = 0) : locale::facet(__refs) {}
1.70 + iter_type get(iter_type __s, iter_type __end, bool __intl,
1.71 + ios_base& __str, ios_base::iostate& __err,
1.72 + _STLP_LONGEST_FLOAT_TYPE& __units) const
1.73 + { return do_get(__s, __end, __intl, __str, __err, __units); }
1.74 + iter_type get(iter_type __s, iter_type __end, bool __intl,
1.75 + ios_base& __str, ios_base::iostate& __err,
1.76 + string_type& __digits) const
1.77 + { return do_get(__s, __end, __intl, __str, __err, __digits); }
1.78 +
1.79 + static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
1.80 +
1.81 +protected:
1.82 + ~money_get() {}
1.83 + virtual iter_type do_get(iter_type __s, iter_type __end, bool __intl,
1.84 + ios_base& __str, ios_base::iostate& __err,
1.85 + _STLP_LONGEST_FLOAT_TYPE& __units) const;
1.86 + virtual iter_type do_get(iter_type __s, iter_type __end, bool __intl,
1.87 + ios_base& __str, ios_base::iostate& __err,
1.88 + string_type& __digits) const;
1.89 +};
1.90 +
1.91 +
1.92 +// moneypunct facets: definition of specializations
1.93 +
1.94 +_STLP_TEMPLATE_NULL
1.95 +class _STLP_CLASS_DECLSPEC moneypunct<char, true> : public locale::facet, public money_base {
1.96 +
1.97 +public:
1.98 + typedef char char_type;
1.99 + typedef string string_type;
1.100 + explicit moneypunct _STLP_PSPEC2(char, true) (size_t __refs = 0);
1.101 +
1.102 + char decimal_point() const { return do_decimal_point(); }
1.103 + char thousands_sep() const { return do_thousands_sep(); }
1.104 + string grouping() const { return do_grouping(); }
1.105 + string_type curr_symbol() const { return do_curr_symbol(); }
1.106 + string_type positive_sign() const { return do_positive_sign(); }
1.107 + string_type negative_sign() const { return do_negative_sign(); }
1.108 + int frac_digits() const { return do_frac_digits(); }
1.109 + pattern pos_format() const { return do_pos_format(); }
1.110 + pattern neg_format() const { return do_neg_format(); }
1.111 +
1.112 + static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
1.113 +# if defined (_STLP_STATIC_CONST_INIT_BUG)
1.114 + enum _IntlVal { intl = 1 } ;
1.115 +# else
1.116 + static const bool intl = true;
1.117 +# endif
1.118 +
1.119 +protected:
1.120 + pattern _M_pos_format;
1.121 + pattern _M_neg_format;
1.122 +
1.123 + ~moneypunct _STLP_PSPEC2(char, true) ();
1.124 +
1.125 + virtual char do_decimal_point() const;
1.126 + virtual char do_thousands_sep() const;
1.127 + virtual string do_grouping() const;
1.128 +
1.129 + virtual string do_curr_symbol() const;
1.130 +
1.131 + virtual string do_positive_sign() const;
1.132 + virtual string do_negative_sign() const;
1.133 + virtual int do_frac_digits() const;
1.134 + virtual pattern do_pos_format() const;
1.135 + virtual pattern do_neg_format() const;
1.136 +
1.137 + friend class _Locale_impl;
1.138 +};
1.139 +
1.140 +_STLP_TEMPLATE_NULL
1.141 +class _STLP_CLASS_DECLSPEC moneypunct<char, false> : public locale::facet, public money_base
1.142 +{
1.143 +public:
1.144 + typedef char char_type;
1.145 + typedef string string_type;
1.146 +
1.147 + explicit moneypunct _STLP_PSPEC2(char, false) (size_t __refs = 0);
1.148 +
1.149 + char decimal_point() const { return do_decimal_point(); }
1.150 + char thousands_sep() const { return do_thousands_sep(); }
1.151 + string grouping() const { return do_grouping(); }
1.152 + string_type curr_symbol() const { return do_curr_symbol(); }
1.153 + string_type positive_sign() const { return do_positive_sign(); }
1.154 + string_type negative_sign() const { return do_negative_sign(); }
1.155 + int frac_digits() const { return do_frac_digits(); }
1.156 + pattern pos_format() const { return do_pos_format(); }
1.157 + pattern neg_format() const { return do_neg_format(); }
1.158 +
1.159 + static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
1.160 +# if defined (_STLP_STATIC_CONST_INIT_BUG)
1.161 + enum _IntlVal { intl = 0 } ;
1.162 +# else
1.163 + static const bool intl = false;
1.164 +# endif
1.165 +
1.166 +protected:
1.167 + pattern _M_pos_format;
1.168 + pattern _M_neg_format;
1.169 +
1.170 + ~moneypunct _STLP_PSPEC2(char, false) ();
1.171 +
1.172 + virtual char do_decimal_point() const;
1.173 + virtual char do_thousands_sep() const;
1.174 + virtual string do_grouping() const;
1.175 +
1.176 + virtual string do_curr_symbol() const;
1.177 +
1.178 + virtual string do_positive_sign() const;
1.179 + virtual string do_negative_sign() const;
1.180 + virtual int do_frac_digits() const;
1.181 + virtual pattern do_pos_format() const;
1.182 + virtual pattern do_neg_format() const;
1.183 +
1.184 + friend class _Locale_impl;
1.185 +};
1.186 +
1.187 +
1.188 +# ifndef _STLP_NO_WCHAR_T
1.189 +
1.190 +_STLP_TEMPLATE_NULL
1.191 +class _STLP_CLASS_DECLSPEC moneypunct<wchar_t, true> : public locale::facet, public money_base
1.192 +{
1.193 + friend class _Locale_impl;
1.194 +public:
1.195 + typedef wchar_t char_type;
1.196 + typedef wstring string_type;
1.197 + explicit moneypunct _STLP_PSPEC2(wchar_t, true) (size_t __refs = 0);
1.198 + wchar_t decimal_point() const { return do_decimal_point(); }
1.199 + wchar_t thousands_sep() const { return do_thousands_sep(); }
1.200 + string grouping() const { return do_grouping(); }
1.201 + string_type curr_symbol() const { return do_curr_symbol(); }
1.202 + string_type positive_sign() const { return do_positive_sign(); }
1.203 + string_type negative_sign() const { return do_negative_sign(); }
1.204 + int frac_digits() const { return do_frac_digits(); }
1.205 + pattern pos_format() const { return do_pos_format(); }
1.206 + pattern neg_format() const { return do_neg_format(); }
1.207 +
1.208 + static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
1.209 +# if defined (_STLP_STATIC_CONST_INIT_BUG)
1.210 + enum _IntlVal { intl = 1 } ;
1.211 +# else
1.212 + static const bool intl = true;
1.213 +# endif
1.214 +
1.215 +protected:
1.216 + pattern _M_pos_format;
1.217 + pattern _M_neg_format;
1.218 +
1.219 + ~moneypunct _STLP_PSPEC2(wchar_t, true) ();
1.220 +
1.221 + virtual wchar_t do_decimal_point() const;
1.222 + virtual wchar_t do_thousands_sep() const;
1.223 + virtual string do_grouping() const;
1.224 +
1.225 + virtual string_type do_curr_symbol() const;
1.226 +
1.227 + virtual string_type do_positive_sign() const;
1.228 + virtual string_type do_negative_sign() const;
1.229 + virtual int do_frac_digits() const;
1.230 + virtual pattern do_pos_format() const;
1.231 + virtual pattern do_neg_format() const;
1.232 +};
1.233 +
1.234 +
1.235 +_STLP_TEMPLATE_NULL
1.236 +class _STLP_CLASS_DECLSPEC moneypunct<wchar_t, false> : public locale::facet, public money_base
1.237 +{
1.238 + friend class _Locale_impl;
1.239 +public:
1.240 + typedef wchar_t char_type;
1.241 + typedef wstring string_type;
1.242 + explicit moneypunct _STLP_PSPEC2(wchar_t, false) (size_t __refs = 0);
1.243 + wchar_t decimal_point() const { return do_decimal_point(); }
1.244 + wchar_t thousands_sep() const { return do_thousands_sep(); }
1.245 + string grouping() const { return do_grouping(); }
1.246 + string_type curr_symbol() const { return do_curr_symbol(); }
1.247 + string_type positive_sign() const { return do_positive_sign(); }
1.248 + string_type negative_sign() const { return do_negative_sign(); }
1.249 + int frac_digits() const { return do_frac_digits(); }
1.250 + pattern pos_format() const { return do_pos_format(); }
1.251 + pattern neg_format() const { return do_neg_format(); }
1.252 +
1.253 + static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
1.254 +# if defined (_STLP_STATIC_CONST_INIT_BUG)
1.255 + enum _IntlVal { intl = 0 } ;
1.256 +# else
1.257 + static const bool intl = false;
1.258 +# endif
1.259 +
1.260 +protected:
1.261 + pattern _M_pos_format;
1.262 + pattern _M_neg_format;
1.263 +
1.264 + ~moneypunct _STLP_PSPEC2(wchar_t, false) ();
1.265 +
1.266 + virtual wchar_t do_decimal_point() const;
1.267 + virtual wchar_t do_thousands_sep() const;
1.268 + virtual string do_grouping() const;
1.269 +
1.270 + virtual string_type do_curr_symbol() const;
1.271 +
1.272 + virtual string_type do_positive_sign() const;
1.273 + virtual string_type do_negative_sign() const;
1.274 + virtual int do_frac_digits() const;
1.275 + virtual pattern do_pos_format() const;
1.276 + virtual pattern do_neg_format() const;
1.277 +};
1.278 +
1.279 +# endif
1.280 +
1.281 +template <class _charT, _STLP_DFL_NON_TYPE_PARAM(bool , _International , false) > class moneypunct_byname {};
1.282 +
1.283 +_STLP_TEMPLATE_NULL
1.284 +class _STLP_CLASS_DECLSPEC moneypunct_byname<char, true> : public moneypunct<char, true> {
1.285 +public:
1.286 + typedef money_base::pattern pattern;
1.287 + typedef char char_type;
1.288 + typedef string string_type;
1.289 +
1.290 + explicit moneypunct_byname _STLP_PSPEC2(char, true) (const char * __name, size_t __refs = 0,
1.291 + _Locale_name_hint* __hint = 0);
1.292 +
1.293 +protected:
1.294 + _Locale_monetary* _M_monetary;
1.295 + ~moneypunct_byname _STLP_PSPEC2(char, true) ();
1.296 + virtual char do_decimal_point() const;
1.297 + virtual char do_thousands_sep() const;
1.298 + virtual string do_grouping() const;
1.299 +
1.300 + virtual string_type do_curr_symbol() const;
1.301 +
1.302 + virtual string_type do_positive_sign() const;
1.303 + virtual string_type do_negative_sign() const;
1.304 + virtual int do_frac_digits() const;
1.305 +
1.306 +private:
1.307 + typedef moneypunct_byname<char, true> _Self;
1.308 + //explicitely defined as private to avoid warnings:
1.309 + moneypunct_byname(_Self const&);
1.310 + _Self& operator = (_Self const&);
1.311 +};
1.312 +
1.313 +_STLP_TEMPLATE_NULL
1.314 +class _STLP_CLASS_DECLSPEC moneypunct_byname<char, false> : public moneypunct<char, false>
1.315 +{
1.316 +public:
1.317 + typedef money_base::pattern pattern;
1.318 + typedef char char_type;
1.319 + typedef string string_type;
1.320 +
1.321 + explicit moneypunct_byname _STLP_PSPEC2(char, false) (const char * __name, size_t __refs = 0,
1.322 + _Locale_name_hint* __hint = 0);
1.323 +
1.324 +protected:
1.325 + _Locale_monetary* _M_monetary;
1.326 + ~moneypunct_byname _STLP_PSPEC2(char, false) ();
1.327 + virtual char do_decimal_point() const;
1.328 + virtual char do_thousands_sep() const;
1.329 + virtual string do_grouping() const;
1.330 +
1.331 + virtual string_type do_curr_symbol() const;
1.332 +
1.333 + virtual string_type do_positive_sign() const;
1.334 + virtual string_type do_negative_sign() const;
1.335 + virtual int do_frac_digits() const;
1.336 +
1.337 +private:
1.338 + typedef moneypunct_byname<char, false> _Self;
1.339 + //explicitely defined as private to avoid warnings:
1.340 + moneypunct_byname(_Self const&);
1.341 + _Self& operator = (_Self const&);
1.342 + friend _Locale_name_hint* _Locale_extract_hint(moneypunct_byname<char, false>*);
1.343 +};
1.344 +
1.345 +#if !defined (_STLP_NO_WCHAR_T)
1.346 +_STLP_TEMPLATE_NULL
1.347 +class _STLP_CLASS_DECLSPEC moneypunct_byname<wchar_t, true> : public moneypunct<wchar_t, true>
1.348 +{
1.349 +public:
1.350 + typedef money_base::pattern pattern;
1.351 + typedef wchar_t char_type;
1.352 + typedef wstring string_type;
1.353 +
1.354 + explicit moneypunct_byname _STLP_PSPEC2(wchar_t, true) (const char * __name, size_t __refs = 0,
1.355 + _Locale_name_hint* __hint = 0);
1.356 +
1.357 +protected:
1.358 + _Locale_monetary* _M_monetary;
1.359 + ~moneypunct_byname _STLP_PSPEC2(wchar_t, true) ();
1.360 + virtual wchar_t do_decimal_point() const;
1.361 + virtual wchar_t do_thousands_sep() const;
1.362 + virtual string do_grouping() const;
1.363 +
1.364 + virtual string_type do_curr_symbol() const;
1.365 +
1.366 + virtual string_type do_positive_sign() const;
1.367 + virtual string_type do_negative_sign() const;
1.368 + virtual int do_frac_digits() const;
1.369 +
1.370 +private:
1.371 + typedef moneypunct_byname<wchar_t, true> _Self;
1.372 + //explicitely defined as private to avoid warnings:
1.373 + moneypunct_byname(_Self const&);
1.374 + _Self& operator = (_Self const&);
1.375 +};
1.376 +
1.377 +_STLP_TEMPLATE_NULL
1.378 +class _STLP_CLASS_DECLSPEC moneypunct_byname<wchar_t, false> : public moneypunct<wchar_t, false>
1.379 +{
1.380 +public:
1.381 + typedef money_base::pattern pattern;
1.382 + typedef wchar_t char_type;
1.383 + typedef wstring string_type;
1.384 +
1.385 + explicit moneypunct_byname _STLP_PSPEC2(wchar_t, false) (const char * __name, size_t __refs = 0,
1.386 + _Locale_name_hint* __hint = 0);
1.387 +
1.388 +protected:
1.389 + _Locale_monetary* _M_monetary;
1.390 + ~moneypunct_byname _STLP_PSPEC2(wchar_t, false) ();
1.391 + virtual wchar_t do_decimal_point() const;
1.392 + virtual wchar_t do_thousands_sep() const;
1.393 + virtual string do_grouping() const;
1.394 +
1.395 + virtual string_type do_curr_symbol() const;
1.396 +
1.397 + virtual string_type do_positive_sign() const;
1.398 + virtual string_type do_negative_sign() const;
1.399 + virtual int do_frac_digits() const;
1.400 +
1.401 +private:
1.402 + typedef moneypunct_byname<wchar_t, false> _Self;
1.403 + //explicitely defined as private to avoid warnings:
1.404 + moneypunct_byname(_Self const&);
1.405 + _Self& operator = (_Self const&);
1.406 +};
1.407 +#endif
1.408 +
1.409 +//===== methods ======
1.410 +
1.411 +
1.412 +// money_put facets
1.413 +
1.414 +#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES)
1.415 +template <class _CharT, class _OutputIter>
1.416 +#else
1.417 +template <class _CharT, class _OutputIter = ostreambuf_iterator<_CharT, char_traits<_CharT> > >
1.418 +#endif
1.419 +class money_put : public locale::facet {
1.420 + friend class _Locale_impl;
1.421 +
1.422 +public:
1.423 + typedef _CharT char_type;
1.424 + typedef _OutputIter iter_type;
1.425 + typedef basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > string_type;
1.426 +
1.427 + money_put(size_t __refs = 0) : locale::facet(__refs) {}
1.428 + iter_type put(iter_type __s, bool __intl, ios_base& __str,
1.429 + char_type __fill, _STLP_LONGEST_FLOAT_TYPE __units) const
1.430 + { return do_put(__s, __intl, __str, __fill, __units); }
1.431 + iter_type put(iter_type __s, bool __intl, ios_base& __str,
1.432 + char_type __fill,
1.433 + const string_type& __digits) const
1.434 + { return do_put(__s, __intl, __str, __fill, __digits); }
1.435 +
1.436 + static _STLP_STATIC_MEMBER_DECLSPEC locale::id id;
1.437 +
1.438 +protected:
1.439 + ~money_put() {}
1.440 + virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __str,
1.441 + char_type __fill, _STLP_LONGEST_FLOAT_TYPE __units) const;
1.442 + virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __str,
1.443 + char_type __fill,
1.444 + const string_type& __digits) const;
1.445 +};
1.446 +
1.447 +# if defined (_STLP_USE_TEMPLATE_EXPORT)
1.448 +_STLP_EXPORT_TEMPLATE_CLASS money_get<char, istreambuf_iterator<char, char_traits<char> > >;
1.449 +_STLP_EXPORT_TEMPLATE_CLASS money_put<char, ostreambuf_iterator<char, char_traits<char> > >;
1.450 +//_STLP_EXPORT_TEMPLATE_CLASS money_get<char, const char* >;
1.451 +//_STLP_EXPORT_TEMPLATE_CLASS money_put<char, char* >;
1.452 +# if ! defined (_STLP_NO_WCHAR_T)
1.453 +_STLP_EXPORT_TEMPLATE_CLASS money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
1.454 +_STLP_EXPORT_TEMPLATE_CLASS money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
1.455 +// _STLP_EXPORT_TEMPLATE_CLASS money_get<wchar_t, const wchar_t* >;
1.456 +// _STLP_EXPORT_TEMPLATE_CLASS money_put<wchar_t, wchar_t* >;
1.457 +# endif
1.458 +# endif /* _STLP_USE_TEMPLATE_EXPORT */
1.459 +
1.460 +_STLP_END_NAMESPACE
1.461 +
1.462 +#if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
1.463 +# include <stl/_monetary.c>
1.464 +#endif
1.465 +
1.466 +#endif /* _STLP_INTERNAL_MONETARY_H */
1.467 +
1.468 +// Local Variables:
1.469 +// mode:C++
1.470 +// End:
1.471 +
1.472 +