#ifndef TINYSTL_STREAMBUF
#define TINYSTL_STREAMBUF

namespace std {
  
  // TODO: correct here?
  typedef int int_type;

  class basic_streambuf
  {
  public:
    typedef char char_type;
    typedef std::int_type int_type;
    
    char_type* eback () const {
      return in_beg;
    }
    
    char_type* gptr ()  const {
      return in_cur;
    }
    
    char_type* egptr () const {
      return in_end;
    }
    
    void gbump (int n) {
      in_cur += n;
    }
    
    void setg (char_type* gbeg, char_type* gnext, char_type* gend)
    {
      in_beg = gbeg;
      in_cur = gnext;
      in_end = gend;
    }
    
    // --

    char_type* pbase() const {
      return out_beg;
    }
    
    char_type* pptr() const {
      return out_cur;
    }
    
    char_type* epptr() const {
      return out_end;
    }
    
    void pbump (int n) {
      out_cur += n;
    }
    #ifdef ME
    void setp (char_type* pbeg, char_type* pend)
    {
      out_beg = out_cur = pbeg;
      out_end = pend;
    }

    // -- 
    
    std::int_type sputc (int_type c) {
    }
    
    std::streamsize sputn (const char* s, std::streamsize num) {
      // xsputn ();
    }
    
    virtual int_type overflow (int_type c) {
      return EOF;
    }
    
    virtual std::streamsize xsputn (const char* s, std::streamsize num) {
      return num;
    }
#endif
    
  private:
    char_type * in_beg, * in_cur, * in_end;
    char_type * out_beg, * out_cur, * out_end;
    
  };
  
  typedef basic_streambuf streambuf;
}

#endif
