27 #include <libopenraw/debug.h>
29 #include "rawfile.hpp"
30 #include "rawfilefactory.hpp"
33 using namespace Debug;
42 RawFileFactory::Table &RawFileFactory::table_mut()
45 static Table rawFactoryTable;
46 return rawFactoryTable;
49 RawFileFactory::Extensions &RawFileFactory::extensions_mut()
52 static Extensions rawExtensionsTable;
53 return rawExtensionsTable;
57 const RawFileFactory::raw_file_factory_t &fn,
61 LOGERR(
"NULL fn for registerFactory()\n");
62 assert(fn ==
nullptr);
64 table_mut()[type] = fn;
65 extensions_mut()[ext] = type;
70 Table::iterator iter = table_mut().find(type);
71 if (iter == table().end()) {
72 LOGERR(
"attempting to unregisterFactory() in unregistered element\n");
75 table_mut().erase(iter);
78 const char **RawFileFactory::fileExtensions()
80 static const char **_fileExtensions = NULL;
81 if (!_fileExtensions) {
82 const auto& ext = extensions();
83 size_t s = ext.size();
84 _fileExtensions = (
const char **)calloc((s + 1),
sizeof(
char *));
85 const char **current = _fileExtensions;
86 Extensions::const_iterator iter(ext.begin());
87 for (; iter != ext.end(); ++iter) {
88 *current = iter->first.c_str();
93 return _fileExtensions;
or_rawfile_type
Types of RAW files.
Global namespace for libopenraw.