OSDN Git Service

2004-06-14 Paolo Carlini <pcarlini@suse.de>
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / include / ext / enc_filebuf.h
index e1152bd..39f4ef7 100644 (file)
@@ -1,6 +1,6 @@
-// __enc_traits layer for filebuf -*- C++ -*-
+// filebuf with __enc_traits state type -*- C++ -*-
 
-// Copyright (C) 2002 Free Software Foundation, Inc.
+// Copyright (C) 2002, 2003 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
 
 namespace __gnu_cxx
 {
-  // Custom traits type with __enc_traits for state type, all other bits
-  // equivalent to the required char_traits instantiations.
+  // Custom traits type with __enc_traits for the state type, and the
+  // associated fpos<__enc_traits> for the position type, all other
+  // bits equivalent to the required char_traits instantiations.
   template<typename _CharT>
     struct enc_char_traits: public std::char_traits<_CharT>
     {
-      typedef std::__enc_traits        state_type;
+      typedef std::__enc_traits                        state_type;
+      typedef typename std::fpos<state_type>   pos_type;
     };
 
   template<typename _CharT>
@@ -45,17 +47,22 @@ namespace __gnu_cxx
     : public std::basic_filebuf<_CharT, enc_char_traits<_CharT> >
     {
     public:
-      typedef typename enc_char_traits<_CharT>::state_type state_type;
-      
+      typedef enc_char_traits<_CharT>          traits_type;
+      typedef typename traits_type::state_type state_type;
+      typedef typename traits_type::pos_type   pos_type;
+
       enc_filebuf(state_type& __state)
       : std::basic_filebuf<_CharT, enc_char_traits<_CharT> >()
-      { 
-       // Set state type to something useful.
-       // Something more than copyconstructible is needed here, so
-       // require copyconstructible + assignment operator.
-       __glibcpp_class_requires(state_type, _SGIAssignableConcept);
-       _M_state_cur = __state;
-       _M_state_cur._M_init();
-      };
+      {
+       this->_M_state_beg = __state;
+       this->_M_state_beg._M_init();
+      }
+
+    private:
+      // concept requirements:
+      // Set state type to something useful.
+      // Something more than copyconstructible is needed here, so
+      // require default and copy constructible + assignment operator.
+      __glibcxx_class_requires(state_type, _SGIAssignableConcept)
     };
 } // namespace __gnu_cxx