35 : m_Description(other.m_Description),
36 m_Ranking(other.m_Ranking),
37 m_MimeTypePrefix(other.m_MimeTypePrefix),
38 m_Options(other.m_Options),
39 m_DefaultOptions(other.m_DefaultOptions),
40 m_CustomMimeType(other.m_CustomMimeType->
Clone())
53 Options::const_iterator iter =
m_Options.find(name);
68 for (
const auto &option : options)
70 this->
SetOption(option.first, option.second);
78 MITK_WARN <<
"Ignoring unknown IFileReader option '" << name <<
"'";
124 if (!rankProp.
Empty())
155 throw std::invalid_argument(
"The context argument must not be NULL.");
159 const std::vector<std::string> extensions =
m_CustomMimeType->GetExtensions();
166 if (!mimeTypeProvider->GetMimeTypeForName(
m_CustomMimeType->GetName()).IsValid())
176 MITK_WARN <<
"Trying to register a MITK reader or writer with an empty mime type name and empty extension list.";
206 catch (
const std::logic_error &)
us::ServiceRegistration< CustomMimeType > RegisterMimeType(us::ModuleContext *context)
void SetDefaultOptions(const Options &defaultOptions)
Options GetOptions() const
static IMimeTypeProvider * GetMimeTypeProvider(us::ModuleContext *context=us::GetModuleContext())
Get an IMimeTypeProvider instance.
US_Core_EXPORT const std::string & SERVICE_RANKING()
virtual const char * what() const override
void RemoveProgressCallback(const ProgressCallback &callback)
std::string GetDescription() const
std::string GetMimeTypePrefix() const
void SetRanking(int ranking)
Set the service ranking for this file reader.
Options GetDefaultOptions() const
DataCollection - Class to facilitate loading/accessing structured data.
ValueType * any_cast(Any *operand)
std::string m_MimeTypePrefix
void UnregisterMimeType()
us::ServiceRegistration< CustomMimeType > m_MimeTypeReg
void SetMimeTypePrefix(const std::string &prefix)
void SetDescription(const std::string &description)
The CustomMimeType class represents a custom mime-type which may be registered as a service object...
void SetOptions(const Options &options)
virtual CustomMimeType * Clone() const
virtual ~FileReaderWriterBase()
void SetOption(const std::string &name, const us::Any &value)
Message1< float > m_ProgressMessage
The MimeType class represens a registered mime-type. It is an immutable wrapper for mitk::CustomMimeT...
std::map< std::string, us::Any > Options
us::Any GetOption(const std::string &name) const
const CustomMimeType * GetMimeType() const
Options m_Options
Options supported by this reader. Set sensible default values!
MimeType GetRegisteredMimeType() const
A RAII helper class for core service objects.
std::string m_Description
US_Core_EXPORT const std::string & SERVICE_ID()
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.
void SetMimeType(const CustomMimeType &mimeType)
std::unique_ptr< CustomMimeType > m_CustomMimeType
void AddProgressCallback(const ProgressCallback &callback)