source: svn/newcon3bcm2_21bu/toolchain/include/c++/3.4.2/mips-linux-uclibc/bits/messages_members.h

Last change on this file was 76, checked in by megakiss, 10 years ago

1W 대기전력을 만족시키기 위하여 POWEROFF시 튜너를 Standby 상태로 함

  • Property svn:executable set to *
File size: 4.0 KB
Line 
1// std::messages implementation details, GNU version -*- C++ -*-
2
3// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
4//
5// This file is part of the GNU ISO C++ Library.  This library is free
6// software; you can redistribute it and/or modify it under the
7// terms of the GNU General Public License as published by the
8// Free Software Foundation; either version 2, or (at your option)
9// any later version.
10
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14// GNU General Public License for more details.
15
16// You should have received a copy of the GNU General Public License along
17// with this library; see the file COPYING.  If not, write to the Free
18// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
19// USA.
20
21// As a special exception, you may use this file as part of a free software
22// library without restriction.  Specifically, if other files instantiate
23// templates or use macros or inline functions from this file, or you compile
24// this file and link it with other files to produce an executable, this
25// file does not by itself cause the resulting executable to be covered by
26// the GNU General Public License.  This exception does not however
27// invalidate any other reasons why the executable file might be covered by
28// the GNU General Public License.
29
30//
31// ISO C++ 14882: 22.2.7.1.2  messages functions
32//
33
34// Written by Benjamin Kosnik <bkoz@redhat.com>
35
36#ifdef __UCLIBC_MJN3_ONLY__
37#warning fix prototypes for *textdomain funcs
38#endif
39#ifdef __UCLIBC_HAS_GETTEXT_AWARENESS__
40extern "C" char *__textdomain(const char *domainname);
41extern "C" char *__bindtextdomain(const char *domainname,
42                                  const char *dirname);
43#else
44#undef __textdomain
45#undef __bindtextdomain
46#define __textdomain(D)           ((void)0)
47#define __bindtextdomain(D,P)     ((void)0)
48#endif
49
50  // Non-virtual member functions.
51  template<typename _CharT>
52     messages<_CharT>::messages(size_t __refs)
53     : facet(__refs), _M_c_locale_messages(_S_get_c_locale()), 
54     _M_name_messages(_S_get_c_name())
55     { }
56
57  template<typename _CharT>
58     messages<_CharT>::messages(__c_locale __cloc, const char* __s, 
59                                size_t __refs) 
60     : facet(__refs), _M_c_locale_messages(_S_clone_c_locale(__cloc)),
61     _M_name_messages(__s)
62     {
63       char* __tmp = new char[std::strlen(__s) + 1];
64       std::strcpy(__tmp, __s);
65       _M_name_messages = __tmp;
66     }
67
68  template<typename _CharT>
69    typename messages<_CharT>::catalog
70    messages<_CharT>::open(const basic_string<char>& __s, const locale& __loc, 
71                           const char* __dir) const
72    { 
73      __bindtextdomain(__s.c_str(), __dir);
74      return this->do_open(__s, __loc); 
75    }
76
77  // Virtual member functions.
78  template<typename _CharT>
79    messages<_CharT>::~messages()
80    { 
81      if (_M_name_messages != _S_get_c_name())
82        delete [] _M_name_messages;
83      _S_destroy_c_locale(_M_c_locale_messages); 
84    }
85
86  template<typename _CharT>
87    typename messages<_CharT>::catalog
88    messages<_CharT>::do_open(const basic_string<char>& __s, 
89                              const locale&) const
90    { 
91      // No error checking is done, assume the catalog exists and can
92      // be used.
93      __textdomain(__s.c_str());
94      return 0;
95    }
96
97  template<typename _CharT>
98    void   
99    messages<_CharT>::do_close(catalog) const 
100    { }
101
102   // messages_byname
103   template<typename _CharT>
104     messages_byname<_CharT>::messages_byname(const char* __s, size_t __refs)
105     : messages<_CharT>(__refs) 
106     { 
107       if (this->_M_name_messages != locale::facet::_S_get_c_name())
108         delete [] this->_M_name_messages;
109       char* __tmp = new char[std::strlen(__s) + 1];
110       std::strcpy(__tmp, __s);
111       this->_M_name_messages = __tmp;
112
113       if (std::strcmp(__s, "C") != 0 && std::strcmp(__s, "POSIX") != 0)
114         {
115           this->_S_destroy_c_locale(this->_M_c_locale_messages);
116           this->_S_create_c_locale(this->_M_c_locale_messages, __s); 
117         }
118     }
Note: See TracBrowser for help on using the repository browser.