file_stream.h 978 Bytes
Newer Older
1
// Copyright (C) 2007-2018 Samuel Newbold
2

Samuel Newbold's avatar
Samuel Newbold committed
3
class File_istream : public Rwsh_istream {
4 5 6 7
  std::string name;

  void open(void);
 public:
Samuel Newbold's avatar
Samuel Newbold committed
8 9 10
  File_istream(const std::string& name_i);
  ~File_istream();
  virtual Rwsh_istream* copy_pointer() {return new File_istream(name);};
11
  virtual Rwsh_istream& getline(std::string& dest);
12
  virtual int fd(void);
13
  virtual std::string str(void) const;};
14

Samuel Newbold's avatar
Samuel Newbold committed
15
class File_ostream : public Rwsh_ostream {
16
  std::string name;
17
  FILE* c_style;
18 19

  void open(void);
20
 public:
Samuel Newbold's avatar
Samuel Newbold committed
21 22 23 24 25 26 27 28
  File_ostream(const std::string& name_i);
  ~File_ostream();
  virtual Rwsh_ostream* copy_pointer() {return new File_ostream(name);};
  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);
29
  virtual int fd(void);
30 31
  virtual void flush(void);
  virtual std::string str(void) const;};