substitution_stream.h 788 Bytes
Newer Older
1 2
// Copyright (C) 2007 Samuel Newbold

Samuel Newbold's avatar
Samuel Newbold committed
3
class Substitution_stream : public Rwsh_ostream {
4
  std::ostringstream buffer;
5
  Pipe_istream in_pipe;
6 7

 public:
8 9
  Substitution_stream(void) : Rwsh_ostream(-1), in_pipe(-1) {};
  virtual ~Substitution_stream(void) {};
Samuel Newbold's avatar
Samuel Newbold committed
10 11 12 13 14 15
  virtual Rwsh_ostream* copy_pointer(void);
  virtual Rwsh_ostream& operator<<(const std::string& r);
  virtual Rwsh_ostream& operator<<(int r);
  virtual Rwsh_ostream& operator<<(unsigned int r);
  virtual Rwsh_ostream& operator<<(double r);
  virtual Rwsh_ostream& operator<<(struct timeval r);
16
  virtual int fd(void);
17 18
  virtual void flush(void) {};
  virtual std::string str(void) const;
19

20
  Rwsh_ostream_p child_stream(void) {return Rwsh_ostream_p(this, true, false);};
21
  std::string value(void) const {return buffer.str();}; };