QSFML
qresourcestream.hpp
Go to the documentation of this file.
1 /* =========================================================== *
2  * QSFML (c) Kamil Koczurek | koczurekk@gmail.com *
3  * GNU GPL v3 License http://www.gnu.org/licenses/gpl-3.0.html *
4  * =========================================================== */
7 
8 #ifndef QRESOURCESTREAM_H
9 #define QRESOURCESTREAM_H
10 
11 #include <SFML/System/InputStream.hpp>
12 #include <ostream>
13 #include <QFile>
14 
15 namespace qsf {
22  : public sf::InputStream {
23  public:
28 
33 
41  bool open(const char* path);
42 
49  virtual sf::Int64 read(void* data, sf::Int64 size);
50 
56  virtual sf::Int64 seek(sf::Int64 position);
57 
61  virtual sf::Int64 tell();
62 
66  virtual sf::Int64 getSize();
67 
85  QResourceStream & operator()(const char* path);
86 
99  friend std::ostream& operator <<(std::ostream& out, QResourceStream& resource);
100 
113  friend QDebug operator <<(QDebug out, const QResourceStream& resource);
114 
115  private:
116  void * dat;
117  sf::Int64 pos;
118  sf::Int64 size;
119  };
120 }
121 #endif // QRESOURCESTREAM_H
virtual sf::Int64 tell()
Returns cursor&#39;s position.
Definition: qresourcestream.cpp:56
virtual sf::Int64 seek(sf::Int64 position)
Sets new cursor&#39;s position.
Definition: qresourcestream.cpp:52
bool open(const char *path)
Opens file.
Definition: qresourcestream.cpp:19
Namespace containing all qsf classes and methods.
Definition: Image.cpp:3
QResourceStream & operator()(const char *path)
Open a file using operator()
Definition: qresourcestream.cpp:63
virtual sf::Int64 read(void *data, sf::Int64 size)
Reads parts of resource.
Definition: qresourcestream.cpp:44
sf::InputStream reading QResource files
Definition: qresourcestream.hpp:21
~QResourceStream()
Destructor.
Definition: qresourcestream.cpp:14
virtual sf::Int64 getSize()
Returns file size.
Definition: qresourcestream.cpp:59
QResourceStream()
Default constructor.
Definition: qresourcestream.cpp:10
friend std::ostream & operator<<(std::ostream &out, QResourceStream &resource)
Prints whole file (std::ostream)
Definition: qresourcestream.cpp:68