time_members.h revision 110614
1110614Skan// std::time_get, std::time_put implementation, generic version -*- C++ -*- 2110614Skan 3110614Skan// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. 4110614Skan// 5110614Skan// This file is part of the GNU ISO C++ Library. This library is free 6110614Skan// software; you can redistribute it and/or modify it under the 7110614Skan// terms of the GNU General Public License as published by the 8110614Skan// Free Software Foundation; either version 2, or (at your option) 9110614Skan// any later version. 10110614Skan 11110614Skan// This library is distributed in the hope that it will be useful, 12110614Skan// but WITHOUT ANY WARRANTY; without even the implied warranty of 13110614Skan// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14110614Skan// GNU General Public License for more details. 15110614Skan 16110614Skan// You should have received a copy of the GNU General Public License along 17110614Skan// with this library; see the file COPYING. If not, write to the Free 18110614Skan// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, 19110614Skan// USA. 20110614Skan 21110614Skan// As a special exception, you may use this file as part of a free software 22110614Skan// library without restriction. Specifically, if other files instantiate 23110614Skan// templates or use macros or inline functions from this file, or you compile 24110614Skan// this file and link it with other files to produce an executable, this 25110614Skan// file does not by itself cause the resulting executable to be covered by 26110614Skan// the GNU General Public License. This exception does not however 27110614Skan// invalidate any other reasons why the executable file might be covered by 28110614Skan// the GNU General Public License. 29110614Skan 30110614Skan// 31110614Skan// ISO C++ 14882: 22.2.5.1.2 - time_get functions 32110614Skan// ISO C++ 14882: 22.2.5.3.2 - time_put functions 33110614Skan// 34110614Skan 35110614Skan// Written by Benjamin Kosnik <bkoz@redhat.com> 36110614Skan 37110614Skan template<typename _CharT> 38110614Skan __timepunct<_CharT>::__timepunct(size_t __refs) 39110614Skan : locale::facet(__refs) 40110614Skan { 41110614Skan _M_name_timepunct = _S_c_name; 42110614Skan _M_initialize_timepunct(); 43110614Skan } 44110614Skan 45110614Skan template<typename _CharT> 46110614Skan __timepunct<_CharT>::__timepunct(__c_locale __cloc, const char* __s, 47110614Skan size_t __refs) 48110614Skan : locale::facet(__refs) 49110614Skan { 50110614Skan _M_name_timepunct = new char[strlen(__s) + 1]; 51110614Skan strcpy(_M_name_timepunct, __s); 52110614Skan _M_initialize_timepunct(__cloc); 53110614Skan } 54110614Skan 55110614Skan template<typename _CharT> 56110614Skan __timepunct<_CharT>::~__timepunct() 57110614Skan { 58110614Skan if (_S_c_name != _M_name_timepunct) 59110614Skan delete [] _M_name_timepunct; 60110614Skan _S_destroy_c_locale(_M_c_locale_timepunct); 61110614Skan } 62