]> git.tdb.fi Git - libs/core.git/blobdiff - source/io/buffered.h
Add move semantics to Variant
[libs/core.git] / source / io / buffered.h
index 095be0f01625eaac5672278a7f20ae724268b227..c05fc25eed5ad9454448d34f60a716ed091d56cb 100644 (file)
@@ -1,41 +1,48 @@
 #ifndef MSP_IO_BUFFERED_H_
 #define MSP_IO_BUFFERED_H_
 
+#include <sigc++/trackable.h>
+#include <msp/core/mspcore_api.h>
 #include "base.h"
 
 namespace Msp {
 namespace IO {
 
-class Buffered: public Base
+class MSPCORE_API Buffered: public Base, public sigc::trackable
 {
 private:
        Base &below;
-       unsigned buf_size;
-       char *buf;
-       char *begin;
-       char *end;
-       Mode cur_op;
+       std::size_t buf_size = 0;
+       char *buf = nullptr;
+       char *begin = nullptr;
+       char *end = nullptr;
+       Mode cur_op = M_NONE;
 
 public:
-       Buffered(Base &, unsigned =8192);
+       Buffered(Base &, unsigned = 8192);
        ~Buffered();
 
+       void set_block(bool) override;
+       void set_inherit(bool) override;
+
        void flush();
 
 protected:
-       unsigned do_write(const char *, unsigned);
-       unsigned do_read(char *, unsigned);
+       std::size_t do_write(const char *, std::size_t) override;
+       std::size_t do_read(char *, std::size_t) override;
 public:
-       unsigned put(char);
+       std::size_t put(char) override;
+
+       bool getline(std::string &) override;
+       int get() override;
 
-       bool getline(std::string &);
-       int get();
+       const Handle &get_handle(Mode) override;
 
 private:
        void set_op(Mode);
 public:
        Mode get_current_op() const { return cur_op; }
-       unsigned get_current_size() const;
+       std::size_t get_current_size() const;
 };
 
 } // namespace IO