1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/genericopenlibs/cppstdlib/stl/src/monetary.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,207 @@
1.4 +/*
1.5 + * Portions Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
1.6 + *
1.7 + * Copyright (c) 1999
1.8 + * Silicon Graphics Computer Systems, Inc.
1.9 + *
1.10 + * Copyright (c) 1999
1.11 + * Boris Fomitchev
1.12 + *
1.13 + * This material is provided "as is", with absolutely no warranty expressed
1.14 + * or implied. Any use is at your own risk.
1.15 + *
1.16 + * Permission to use or copy this software for any purpose is hereby granted
1.17 + * without fee, provided the above notices are retained on all copies.
1.18 + * Permission to modify the code and to distribute modified code is granted,
1.19 + * provided the above notices are retained, and a notice that the code was
1.20 + * modified is included with the above copyright notice.
1.21 + *
1.22 + */
1.23 +#include "stlport_prefix.h"
1.24 +
1.25 +#include <locale>
1.26 +#include <istream>
1.27 +
1.28 +#if defined(__SYMBIAN32__WSD__)
1.29 +#include "libstdcppwsd.h"
1.30 +
1.31 +void monetary_empty_string_init()
1.32 +{
1.33 + get_monetary_S_empty_string().copy("", 1);
1.34 +# ifndef _STLP_NO_WCHAR_T
1.35 + get_monetary_S_empty_wstring().copy(L"", 1);
1.36 +# endif //_STLP_NO_WCHAR_T
1.37 +}
1.38 +#define _S_empty_string get_monetary_S_empty_string()
1.39 +#define _S_empty_wstring get_monetary_S_empty_wstring()
1.40 +
1.41 +#endif
1.42 +
1.43 +_STLP_BEGIN_NAMESPACE
1.44 +
1.45 +static void _Init_monetary_formats(money_base::pattern& pos_format,
1.46 + money_base::pattern& neg_format) {
1.47 + pos_format.field[0] = (char) money_base::symbol;
1.48 + pos_format.field[1] = (char) money_base::sign;
1.49 + pos_format.field[2] = (char) money_base::none;
1.50 + pos_format.field[3] = (char) money_base::value;
1.51 +
1.52 + neg_format.field[0] = (char) money_base::symbol;
1.53 + neg_format.field[1] = (char) money_base::sign;
1.54 + neg_format.field[2] = (char) money_base::none;
1.55 + neg_format.field[3] = (char) money_base::value;
1.56 +}
1.57 +
1.58 +// This is being used throughout the library
1.59 +#if !defined(__SYMBIAN32__WSD__)
1.60 +static const string _S_empty_string;
1.61 +#ifndef _STLP_NO_WCHAR_T
1.62 +static const wstring _S_empty_wstring;
1.63 +#endif
1.64 +#endif //__SYMBIAN32__WSD__
1.65 +//
1.66 +// moneypunct<>
1.67 +//
1.68 +
1.69 +_STLP_DECLSPEC moneypunct<char, true>::moneypunct(size_t __refs) : locale::facet(__refs)
1.70 +{ _Init_monetary_formats(_M_pos_format, _M_neg_format); }
1.71 +_STLP_DECLSPEC moneypunct<char, true>::~moneypunct() {}
1.72 +
1.73 +_STLP_DECLSPEC char moneypunct<char, true>::do_decimal_point() const {return ' ';}
1.74 +_STLP_DECLSPEC char moneypunct<char, true>::do_thousands_sep() const {return ' ';}
1.75 +_STLP_DECLSPEC string moneypunct<char, true>::do_grouping() const { return _S_empty_string; }
1.76 +_STLP_DECLSPEC string moneypunct<char, true>::do_curr_symbol() const { return _S_empty_string; }
1.77 +_STLP_DECLSPEC string moneypunct<char, true>::do_positive_sign() const { return _S_empty_string; }
1.78 +_STLP_DECLSPEC string moneypunct<char, true>::do_negative_sign() const { return _S_empty_string; }
1.79 +_STLP_DECLSPEC money_base::pattern moneypunct<char, true>::do_pos_format() const {return _M_pos_format;}
1.80 +_STLP_DECLSPEC money_base::pattern moneypunct<char, true>::do_neg_format() const {return _M_neg_format;}
1.81 +_STLP_DECLSPEC int moneypunct<char, true>::do_frac_digits() const {return 0;}
1.82 +
1.83 +_STLP_DECLSPEC moneypunct<char, false>::moneypunct(size_t __refs) : locale::facet(__refs)
1.84 +{ _Init_monetary_formats(_M_pos_format, _M_neg_format); }
1.85 +_STLP_DECLSPEC moneypunct<char, false>::~moneypunct() {}
1.86 +
1.87 +_STLP_DECLSPEC char moneypunct<char, false>::do_decimal_point() const {return ' ';}
1.88 +_STLP_DECLSPEC char moneypunct<char, false>::do_thousands_sep() const {return ' ';}
1.89 +
1.90 +_STLP_DECLSPEC string moneypunct<char, false>::do_grouping() const { return _S_empty_string; }
1.91 +_STLP_DECLSPEC string moneypunct<char, false>::do_curr_symbol() const { return _S_empty_string; }
1.92 +_STLP_DECLSPEC string moneypunct<char, false>::do_positive_sign() const { return _S_empty_string; }
1.93 +_STLP_DECLSPEC string moneypunct<char, false>::do_negative_sign() const { return _S_empty_string; }
1.94 +_STLP_DECLSPEC money_base::pattern moneypunct<char, false>::do_pos_format() const {return _M_pos_format;}
1.95 +_STLP_DECLSPEC money_base::pattern moneypunct<char, false>::do_neg_format() const {return _M_neg_format;}
1.96 +_STLP_DECLSPEC int moneypunct<char, false>::do_frac_digits() const {return 0;}
1.97 +
1.98 +#ifndef _STLP_NO_WCHAR_T
1.99 +_STLP_DECLSPEC moneypunct<wchar_t, true>::moneypunct(size_t __refs) : locale::facet(__refs)
1.100 +{ _Init_monetary_formats(_M_pos_format, _M_neg_format); }
1.101 +_STLP_DECLSPEC moneypunct<wchar_t, true>::~moneypunct() {}
1.102 +
1.103 +_STLP_DECLSPEC wchar_t moneypunct<wchar_t, true>::do_decimal_point() const {return L' ';}
1.104 +_STLP_DECLSPEC wchar_t moneypunct<wchar_t, true>::do_thousands_sep() const {return L' ';}
1.105 +_STLP_DECLSPEC string moneypunct<wchar_t, true>::do_grouping() const {return _S_empty_string;}
1.106 +
1.107 +_STLP_DECLSPEC wstring moneypunct<wchar_t, true>::do_curr_symbol() const
1.108 +{return _S_empty_wstring;}
1.109 +_STLP_DECLSPEC wstring moneypunct<wchar_t, true>::do_positive_sign() const
1.110 +{return _S_empty_wstring;}
1.111 +_STLP_DECLSPEC wstring moneypunct<wchar_t, true>::do_negative_sign() const
1.112 +{return _S_empty_wstring;}
1.113 +_STLP_DECLSPEC int moneypunct<wchar_t, true>::do_frac_digits() const {return 0;}
1.114 +_STLP_DECLSPEC money_base::pattern moneypunct<wchar_t, true>::do_pos_format() const
1.115 +{return _M_pos_format;}
1.116 +_STLP_DECLSPEC money_base::pattern moneypunct<wchar_t, true>::do_neg_format() const
1.117 +{return _M_neg_format;}
1.118 +
1.119 +_STLP_DECLSPEC moneypunct<wchar_t, false>::moneypunct(size_t __refs) : locale::facet(__refs)
1.120 +{ _Init_monetary_formats(_M_pos_format, _M_neg_format); }
1.121 +_STLP_DECLSPEC moneypunct<wchar_t, false>::~moneypunct() {}
1.122 +
1.123 +_STLP_DECLSPEC wchar_t moneypunct<wchar_t, false>::do_decimal_point() const {return L' ';}
1.124 +_STLP_DECLSPEC wchar_t moneypunct<wchar_t, false>::do_thousands_sep() const {return L' ';}
1.125 +_STLP_DECLSPEC string moneypunct<wchar_t, false>::do_grouping() const { return _S_empty_string;}
1.126 +_STLP_DECLSPEC wstring moneypunct<wchar_t, false>::do_curr_symbol() const
1.127 +{return _S_empty_wstring;}
1.128 +_STLP_DECLSPEC wstring moneypunct<wchar_t, false>::do_positive_sign() const
1.129 +{return _S_empty_wstring;}
1.130 +_STLP_DECLSPEC wstring moneypunct<wchar_t, false>::do_negative_sign() const
1.131 +{return _S_empty_wstring;}
1.132 +_STLP_DECLSPEC int moneypunct<wchar_t, false>::do_frac_digits() const {return 0;}
1.133 +
1.134 +_STLP_DECLSPEC money_base::pattern moneypunct<wchar_t, false>::do_pos_format() const
1.135 +{return _M_pos_format;}
1.136 +_STLP_DECLSPEC money_base::pattern moneypunct<wchar_t, false>::do_neg_format() const
1.137 +{return _M_neg_format;}
1.138 +
1.139 +#endif /* WCHAR_T */
1.140 +
1.141 +#if defined (__SYMBIAN32__WSD__)
1.142 +template <>
1.143 +_STLP_DECLSPEC locale::id& money_get<char, istreambuf_iterator<char, char_traits<char> > >::GetFacetLocaleId()
1.144 + {
1.145 + return get_libcpp_wsd().money_get_char_istreambuf_iterator_id;
1.146 + }
1.147 +template <>
1.148 +_STLP_DECLSPEC locale::id& money_put<char, ostreambuf_iterator<char, char_traits<char> > >::GetFacetLocaleId()
1.149 + {
1.150 + return get_libcpp_wsd().money_put_char_ostreambuf_iterator_id;
1.151 + }
1.152 +# ifndef _STLP_NO_WCHAR_T
1.153 +template <>
1.154 +_STLP_DECLSPEC locale::id& money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::GetFacetLocaleId()
1.155 + {
1.156 + return get_libcpp_wsd().money_get_wchar_istreambuf_iterator_id;
1.157 + }
1.158 +template <>
1.159 +_STLP_DECLSPEC locale::id& money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::GetFacetLocaleId()
1.160 + {
1.161 + return get_libcpp_wsd().money_put_wchar_ostreambuf_iterator_id;
1.162 + }
1.163 +# endif /* _STLP_NO_WCHAR_T */
1.164 +#endif /* __SYMBIAN32__WSD__ */
1.165 +
1.166 +//
1.167 +// Instantiations
1.168 +//
1.169 +
1.170 +#if !defined(_STLP_NO_FORCE_INSTANTIATE)
1.171 +
1.172 +template class _STLP_CLASS_DECLSPEC money_get<char, istreambuf_iterator<char, char_traits<char> > >;
1.173 +template class _STLP_CLASS_DECLSPEC money_put<char, ostreambuf_iterator<char, char_traits<char> > >;
1.174 +// template class money_put<char, char*>;
1.175 +
1.176 +# ifndef _STLP_NO_WCHAR_T
1.177 +template class _STLP_CLASS_DECLSPEC money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
1.178 +template class _STLP_CLASS_DECLSPEC money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
1.179 +// template class money_put<wchar_t, wchar_t*>;
1.180 +// template class money_get<wchar_t, const wchar_t*>;
1.181 +# endif
1.182 +
1.183 +#endif
1.184 +
1.185 +#if defined (__EPOC32__)
1.186 +template <>
1.187 +locale::id money_get<char, istreambuf_iterator<char, char_traits<char> > >::id={8};
1.188 +
1.189 +template <>
1.190 +locale::id money_put<char, ostreambuf_iterator<char, char_traits<char> > >::id={10};
1.191 +template <>
1.192 +locale::id money_put<char, char*>::id;
1.193 +
1.194 +# if !defined (_STLP_NO_WCHAR_T)
1.195 +template <>
1.196 +locale::id money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id={27};
1.197 +template <>
1.198 +locale::id money_get<wchar_t, const wchar_t*>::id;
1.199 +
1.200 +template <>
1.201 +locale::id money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id={29};
1.202 +# endif
1.203 +#endif // __EPOC32__
1.204 +
1.205 +
1.206 +_STLP_END_NAMESPACE
1.207 +
1.208 +// Local Variables:
1.209 +// mode:C++
1.210 +// End: