messages_members.h

Go to the documentation of this file.
00001 // std::messages implementation details, generic version -*- C++ -*-
00002 
00003 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009
00004 // Free Software Foundation, Inc.
00005 //
00006 // This file is part of the GNU ISO C++ Library.  This library is free
00007 // software; you can redistribute it and/or modify it under the
00008 // terms of the GNU General Public License as published by the
00009 // Free Software Foundation; either version 3, or (at your option)
00010 // any later version.
00011 
00012 // This library is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 // GNU General Public License for more details.
00016 
00017 // Under Section 7 of GPL version 3, you are granted additional
00018 // permissions described in the GCC Runtime Library Exception, version
00019 // 3.1, as published by the Free Software Foundation.
00020 
00021 // You should have received a copy of the GNU General Public License and
00022 // a copy of the GCC Runtime Library Exception along with this program;
00023 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
00024 // <http://www.gnu.org/licenses/>.
00025 
00026 /** @file messages_members.h
00027  *  This is an internal header file, included by other library headers.
00028  *  You should not attempt to use it directly.
00029  */
00030 
00031 //
00032 // ISO C++ 14882: 22.2.7.1.2  messages virtual functions
00033 //
00034 
00035 // Written by Benjamin Kosnik <bkoz@redhat.com>
00036 
00037 _GLIBCXX_BEGIN_NAMESPACE(std)
00038 
00039   // Non-virtual member functions.
00040   template<typename _CharT>
00041      messages<_CharT>::messages(size_t __refs)
00042      : facet(__refs)
00043      { _M_c_locale_messages = _S_get_c_locale(); }
00044 
00045   template<typename _CharT>
00046      messages<_CharT>::messages(__c_locale, const char*, size_t __refs) 
00047      : facet(__refs)
00048      { _M_c_locale_messages = _S_get_c_locale(); }
00049 
00050   template<typename _CharT>
00051     typename messages<_CharT>::catalog 
00052     messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc, 
00053                const char*) const
00054     { return this->do_open(__s, __loc); }
00055 
00056   // Virtual member functions.
00057   template<typename _CharT>
00058     messages<_CharT>::~messages()
00059     { _S_destroy_c_locale(_M_c_locale_messages); }
00060 
00061   template<typename _CharT>
00062     typename messages<_CharT>::catalog 
00063     messages<_CharT>::do_open(const basic_string<char>&, const locale&) const
00064     { return 0; }
00065 
00066   template<typename _CharT>
00067     typename messages<_CharT>::string_type  
00068     messages<_CharT>::do_get(catalog, int, int, 
00069                  const string_type& __dfault) const
00070     { return __dfault; }
00071 
00072   template<typename _CharT>
00073     void    
00074     messages<_CharT>::do_close(catalog) const 
00075     { }
00076 
00077    // messages_byname
00078    template<typename _CharT>
00079      messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
00080      : messages<_CharT>(__refs) 
00081      { 
00082     if (__builtin_strcmp(__s, "C") != 0
00083         && __builtin_strcmp(__s, "POSIX") != 0)
00084       {
00085         this->_S_destroy_c_locale(this->_M_c_locale_messages);
00086         this->_S_create_c_locale(this->_M_c_locale_messages, __s); 
00087       }
00088      }
00089 
00090 _GLIBCXX_END_NAMESPACE

Generated on 21 Nov 2011 for libstdc++ by  doxygen 1.6.1