libstdc++
|
00001 // filebuf with encoding state type -*- C++ -*- 00002 00003 // Copyright (C) 2002, 2003, 2004, 2007, 2009 Free Software Foundation, Inc. 00004 // 00005 // This file is part of the GNU ISO C++ Library. This library is free 00006 // software; you can redistribute it and/or modify it under the 00007 // terms of the GNU General Public License as published by the 00008 // Free Software Foundation; either version 3, or (at your option) 00009 // any later version. 00010 00011 // This library is distributed in the hope that it will be useful, 00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 // GNU General Public License for more details. 00015 00016 // Under Section 7 of GPL version 3, you are granted additional 00017 // permissions described in the GCC Runtime Library Exception, version 00018 // 3.1, as published by the Free Software Foundation. 00019 00020 // You should have received a copy of the GNU General Public License and 00021 // a copy of the GCC Runtime Library Exception along with this program; 00022 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 00023 // <http://www.gnu.org/licenses/>. 00024 00025 /** @file ext/enc_filebuf.h 00026 * This file is a GNU extension to the Standard C++ Library. 00027 */ 00028 00029 #ifndef _EXT_ENC_FILEBUF_H 00030 #define _EXT_ENC_FILEBUF_H 1 00031 00032 #include <fstream> 00033 #include <locale> 00034 #include <ext/codecvt_specializations.h> 00035 00036 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default) 00037 { 00038 _GLIBCXX_BEGIN_NAMESPACE_VERSION 00039 00040 /// class enc_filebuf. 00041 template<typename _CharT> 00042 class enc_filebuf 00043 : public std::basic_filebuf<_CharT, encoding_char_traits<_CharT> > 00044 { 00045 public: 00046 typedef encoding_char_traits<_CharT> traits_type; 00047 typedef typename traits_type::state_type state_type; 00048 typedef typename traits_type::pos_type pos_type; 00049 00050 enc_filebuf(state_type& __state) 00051 : std::basic_filebuf<_CharT, encoding_char_traits<_CharT> >() 00052 { this->_M_state_beg = __state; } 00053 00054 private: 00055 // concept requirements: 00056 // Set state type to something useful. 00057 // Something more than copyconstructible is needed here, so 00058 // require default and copy constructible + assignment operator. 00059 __glibcxx_class_requires(state_type, _SGIAssignableConcept) 00060 }; 00061 00062 _GLIBCXX_END_NAMESPACE_VERSION 00063 } // namespace 00064 00065 #endif