diff -r e1b950c65cb4 -r 837f303aceeb epoc32/include/stdapis/stlportv5/stl/_time_facets.h --- a/epoc32/include/stdapis/stlportv5/stl/_time_facets.h Wed Mar 31 12:27:01 2010 +0100 +++ b/epoc32/include/stdapis/stlportv5/stl/_time_facets.h Wed Mar 31 12:33:34 2010 +0100 @@ -1,22 +1,22 @@ /* - * © Portions copyright (c) 2006-2007 Nokia Corporation. All rights reserved. + * Portions Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. * * Copyright (c) 1999 * Silicon Graphics Computer Systems, Inc. * - * Copyright (c) 1999 + * Copyright (c) 1999 * Boris Fomitchev * * This material is provided "as is", with absolutely no warranty expressed * or implied. Any use is at your own risk. * - * Permission to use or copy this software for any purpose is hereby granted + * Permission to use or copy this software for any purpose is hereby granted * without fee, provided the above notices are retained on all copies. * Permission to modify the code and to distribute modified code is granted, * provided the above notices are retained, and a notice that the code was * modified is included with the above copyright notice. * - */ + */ // WARNING: This is an internal header file, included by other C++ // standard library headers. You should not attempt to use this header // file directly. @@ -25,15 +25,22 @@ #ifndef _STLP_INTERNAL_TIME_FACETS_H #define _STLP_INTERNAL_TIME_FACETS_H -#ifndef _STLP_CTIME -# include // Needed (for struct tm) by time facets +#ifndef _STLP_INTERNAL_CTIME +# include // Needed (for struct tm) by time facets #endif -#include -#include +#ifndef _STLP_C_LOCALE_H +# include +#endif + +#ifndef _STLP_IOS_BASE_H +# include +#endif _STLP_BEGIN_NAMESPACE +_STLP_MOVE_TO_PRIV_NAMESPACE + // Template functions used by time_get // Matching input against a list of names @@ -93,64 +100,66 @@ _STLP_DECLSPEC void _STLP_CALL _Init_timeinfo(_Time_Info&); _STLP_DECLSPEC void _STLP_CALL _Init_timeinfo(_Time_Info&, _Locale_time*); +_STLP_MOVE_TO_STD_NAMESPACE + class _STLP_CLASS_DECLSPEC time_base { public: enum dateorder {no_order, dmy, mdy, ymd, ydm}; }; - -template ) > -class time_get : public locale::facet, public time_base -{ - friend class _Locale; +#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES) +template +#else +template > > +#endif +class time_get : public locale::facet, public time_base { + friend class _Locale_impl; public: typedef _Ch char_type; typedef _InIt iter_type; - explicit time_get(size_t __refs = 0) : _BaseFacet(__refs) { - _Init_timeinfo(_M_timeinfo); - } + explicit time_get(size_t __refs = 0) : locale::facet(__refs) + { _STLP_PRIV _Init_timeinfo(_M_timeinfo); } dateorder date_order() const { return do_date_order(); } iter_type get_time(iter_type __s, iter_type __end, ios_base& __str, ios_base::iostate& __err, tm* __t) const - { return do_get_time(__s, __end, __str, __err, __t); } + { return do_get_time(__s, __end, __str, __err, __t); } iter_type get_date(iter_type __s, iter_type __end, ios_base& __str, ios_base::iostate& __err, tm* __t) const - { return do_get_date(__s, __end, __str, __err, __t); } + { return do_get_date(__s, __end, __str, __err, __t); } iter_type get_weekday(iter_type __s, iter_type __end, ios_base& __str, ios_base::iostate& __err, tm* __t) const - { return do_get_weekday(__s, __end, __str, __err, __t); } + { return do_get_weekday(__s, __end, __str, __err, __t); } iter_type get_monthname(iter_type __s, iter_type __end, ios_base& __str, ios_base::iostate& __err, tm* __t) const - { return do_get_monthname(__s, __end, __str, __err, __t); } + { return do_get_monthname(__s, __end, __str, __err, __t); } iter_type get_year(iter_type __s, iter_type __end, ios_base& __str, ios_base::iostate& __err, tm* __t) const - { return do_get_year(__s, __end, __str, __err, __t); } + { return do_get_year(__s, __end, __str, __err, __t); } -#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_) - _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId(); - _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId(istreambuf_iterator >*); - _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId(const wchar_t**); - _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId(istreambuf_iterator >*); - _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId(const char**); +#if defined(__SYMBIAN32__WSD__) + static _STLP_STATIC_MEMBER_DECLSPEC locale::id& GetFacetLocaleId(); +#elif defined (__SYMBIAN32__NO_STATIC_IMPORTS__) + static _STLP_STATIC_MEMBER_DECLSPEC locale::id& GetFacetLocaleId(); + static locale::id id; #else - _STLP_STATIC_MEMBER_DECLSPEC static locale::id id; + // NOTE: Symbian doesn't support exporting static data. + // Users of this class should use GetFacetLocaleId() to access the data member id + static _STLP_STATIC_MEMBER_DECLSPEC locale::id id; #endif protected: - _Time_Info _M_timeinfo; - - time_get(_Locale_time *, size_t __refs) : _BaseFacet(__refs) {} + time_get(_Locale_time *, size_t __refs) : locale::facet(__refs) {} ~time_get() {} virtual dateorder do_date_order() const {return no_order;} - + virtual iter_type do_get_time(iter_type __s, iter_type __end, ios_base&, ios_base::iostate& __err, tm* __t) const; - + virtual iter_type do_get_date(iter_type __s, iter_type __end, ios_base&, ios_base::iostate& __err, tm* __t) const; @@ -163,34 +172,63 @@ ios_base&, ios_base::iostate& __err, tm* __t) const; - + virtual iter_type do_get_year(iter_type __s, iter_type __end, ios_base&, ios_base::iostate& __err, tm* __t) const; + + _STLP_PRIV _Time_Info _M_timeinfo; }; -time_base::dateorder _STLP_CALL -_STLP_DECLSPEC __get_date_order(_Locale_time*); -_Locale_time* _STLP_CALL __acquire_time(const char* __name); -void _STLP_CALL __release_time(_Locale_time* __time); +_STLP_MOVE_TO_PRIV_NAMESPACE -template ) > -class time_get_byname : public time_get<_Ch, _InIt> -{ +_STLP_DECLSPEC time_base::dateorder _STLP_CALL __get_date_order(_Locale_time*); +_STLP_DECLSPEC _Locale_time* _STLP_CALL __acquire_time(const char* __name, _Locale_name_hint*); +_STLP_DECLSPEC void _STLP_CALL __release_time(_Locale_time* __time); + +_STLP_MOVE_TO_STD_NAMESPACE + +template +class time_get_byname; + +#if defined (__GNUC__) && (__GNUC__ < 3) +template +_Locale_name_hint* _Locale_time_extract_hint(time_get_byname<_Ch, _InIt>*); +#else +_Locale_name_hint* _Locale_time_extract_hint(time_get_byname > >*); +#endif + +#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES) +template +#else +template > > +#endif +class time_get_byname : public time_get<_Ch, _InIt> { public: typedef time_base::dateorder dateorder; typedef _InIt iter_type; - explicit time_get_byname(const char* __name, size_t __refs = 0) + explicit time_get_byname(const char* __name, size_t __refs = 0, _Locale_name_hint* __hint = 0) : time_get<_Ch, _InIt>((_Locale_time*) 0, __refs), - _M_time(__acquire_time(__name)) - { _Init_timeinfo(this->_M_timeinfo, this->_M_time); } + _M_time(_STLP_PRIV __acquire_time(__name, __hint)) + { _STLP_PRIV _Init_timeinfo(this->_M_timeinfo, this->_M_time); } protected: - ~time_get_byname() { __release_time(_M_time); } - dateorder do_date_order() const { return __get_date_order(_M_time); } + ~time_get_byname() { _STLP_PRIV __release_time(_M_time); } + dateorder do_date_order() const { return _STLP_PRIV __get_date_order(_M_time); } + private: _Locale_time* _M_time; + + typedef time_get_byname<_Ch, _InIt> _Self; + //explicitely defined as private to avoid warnings: + time_get_byname(_Self const&); + _Self& operator = (_Self const&); +#if defined (__GNUC__) && (__GNUC__ < 3) + friend _Locale_name_hint* _Locale_time_extract_hint<>(_Self*); +#else + friend _Locale_name_hint* _Locale_time_extract_hint(time_get_byname > >*); +#endif }; // time_put facet @@ -203,143 +241,121 @@ // format. As indicated by the foregoing remark, this will never be // 'x', 'X', or 'c'. +_STLP_MOVE_TO_PRIV_NAMESPACE + _STLP_DECLSPEC char * _STLP_CALL -__write_formatted_time(char * __buf, char __format, char __modifier, +__write_formatted_time(char *__buf, size_t __buf_size, char __format, char __modifier, const _Time_Info& __table, const tm* __t); template -inline _OuIt _STLP_CALL __put_time(char * __first, char * __last, _OuIt __out, - const ios_base& /* __loc */, char) { - return copy(__first, __last, __out); -} +inline _OuIt _STLP_CALL __put_time(char * __first, char * __last, _OuIt __out_ite, + const ios_base& /* __loc */, char) +{ return copy(__first, __last, __out_ite); } -# ifndef _STLP_NO_WCHAR_T +#if !defined (_STLP_NO_WCHAR_T) template -_OuIt _STLP_CALL __put_time(char * __first, char * __last, _OuIt __out, +_OuIt _STLP_CALL __put_time(char * __first, char * __last, _OuIt __out_ite, const ios_base& __s, wchar_t); -# endif +#endif -template ) > -class time_put : public locale::facet, public time_base -{ - friend class _Locale; +_STLP_MOVE_TO_STD_NAMESPACE + +#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES) +template +#else +template > > +#endif +class time_put : public locale::facet, public time_base { + friend class _Locale_impl; public: typedef _Ch char_type; - typedef _OutputIter iter_type; + typedef _OutIt iter_type; - explicit time_put(size_t __refs = 0) : _BaseFacet(__refs) { - _Init_timeinfo(_M_timeinfo); - } + explicit time_put(size_t __refs = 0) : locale::facet(__refs) + { _STLP_PRIV _Init_timeinfo(_M_timeinfo); } - _OutputIter put(iter_type __s, ios_base& __f, _Ch __fill, - const tm* __tmb, - const _Ch* __pat, const _Ch* __pat_end) const; - - _OutputIter put(iter_type __s, ios_base& __f, _Ch __fill, - const tm* __tmb, char __format, char __modifier = 0) const { - return do_put(__s, __f, __fill, __tmb, __format, __modifier); - } - -#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_) - _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId(); - _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId(ostreambuf_iterator >*); - _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId(wchar_t**); - _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId(ostreambuf_iterator >*); - _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId(char**); + _OutIt put(iter_type __s, ios_base& __f, _Ch __fill, + const tm* __tmb, + const _Ch* __pat, const _Ch* __pat_end) const; + + _OutIt put(iter_type __s, ios_base& __f, _Ch __fill, + const tm* __tmb, char __format, char __modifier = 0) const + { return do_put(__s, __f, __fill, __tmb, __format, __modifier); } + +#if defined(__SYMBIAN32__WSD__) + static _STLP_STATIC_MEMBER_DECLSPEC locale::id& GetFacetLocaleId(); +#elif defined (__SYMBIAN32__NO_STATIC_IMPORTS__) + static _STLP_STATIC_MEMBER_DECLSPEC locale::id& GetFacetLocaleId(); + static locale::id id; #else - _STLP_STATIC_MEMBER_DECLSPEC static locale::id id; + // NOTE: Symbian doesn't support exporting static data. + // Users of this class should use GetFacetLocaleId() to access the data member id + static _STLP_STATIC_MEMBER_DECLSPEC locale::id id; #endif - + protected: - _Time_Info _M_timeinfo; - - time_put(_Locale_time* /*__time*/, size_t __refs) : _BaseFacet(__refs) { - // _Init_timeinfo(_M_timeinfo, __time); - } + time_put(_Locale_time* /*__time*/, size_t __refs) : locale::facet(__refs) + {} //_STLP_PRIV _Init_timeinfo(_M_timeinfo, __time); } ~time_put() {} virtual iter_type do_put(iter_type __s, ios_base& __f, char_type /* __fill */, const tm* __tmb, char __format, char /* __modifier */) const; + + _STLP_PRIV _Time_Info _M_timeinfo; }; -template ) > -class time_put_byname : public time_put<_Ch, _InIt> -{ - friend class _Locale; +#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES) +template +#else +template > > +#endif +class time_put_byname : public time_put<_Ch, _OutIt> { + friend class _Locale_impl; public: typedef time_base::dateorder dateorder; - typedef _InIt iter_type; + typedef _OutIt iter_type; typedef _Ch char_type; - explicit time_put_byname(const char * __name, size_t __refs = 0) - : time_put<_Ch, _InIt>((_Locale_time*) 0, __refs), - _M_time(__acquire_time(__name)) - { _Init_timeinfo(this->_M_timeinfo, this->_M_time); } - + explicit time_put_byname(const char * __name, size_t __refs = 0, _Locale_name_hint* __hint = 0) + : time_put<_Ch, _OutIt>((_Locale_time*) 0, __refs), + _M_time(_STLP_PRIV __acquire_time(__name, __hint)) + { _STLP_PRIV _Init_timeinfo(this->_M_timeinfo, this->_M_time); } + protected: - ~time_put_byname() { __release_time(_M_time); } + ~time_put_byname() { _STLP_PRIV __release_time(_M_time); } private: _Locale_time* _M_time; + + typedef time_put_byname<_Ch, _OutIt> _Self; + //explicitely defined as private to avoid warnings: + time_put_byname(_Self const&); + _Self& operator = (_Self const&); }; -# ifdef _STLP_USE_TEMPLATE_EXPORT +#if defined (_STLP_USE_TEMPLATE_EXPORT) _STLP_EXPORT_TEMPLATE_CLASS time_get > >; _STLP_EXPORT_TEMPLATE_CLASS time_put > >; // _STLP_EXPORT_TEMPLATE_CLASS time_get; // _STLP_EXPORT_TEMPLATE_CLASS time_put; -# ifndef _STLP_NO_WCHAR_T +# if !defined (_STLP_NO_WCHAR_T) _STLP_EXPORT_TEMPLATE_CLASS time_get > >; _STLP_EXPORT_TEMPLATE_CLASS time_put > >; // _STLP_EXPORT_TEMPLATE_CLASS time_get; // _STLP_EXPORT_TEMPLATE_CLASS time_put; -# endif /* INSTANTIATE_WIDE_STREAMS */ +# endif -# endif - -# if defined (__BORLANDC__) && defined (_RTLDLL) -inline void _Stl_loc_init_time_facets() { - -#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_) - time_get > >::GetFacetLocaleId()._M_index = 16; - time_get::GetFacetLocaleId()._M_index = 17; - time_put > >::GetFacetLocaleId()._M_index = 18; - time_put::GetFacetLocaleId()._M_index = 19; -#else - time_get > >::GetFacetLocaleId()._M_index = 16; - time_get::id._M_index = 17; - time_put > >::GetFacetLocaleId()._M_index = 18; - time_put::id._M_index = 19; #endif -# ifndef _STLP_NO_WCHAR_T -#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_) - time_get > >::GetFacetLocaleId()._M_index = 35; - time_get::GetFacetLocaleId()._M_index = 36; - time_put > >::GetFacetLocaleId()._M_index = 37; - time_put::GetFacetLocaleId()._M_index = 38; -#else - time_get > >::id._M_index = 35; - time_get::id._M_index = 36; - time_put > >::id._M_index = 37; - time_put::id._M_index = 38; -#endif //__SYMBIAN32__ -# endif //!_STLP_NO_WCHAR_T - -} -# endif - _STLP_END_NAMESPACE #if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION) # include -# endif +#endif #endif /* _STLP_INTERNAL_TIME_FACETS_H */ // Local Variables: // mode:C++ // End: - -