Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkMimeType.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkMimeType_h
14 #define mitkMimeType_h
15 
16 #include <MitkCoreExports.h>
17 
18 #include <usSharedData.h>
19 
20 #include <vector>
21 
22 namespace mitk
23 {
24  class CustomMimeType;
25 
45  {
46  public:
51 
56  MimeType(const MimeType &other);
57 
64  MimeType(const CustomMimeType &x, int rank, long id);
65 
67 
73  MimeType &operator=(const MimeType &other);
74 
80  bool operator==(const MimeType &other) const;
81 
87  bool operator<(const MimeType &other) const;
88 
94  std::string GetName() const;
95 
101  std::string GetCategory() const;
102 
108  std::vector<std::string> GetExtensions() const;
109 
115  std::string GetComment() const;
116 
123  std::string GetFilenameWithoutExtension(const std::string &path) const;
124 
131  bool AppliesTo(const std::string &path) const;
132 
139  bool MatchesExtension(const std::string &path) const;
140 
145  bool IsValid() const;
146 
151  void Swap(MimeType &m);
152 
153  private:
154  struct Impl;
155 
156  // Use C++11 shared_ptr instead
158  };
159 
166 
173  MITKCORE_EXPORT std::ostream &operator<<(std::ostream &os, const MimeType &mimeType);
174 }
175 
176 #endif
#define MITKCORE_EXPORT
A custom mime-type that can be registered as a service object.
Immutable, value-type wrapper for a registered mime-type.
Definition: mitkMimeType.h:45
std::string GetName() const
Get the unique name of this mime-type.
std::string GetComment() const
Get a human-readable comment describing this mime-type.
bool MatchesExtension(const std::string &path) const
Check whether the extension of the given path matches this mime-type.
bool IsValid() const
Check whether this MimeType object is valid (has a non-empty name).
MimeType()
Construct a default (invalid) MimeType.
std::string GetFilenameWithoutExtension(const std::string &path) const
Extract the filename without the matching extension from a path.
void Swap(MimeType &m)
Swap the contents of this MimeType with another.
MimeType & operator=(const MimeType &other)
Copy assignment operator.
MimeType(const CustomMimeType &x, int rank, long id)
Construct a MimeType from a CustomMimeType with a service rank and id.
bool operator<(const MimeType &other) const
Less-than comparison based on rank and service id.
std::vector< std::string > GetExtensions() const
Get the list of file extensions this mime-type handles.
std::string GetCategory() const
Get the human-readable category (e.g. "Images", "Surfaces").
bool operator==(const MimeType &other) const
Equality comparison based on the mime-type name.
bool AppliesTo(const std::string &path) const
Check whether this mime-type can handle the given file path.
MimeType(const MimeType &other)
Copy constructor.
Find image slices visible on a given plane.
MITKCORE_EXPORT std::ostream & operator<<(std::ostream &o, DataNode::Pointer &dtn)
Stream output operator for DataNode smart pointers.
void swap(CustomMimeType &l, CustomMimeType &r)
Swap two CustomMimeType objects.