From 07f5a2245d7c15dfb6d716e307d2618a498886d9 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Fri, 2 Aug 2013 10:28:37 +0200 Subject: Switching Handle's readU8() to be a Future, and using it in SimpleMustache. --- src/Handle.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/Handle.cc') diff --git a/src/Handle.cc b/src/Handle.cc index 67eb412..361561a 100644 --- a/src/Handle.cc +++ b/src/Handle.cc @@ -94,6 +94,18 @@ ssize_t Balau::Handle::forceWrite(const void * _buf, size_t count, Events::BaseE return total; } +Balau::Future Balau::Handle::readU8() { + IO t(this); + auto func = [t]() mutable -> uint8_t { + uint8_t r; + t->read(&r, 1); + return r; + }; + Future r; + r.m_run = func; + return r; +} + void Balau::Handle::rseek(off_t offset, int whence) throw (GeneralException) { if (canSeek()) throw GeneralException(String("Handle ") + getName() + " can seek, but rseek() not implemented (missing in class " + ClassName(this).c_str() + ")"); -- cgit v1.2.3