#include <cstring>
+#include <stdexcept>
#include "buffered.h"
-#include "except.h"
+#include "handle.h"
using namespace std;
delete[] buf;
}
+void Buffered::set_block(bool)
+{
+ throw logic_error("Buffered::set_block");
+}
+
+void Buffered::set_inherit(bool)
+{
+ throw logic_error("Buffered::set_block");
+}
+
void Buffered::flush()
{
if(cur_op==M_WRITE)
{
unsigned len = below.write(begin, used);
- begin=end = buf;
+ begin = end = buf;
if(len<used)
- throw Exception("Couldn't flush all data");
+ throw runtime_error("Couldn't flush all data");
}
}
else if(cur_op==M_READ)
- begin=end = buf;
+ begin = end = buf;
}
unsigned Buffered::do_write(const char *data, unsigned size)
// Give out whatever is in the buffer already
memcpy(data, begin, end-begin);
unsigned ret = end-begin;
- begin=end = buf;
+ begin = end = buf;
data += ret;
size -= ret;
return static_cast<unsigned char>(c);
}
+const Handle &Buffered::get_handle(Mode)
+{
+ throw logic_error("Buffered::get_handle");
+}
+
void Buffered::set_op(Mode op)
{
if(op!=cur_op)
return end-begin;
}
-Handle Buffered::get_event_handle()
-{
- throw Exception("Buffered doesn't support events");
-}
-
} // namespace IO
} // namespace Msp