move impl and fix todo

pull/14/head
Dimitri Diakopoulos 10 years ago
parent 0415228c34
commit 1de76c80a2

@ -79,16 +79,7 @@ private:
void BuildDecoderTable(); void BuildDecoderTable();
void AddDecoderToTable(std::shared_ptr<nqr::BaseDecoder> decoder) void AddDecoderToTable(std::shared_ptr<nqr::BaseDecoder> decoder);
{
auto supportedExtensions = decoder->GetSupportedFileExtensions();
//@todo: basic sanity checking that the extension isn't already supported
for (const auto ext : supportedExtensions)
{
decoderTable.insert(DecoderPair(ext, decoder));
}
}
std::map<std::string, std::shared_ptr<BaseDecoder>> decoderTable; std::map<std::string, std::shared_ptr<BaseDecoder>> decoderTable;

@ -126,6 +126,17 @@ std::shared_ptr<BaseDecoder> NyquistIO::GetDecoderForExtension(const std::string
return nullptr; return nullptr;
} }
void NyquistIO::AddDecoderToTable(std::shared_ptr<nqr::BaseDecoder> decoder)
{
auto supportedExtensions = decoder->GetSupportedFileExtensions();
for (const auto ext : supportedExtensions)
{
if (decoderTable.count(ext) >= 1) throw std::runtime_error("decoder already exists for extension.");
decoderTable.insert(DecoderPair(ext, decoder));
}
}
void NyquistIO::BuildDecoderTable() void NyquistIO::BuildDecoderTable()
{ {
AddDecoderToTable(std::make_shared<WavDecoder>()); AddDecoderToTable(std::make_shared<WavDecoder>());

Loading…
Cancel
Save