diff --git a/src/Plugins/TGAImporter/TGAImporter.cpp b/src/Plugins/TGAImporter/TGAImporter.cpp index 7d1574f72..f38c5162f 100644 --- a/src/Plugins/TGAImporter/TGAImporter.cpp +++ b/src/Plugins/TGAImporter/TGAImporter.cpp @@ -28,6 +28,13 @@ namespace Magnum { namespace Plugins { namespace TGAImporter { static_assert(sizeof(TGAImporter::Header) == 18, "TGAImporter: header size is not 18 bytes"); +bool TGAImporter::TGAImporter::open(const string& filename) { + ifstream in(filename.c_str()); + bool status = open(in); + in.close(); + return status; +} + bool TGAImporter::open(std::istream& in) { if(_image) close(); if(!in.good()) return false; diff --git a/src/Plugins/TGAImporter/TGAImporter.h b/src/Plugins/TGAImporter/TGAImporter.h index 40933ff48..80db81947 100644 --- a/src/Plugins/TGAImporter/TGAImporter.h +++ b/src/Plugins/TGAImporter/TGAImporter.h @@ -28,10 +28,12 @@ namespace Magnum { namespace Plugins { namespace TGAImporter { class TGAImporter: public AbstractImporter { public: TGAImporter(Corrade::PluginManager::AbstractPluginManager* manager = 0, const std::string& plugin = ""): AbstractImporter(manager, plugin) {} - inline virtual ~TGAImporter() { close(); } + inline int features() const { return OpenFile|OpenStream; } + bool open(std::istream& in); + bool open(const std::string& filename); void close(); inline size_t image2DCount() const { return _image ? 1 : 0; }