20 #include <itksys/SystemTools.hxx> 23 #pragma warning(disable : 4503) // decorated name length exceeded, name was truncated 24 #pragma warning(disable : 4355) 33 if (m_Tracker ==
nullptr)
43 std::vector<MimeType> result;
44 for (
const auto &elem : m_NameToMimeType)
46 result.push_back(elem.second);
53 std::vector<MimeType> result;
54 for (
const auto &elem : m_NameToMimeType)
56 if (elem.second.AppliesTo(filePath))
58 result.push_back(elem.second);
61 std::sort(result.begin(), result.end());
62 std::reverse(result.begin(), result.end());
68 std::vector<MimeType> result;
69 for (
const auto &elem : m_NameToMimeType)
71 if (elem.second.GetCategory() == category)
73 result.push_back(elem.second);
81 auto iter = m_NameToMimeType.find(name);
82 if (iter != m_NameToMimeType.end())
89 std::vector<std::string> result;
90 for (
const auto &elem : m_NameToMimeType)
92 std::string category = elem.second.GetCategory();
93 if (!category.empty())
95 result.push_back(category);
98 std::sort(result.begin(), result.end());
99 result.erase(std::unique(result.begin(), result.end()), result.end());
105 MimeType result = this->GetMimeType(reference);
108 std::string name = result.
GetName();
109 m_NameToMimeTypes[name].insert(result);
112 m_NameToMimeType[name] = *(m_NameToMimeTypes[name].rbegin());
124 std::string name = mimeType.
GetName();
125 std::set<MimeType> &mimeTypes = m_NameToMimeTypes[name];
126 mimeTypes.erase(mimeType);
127 if (mimeTypes.empty())
129 m_NameToMimeTypes.erase(name);
130 m_NameToMimeType.erase(name);
135 m_NameToMimeType[name] = *(mimeTypes.rbegin());
146 if (mimeType !=
nullptr)
152 if (!rankProp.
Empty())
157 result =
MimeType(*mimeType, rank,
id);
US_Core_EXPORT const std::string & SERVICE_RANKING()
bool UngetService(const ServiceReferenceBase &reference)
DataCollection - Class to facilitate loading/accessing structured data.
ValueType * any_cast(Any *operand)
ServiceReference< ServiceType > ServiceReferenceType
std::string GetName() const
void * GetService(const ServiceReferenceBase &reference)
MimeType GetMimeTypeForName(const std::string &name) const override
const char * what() const override
The CustomMimeType class represents a custom mime-type which may be registered as a service object...
~MimeTypeProvider() override
std::vector< MimeType > GetMimeTypesForFile(const std::string &filePath) const override
std::vector< MimeType > GetMimeTypes() const override
The MimeType class represens a registered mime-type. It is an immutable wrapper for mitk::CustomMimeT...
US_Core_EXPORT const std::string & SERVICE_ID()
std::vector< std::string > GetCategories() const override
Get a sorted and unique list of mime-type categories.
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.
std::vector< MimeType > GetMimeTypesForCategory(const std::string &category) const override