197403Sobrien// std::messages implementation details, IEEE 1003.1-200x version -*- C++ -*- 297403Sobrien 397403Sobrien// Copyright (C) 2001 Free Software Foundation, Inc. 497403Sobrien// 597403Sobrien// This file is part of the GNU ISO C++ Library. This library is free 697403Sobrien// software; you can redistribute it and/or modify it under the 797403Sobrien// terms of the GNU General Public License as published by the 897403Sobrien// Free Software Foundation; either version 2, or (at your option) 997403Sobrien// any later version. 1097403Sobrien 1197403Sobrien// This library is distributed in the hope that it will be useful, 1297403Sobrien// but WITHOUT ANY WARRANTY; without even the implied warranty of 1397403Sobrien// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1497403Sobrien// GNU General Public License for more details. 1597403Sobrien 1697403Sobrien// You should have received a copy of the GNU General Public License along 1797403Sobrien// with this library; see the file COPYING. If not, write to the Free 18169691Skan// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 1997403Sobrien// USA. 2097403Sobrien 2197403Sobrien// As a special exception, you may use this file as part of a free software 2297403Sobrien// library without restriction. Specifically, if other files instantiate 2397403Sobrien// templates or use macros or inline functions from this file, or you compile 2497403Sobrien// this file and link it with other files to produce an executable, this 2597403Sobrien// file does not by itself cause the resulting executable to be covered by 2697403Sobrien// the GNU General Public License. This exception does not however 2797403Sobrien// invalidate any other reasons why the executable file might be covered by 2897403Sobrien// the GNU General Public License. 2997403Sobrien 30169691Skan/** @file messages_members.h 31169691Skan * This is an internal header file, included by other library headers. 32169691Skan * You should not attempt to use it directly. 33169691Skan */ 34169691Skan 3597403Sobrien// 3697403Sobrien// ISO C++ 14882: 22.2.7.1.2 messages virtual functions 3797403Sobrien// 3897403Sobrien 3997403Sobrien// Written by Benjamin Kosnik <bkoz@redhat.com> 4097403Sobrien 41169691Skan_GLIBCXX_BEGIN_NAMESPACE(std) 42169691Skan 4397403Sobrien // Non-virtual member functions. 4497403Sobrien template<typename _CharT> 4597403Sobrien typename messages<_CharT>::catalog 4697403Sobrien messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc, 4797403Sobrien const char*) const 4897403Sobrien { return this->do_open(__s, __loc); } 4997403Sobrien 5097403Sobrien // Virtual member functions. 5197403Sobrien template<typename _CharT> 5297403Sobrien messages<_CharT>::~messages() 5397403Sobrien { } 5497403Sobrien 5597403Sobrien template<typename _CharT> 5697403Sobrien typename messages<_CharT>::catalog 5797403Sobrien messages<_CharT>::do_open(const basic_string<char>& __s, 5897403Sobrien const locale&) const 5997403Sobrien { return reinterpret_cast<catalog>(catopen(__s.c_str(), NL_CAT_LOCALE)); } 6097403Sobrien 6197403Sobrien template<typename _CharT> 6297403Sobrien typename messages<_CharT>::string_type 6397403Sobrien messages<_CharT>::do_get(catalog __c, int __setid, int __msgid, 6497403Sobrien const string_type& __dfault) const 6597403Sobrien { 6697403Sobrien nl_catd __nlc = reinterpret_cast<nl_catd>(__c); 6797403Sobrien char* __msg = catgets(__nlc, __setid, __msgid, 6897403Sobrien _M_convert_to_char(__dfault)); 6997403Sobrien return _M_convert_from_char(__msg); 7097403Sobrien } 7197403Sobrien 7297403Sobrien template<typename _CharT> 7397403Sobrien void 7497403Sobrien messages<_CharT>::do_close(catalog __c) const 7597403Sobrien { catclose(reinterpret_cast<nl_catd>(__c)); } 7697403Sobrien 77169691Skan_GLIBCXX_END_NAMESPACE 78