• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/toolchains/hndtools-arm-linux-2.6.36-uclibc-4.5.3/arm-linux/include/c++/4.5.3/arm-brcm-linux-uclibcgnueabi/bits/
1// std::time_get, std::time_put implementation, generic version -*- C++ -*-
2
3// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
4// Free Software Foundation, Inc.
5//
6// This file is part of the GNU ISO C++ Library.  This library is free
7// software; you can redistribute it and/or modify it under the
8// terms of the GNU General Public License as published by the
9// Free Software Foundation; either version 3, or (at your option)
10// any later version.
11
12// This library is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15// GNU General Public License for more details.
16
17// Under Section 7 of GPL version 3, you are granted additional
18// permissions described in the GCC Runtime Library Exception, version
19// 3.1, as published by the Free Software Foundation.
20
21// You should have received a copy of the GNU General Public License and
22// a copy of the GCC Runtime Library Exception along with this program;
23// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
24// <http://www.gnu.org/licenses/>.
25
26/** @file time_members.h
27 *  This is an internal header file, included by other library headers.
28 *  You should not attempt to use it directly.
29 */
30
31//
32// ISO C++ 14882: 22.2.5.1.2 - time_get functions
33// ISO C++ 14882: 22.2.5.3.2 - time_put functions
34//
35
36// Written by Benjamin Kosnik <bkoz@redhat.com>
37
38_GLIBCXX_BEGIN_NAMESPACE(std)
39
40  template<typename _CharT>
41    __timepunct<_CharT>::__timepunct(size_t __refs)
42    : facet(__refs), _M_data(NULL)
43    {
44      _M_name_timepunct = _S_get_c_name();
45      _M_initialize_timepunct();
46    }
47
48  template<typename _CharT>
49    __timepunct<_CharT>::__timepunct(__cache_type* __cache, size_t __refs)
50    : facet(__refs), _M_data(__cache)
51    {
52      _M_name_timepunct = _S_get_c_name();
53      _M_initialize_timepunct();
54    }
55
56  template<typename _CharT>
57    __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s,
58				     size_t __refs)
59    : facet(__refs), _M_data(NULL)
60    {
61      if (__builtin_strcmp(__s, _S_get_c_name()) != 0)
62	{
63	  const size_t __len = __builtin_strlen(__s) + 1;
64	  char* __tmp = new char[__len];
65	  __builtin_memcpy(__tmp, __s, __len);
66	  _M_name_timepunct = __tmp;
67	}
68      else
69	_M_name_timepunct = _S_get_c_name();
70
71      __try
72	{ _M_initialize_timepunct(__cloc); }
73      __catch(...)
74	{
75	  if (_M_name_timepunct != _S_get_c_name())
76	    delete [] _M_name_timepunct;
77	  __throw_exception_again;
78	}
79    }
80
81  template<typename _CharT>
82    __timepunct<_CharT>::~__timepunct()
83    {
84      if (_M_name_timepunct != _S_get_c_name())
85	delete [] _M_name_timepunct;
86      delete _M_data;
87      _S_destroy_c_locale(_M_c_locale_timepunct);
88    }
89
90_GLIBCXX_END_NAMESPACE
91