decoder/Plugin: simplify compile-time initialization
Add a `constexpr` constructor and several `constexpr` methods to construct a DecoderPlugin at compile time, in a way which allows adding new methods later without having to edit each plugin.
This commit is contained in:
@@ -324,15 +324,8 @@ static const char *const gme_suffixes[] = {
|
||||
nullptr
|
||||
};
|
||||
|
||||
const struct DecoderPlugin gme_decoder_plugin = {
|
||||
"gme",
|
||||
gme_plugin_init,
|
||||
nullptr,
|
||||
nullptr,
|
||||
gme_file_decode,
|
||||
gme_scan_file,
|
||||
nullptr,
|
||||
gme_container_scan,
|
||||
gme_suffixes,
|
||||
nullptr,
|
||||
};
|
||||
constexpr DecoderPlugin gme_decoder_plugin =
|
||||
DecoderPlugin("gme", gme_file_decode, gme_scan_file)
|
||||
.WithInit(gme_plugin_init)
|
||||
.WithContainer(gme_container_scan)
|
||||
.WithSuffixes(gme_suffixes);
|
||||
|
Reference in New Issue
Block a user