summaryrefslogtreecommitdiffstats
path: root/src/extension/find_extension_by_mime.h
diff options
context:
space:
mode:
authorShlomi Fish <shlomif@shlomifish.org>2017-01-04 01:32:40 +0000
committerShlomi Fish <shlomif@shlomifish.org>2017-01-04 01:32:40 +0000
commitbfcc1fb5a5142a71469834cac2d507f15626a8b5 (patch)
treed18131ceb84bddf14eb6011dd3ae16e560af04e3 /src/extension/find_extension_by_mime.h
parentRename id in comment to make it more according to the code. (diff)
downloadinkscape-bfcc1fb5a5142a71469834cac2d507f15626a8b5.tar.gz
inkscape-bfcc1fb5a5142a71469834cac2d507f15626a8b5.zip
Extract some common code into a routine.
(bzr r15369.1.8)
Diffstat (limited to 'src/extension/find_extension_by_mime.h')
-rw-r--r--src/extension/find_extension_by_mime.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/extension/find_extension_by_mime.h b/src/extension/find_extension_by_mime.h
new file mode 100644
index 000000000..1686c62e4
--- /dev/null
+++ b/src/extension/find_extension_by_mime.h
@@ -0,0 +1,36 @@
+/**
+ * @file
+ * Find an extension by its mime type.
+ */
+/* Authors:
+ * Lauris Kaplinski <lauris@kaplinski.com>
+ * Frank Felfe <innerspace@iname.com>
+ * bulia byak <buliabyak@users.sf.net>
+ * Jon A. Cruz <jon@joncruz.org>
+ * Abhishek Sharma
+ * Kris De Gussem <Kris.DeGussem@gmail.com>
+ *
+ * Copyright (C) 2012 Kris De Gussem
+ * Copyright (C) 2010 authors
+ * Copyright (C) 1999-2005 authors
+ * Copyright (C) 2004 David Turner
+ * Copyright (C) 2001-2002 Ximian, Inc.
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+namespace Inkscape {
+namespace Extension {
+static inline Inkscape::Extension::Extension *find_by_mime(const char *const mime)
+{
+
+ Inkscape::Extension::DB::InputList o;
+ Inkscape::Extension::db.get_input_list(o);
+ Inkscape::Extension::DB::InputList::const_iterator i = o.begin();
+ while (i != o.end() && strcmp((*i)->get_mimetype(), mime) != 0) {
+ ++i;
+ }
+ return *i;
+}
+}
+}