]> git.tdb.fi Git - libs/gui.git/commitdiff
Add a function to detect image signature without creating a loader
authorMikko Rasa <tdb@tdb.fi>
Tue, 2 Nov 2021 09:56:23 +0000 (11:56 +0200)
committerMikko Rasa <tdb@tdb.fi>
Tue, 2 Nov 2021 09:56:23 +0000 (11:56 +0200)
source/graphics/imageloader.cpp
source/graphics/imageloader.h

index d2d3ef9234a470c1c81b08a934939289f9ce41f1..859a34c12894a1a0460b439e230a0fe9154d1385 100644 (file)
@@ -32,6 +32,15 @@ ImageLoader::~ImageLoader()
        delete source;
 }
 
+bool ImageLoader::detect_signature(const std::string &sig)
+{
+       Registry &registry = get_registry();
+       for(list<RegisterBase *>::const_iterator i=registry.loaders.begin(); i!=registry.loaders.end(); ++i)
+               if((*i)->detect(sig))
+                       return true;
+       return false;
+}
+
 ImageLoader *ImageLoader::open_file(const string &fn)
 {
        try
index 1ad6cc8c895aad812264df8663920cd6a56f6528..fbfd4d66e0c3c647c5c2171d03da04d4ccc1848d 100644 (file)
@@ -71,6 +71,7 @@ protected:
 public:
        virtual ~ImageLoader();
 
+       static bool detect_signature(const std::string &);
        static ImageLoader *open_file(const std::string &);
        static ImageLoader *open_io(IO::Seekable &);