diff options
-rw-r--r-- | quackleio/gcgio.cpp | 18 | ||||
-rw-r--r-- | quackleio/gcgio.h | 1 |
2 files changed, 19 insertions, 0 deletions
diff --git a/quackleio/gcgio.cpp b/quackleio/gcgio.cpp index cafbf49..30fac0f 100644 --- a/quackleio/gcgio.cpp +++ b/quackleio/gcgio.cpp @@ -30,6 +30,24 @@ GCGIO::GCGIO() { } +Quackle::Game *GCGIO::read(const QString &filename, int flags) +{ + QFile file(filename); + Quackle::Game *ret = new Quackle::Game; + + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) + { + UVcerr << "Could not open gcg " << QuackleIO::Util::qstringToString(filename) << endl; + return ret; + } + + QTextStream in(&file); + ret = read(in, flags); + file.close(); + + return ret; +} + Quackle::Game *GCGIO::read(QTextStream &stream, int flags) { Quackle::Game *ret = new Quackle::Game; diff --git a/quackleio/gcgio.h b/quackleio/gcgio.h index 477f84f..a219c9f 100644 --- a/quackleio/gcgio.h +++ b/quackleio/gcgio.h @@ -30,6 +30,7 @@ public: GCGIO(); ~GCGIO() {}; + virtual Quackle::Game *read(const QString &filename, int flags); virtual Quackle::Game *read(QTextStream &stream, int flags); virtual bool canRead(QTextStream &stream) const; virtual void write(const Quackle::Game &game, QTextStream &stream); |