Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r63039 - trunk/boost/iostreams/device
From: steven_at_[hidden]
Date: 2010-06-17 11:19:33


Author: steven_watanabe
Date: 2010-06-17 11:19:32 EDT (Thu, 17 Jun 2010)
New Revision: 63039
URL: http://svn.boost.org/trac/boost/changeset/63039

Log:
Make basic_file and basic_file_sync Flushable. Fixes #2998.
Text files modified:
   trunk/boost/iostreams/device/file.hpp | 12 ++++++++++--
   1 files changed, 10 insertions(+), 2 deletions(-)

Modified: trunk/boost/iostreams/device/file.hpp
==============================================================================
--- trunk/boost/iostreams/device/file.hpp (original)
+++ trunk/boost/iostreams/device/file.hpp 2010-06-17 11:19:32 EDT (Thu, 17 Jun 2010)
@@ -35,7 +35,8 @@
     struct category
         : public seekable_device_tag,
           public closable_tag,
- public localizable_tag
+ public localizable_tag,
+ public flushable_tag
         { };
     basic_file( const std::string& path,
                 BOOST_IOS::openmode mode =
@@ -55,6 +56,7 @@
                    BOOST_IOS::in | BOOST_IOS::out );
     bool is_open() const;
     void close();
+ bool flush();
 #ifndef BOOST_IOSTREAMS_NO_LOCALE
     void imbue(const std::locale& loc) { pimpl_->file_.pubimbue(loc); }
 #endif
@@ -105,12 +107,14 @@
     struct category
         : output_seekable,
           device_tag,
- closable_tag
+ closable_tag,
+ flushable_tag
         { };
     using basic_file<Ch>::write;
     using basic_file<Ch>::seek;
     using basic_file<Ch>::is_open;
     using basic_file<Ch>::close;
+ using basic_file<Ch>::flush;
     basic_file_sink( const std::string& path,
                      BOOST_IOS::openmode mode = BOOST_IOS::out )
         : basic_file<Ch>(path, mode & ~BOOST_IOS::in, BOOST_IOS::out)
@@ -174,6 +178,10 @@
 template<typename Ch>
 void basic_file<Ch>::close() { pimpl_->file_.close(); }
 
+template<typename Ch>
+bool basic_file<Ch>::flush()
+{ return pimpl_->file_.BOOST_IOSTREAMS_PUBSYNC() == 0; }
+
 //----------------------------------------------------------------------------//
 
 } } // End namespaces iostreams, boost.


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk