NRE_InputStream.hpp
Go to the documentation of this file.
1 
10  #pragma once
11 
12  #include <fstream>
13 
14  #include <Header/NRE_Utility.hpp>
15 
20  namespace NRE {
25  namespace IO {
26 
31  class InputStream {
32  public: // Methods
33  //## Constructor ##//
37  InputStream() = default;
38 
39  //## Copy-Constructor ##//
44  InputStream(InputStream const& i) = delete;
45 
46  //## Move-Constructor ##//
51  InputStream(InputStream && i) = default;
52 
53  //## Deconstructor ##//
57  virtual ~InputStream() = default;
58 
59  //## Getter ##//
63  virtual std::fstream& getStream() = 0;
67  std::streampos getPosition();
68 
69  //## Methods ##//
74  template <class T>
75  void read(T& object) {
76  getStream() >> object;
77  }
82  void readLine(Utility::String& line);
87  void seekBegin(size_t offset = 0);
92  void seekEnd(size_t offset = 0);
93 
94  //## Assignment Operator ##//
100  InputStream& operator =(InputStream const& i) = delete;
106  InputStream& operator =(InputStream && i) = default;
107  };
108  }
109  }
110 
111  #include "NRE_InputStream.tpp"
virtual ~InputStream()=default
std::streampos getPosition()
IO&#39;s API.
virtual std::fstream & getStream()=0
void readLine(Utility::String &line)
void seekBegin(size_t offset=0)
The NearlyRealEngine&#39;s global namespace.
void seekEnd(size_t offset=0)
Base interface for input related stream.
Definition: NRE_InputStream.hpp:31
InputStream & operator=(InputStream const &i)=delete
void read(T &object)
Definition: NRE_InputStream.hpp:75