X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=inline;f=source%2Fbuffered.h;h=9142a47e60f776e8f5a678bb2cb643b3101831d7;hb=49c1f3c3ffdf318579a809f3f800442c0c76c818;hp=b6584c1c23e289ce1d974cf02c0a247cf4f52f38;hpb=c0861d1f8e3869f058bc8b152cd35a08e5b03e73;p=libs%2Fcore.git diff --git a/source/buffered.h b/source/buffered.h index b6584c1..9142a47 100644 --- a/source/buffered.h +++ b/source/buffered.h @@ -1,9 +1,3 @@ -/* $Id$ - -This file is part of libmspio -Copyright © 2007 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ #ifndef MSP_IO_BUFFERED_H_ #define MSP_IO_BUFFERED_H_ @@ -14,25 +8,28 @@ namespace IO { class Buffered: public Base { +private: + Base &below; + unsigned buf_size; + char *buf; + char *begin; + char *end; + Mode cur_op; + public: Buffered(Base &, unsigned =8192); + ~Buffered(); + unsigned put(char); void flush(); bool getline(std::string &); int get(); - int tell() const; Handle get_event_handle(); - ~Buffered(); + Mode get_current_op() const { return cur_op; } + unsigned get_current_size() const; private: - Base &below; - unsigned buf_size; - char *in_buf; - char *in_ptr; - unsigned in_avail; - char *out_buf; - unsigned out_used; - - void below_closing(); + void set_op(Mode); +protected: unsigned do_write(const char *, unsigned); unsigned do_read(char *, unsigned); };