mirror of
https://github.com/boostorg/iostreams.git
synced 2026-02-27 05:02:29 +00:00
added strict_sync
[SVN r28194]
This commit is contained in:
@@ -53,6 +53,7 @@ public: // stream_facade needs access.
|
||||
void close();
|
||||
bool auto_close() const { return auto_close_; }
|
||||
void set_auto_close(bool close) { auto_close_ = close; }
|
||||
bool strict_sync() { return true; }
|
||||
|
||||
// Declared in linked_streambuf.
|
||||
T* component() { return storage_.get_ptr(); }
|
||||
|
||||
@@ -63,6 +63,7 @@ public:
|
||||
void close();
|
||||
bool auto_close() const;
|
||||
void set_auto_close(bool close);
|
||||
bool strict_sync();
|
||||
|
||||
// Declared in linked_streambuf.
|
||||
T* component() { return &*obj(); }
|
||||
@@ -356,10 +357,20 @@ int indirect_streambuf<T, Tr, Alloc, Mode>::sync()
|
||||
{
|
||||
try { // sync() is no-throw.
|
||||
sync_impl();
|
||||
return obj().flush(next_) ? 0 : -1;
|
||||
obj().flush(next_);
|
||||
return 0;
|
||||
} catch (std::exception&) { return -1; }
|
||||
}
|
||||
|
||||
template<typename T, typename Tr, typename Alloc, typename Mode>
|
||||
bool indirect_streambuf<T, Tr, Alloc, Mode>::strict_sync()
|
||||
{
|
||||
try { // sync() is no-throw.
|
||||
sync_impl();
|
||||
return obj().flush(next_);
|
||||
} catch (std::exception&) { return false; }
|
||||
}
|
||||
|
||||
template<typename T, typename Tr, typename Alloc, typename Mode>
|
||||
inline typename indirect_streambuf<T, Tr, Alloc, Mode>::pos_type
|
||||
indirect_streambuf<T, Tr, Alloc, Mode>::seekoff
|
||||
|
||||
Reference in New Issue
Block a user