messages_members.h revision 169691
1220137Strasz// std::messages implementation details, generic version -*- C++ -*-
2220137Strasz
3220137Strasz// Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc.
4220137Strasz//
5220137Strasz// This file is part of the GNU ISO C++ Library.  This library is free
6220137Strasz// software; you can redistribute it and/or modify it under the
7220137Strasz// terms of the GNU General Public License as published by the
8220137Strasz// Free Software Foundation; either version 2, or (at your option)
9220137Strasz// any later version.
10220137Strasz
11220137Strasz// This library is distributed in the hope that it will be useful,
12220137Strasz// but WITHOUT ANY WARRANTY; without even the implied warranty of
13220137Strasz// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14220137Strasz// GNU General Public License for more details.
15220137Strasz
16220137Strasz// You should have received a copy of the GNU General Public License along
17220137Strasz// with this library; see the file COPYING.  If not, write to the Free
18220137Strasz// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
19220137Strasz// USA.
20220137Strasz
21220137Strasz// As a special exception, you may use this file as part of a free software
22220137Strasz// library without restriction.  Specifically, if other files instantiate
23220137Strasz// templates or use macros or inline functions from this file, or you compile
24220137Strasz// this file and link it with other files to produce an executable, this
25220137Strasz// file does not by itself cause the resulting executable to be covered by
26220137Strasz// the GNU General Public License.  This exception does not however
27220137Strasz// invalidate any other reasons why the executable file might be covered by
28220137Strasz// the GNU General Public License.
29220137Strasz
30220137Strasz/** @file messages_members.h
31220137Strasz *  This is an internal header file, included by other library headers.
32220137Strasz *  You should not attempt to use it directly.
33220137Strasz */
34220137Strasz
35220137Strasz//
36220137Strasz// ISO C++ 14882: 22.2.7.1.2  messages virtual functions
37220137Strasz//
38228430Savg
39220137Strasz// Written by Benjamin Kosnik <bkoz@redhat.com>
40220137Strasz
41220137Strasz_GLIBCXX_BEGIN_NAMESPACE(std)
42220137Strasz
43220137Strasz  // Non-virtual member functions.
44220137Strasz  template<typename _CharT>
45220137Strasz     messages<_CharT>::messages(size_t __refs)
46220137Strasz     : facet(__refs)
47220137Strasz     { _M_c_locale_messages = _S_get_c_locale(); }
48220137Strasz
49220137Strasz  template<typename _CharT>
50220137Strasz     messages<_CharT>::messages(__c_locale, const char*, size_t __refs)
51220137Strasz     : facet(__refs)
52220137Strasz     { _M_c_locale_messages = _S_get_c_locale(); }
53220137Strasz
54220137Strasz  template<typename _CharT>
55220137Strasz    typename messages<_CharT>::catalog
56220137Strasz    messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc,
57220137Strasz			   const char*) const
58220137Strasz    { return this->do_open(__s, __loc); }
59220137Strasz
60220137Strasz  // Virtual member functions.
61220137Strasz  template<typename _CharT>
62220137Strasz    messages<_CharT>::~messages()
63220137Strasz    { _S_destroy_c_locale(_M_c_locale_messages); }
64220137Strasz
65220137Strasz  template<typename _CharT>
66220137Strasz    typename messages<_CharT>::catalog
67220137Strasz    messages<_CharT>::do_open(const basic_string<char>&, const locale&) const
68220137Strasz    { return 0; }
69220137Strasz
70220137Strasz  template<typename _CharT>
71220137Strasz    typename messages<_CharT>::string_type
72220137Strasz    messages<_CharT>::do_get(catalog, int, int,
73220137Strasz			     const string_type& __dfault) const
74220137Strasz    { return __dfault; }
75220137Strasz
76220137Strasz  template<typename _CharT>
77220137Strasz    void
78220137Strasz    messages<_CharT>::do_close(catalog) const
79220137Strasz    { }
80220137Strasz
81220137Strasz   // messages_byname
82220137Strasz   template<typename _CharT>
83220137Strasz     messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
84220137Strasz     : messages<_CharT>(__refs)
85220137Strasz     {
86220137Strasz	if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
87220137Strasz	  {
88220137Strasz	    this->_S_destroy_c_locale(this->_M_c_locale_messages);
89220137Strasz	    this->_S_create_c_locale(this->_M_c_locale_messages, __s);
90220137Strasz	  }
91220137Strasz     }
92220137Strasz
93220137Strasz_GLIBCXX_END_NAMESPACE
94220137Strasz