Medical Imaging Interaction Toolkit  2024.06.99-c70462f2
Medical Imaging Interaction Toolkit
mitkCustomMimeType.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 mitkCustomMimeType_h
14 #define mitkCustomMimeType_h
15 
16 #include <MitkCoreExports.h>
17 
18 #include <mitkServiceInterface.h>
19 
20 #include <string>
21 #include <vector>
22 
23 namespace mitk
24 {
25  class MimeType;
26 
45  {
46  public:
48  CustomMimeType(const std::string &name);
49  CustomMimeType(const CustomMimeType &other);
50  explicit CustomMimeType(const MimeType &other);
51 
52  virtual ~CustomMimeType();
53 
54  CustomMimeType &operator=(const CustomMimeType &other);
55  CustomMimeType &operator=(const MimeType &other);
56 
60  std::string GetName() const;
61 
65  std::string GetCategory() const;
66 
70  std::vector<std::string> GetExtensions() const;
71 
75  std::string GetComment() const;
76 
83  virtual bool AppliesTo(const std::string &path) const;
84 
90  bool MatchesExtension(const std::string &path) const;
91 
98  std::string GetExtension(const std::string &path) const;
99 
106  std::string GetFilenameWithoutExtension(const std::string &path) const;
107 
108  void SetName(const std::string &name);
109  void SetCategory(const std::string &category);
110  void SetExtension(const std::string &extension);
111  void AddExtension(const std::string &extension);
112  void SetComment(const std::string &comment);
113 
114  void Swap(CustomMimeType &r);
115 
116  virtual CustomMimeType *Clone() const;
117 
118  private:
119  // returns true if an extension was found
120  bool ParsePathForExtension(const std::string &path, std::string &extension, std::string &filename) const;
121 
122  struct Impl;
123  Impl *d;
124  };
125 
126  void swap(CustomMimeType &l, CustomMimeType &r);
127 }
128 
129 MITK_DECLARE_SERVICE_INTERFACE(mitk::CustomMimeType, "org.mitk.CustomMimeType")
130 
131 #endif
mitk::swap
void swap(CustomMimeType &l, CustomMimeType &r)
mitkServiceInterface.h
mitk::CustomMimeType
The CustomMimeType class represents a custom mime-type which may be registered as a service object....
Definition: mitkCustomMimeType.h:44
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
MitkCoreExports.h
MITK_DECLARE_SERVICE_INTERFACE
#define MITK_DECLARE_SERVICE_INTERFACE(IFace, IId)
Definition: mitkServiceInterface.h:26
MITKCORE_EXPORT
#define MITKCORE_EXPORT
Definition: MitkCoreExports.h:15
mitk::MimeType
The MimeType class represents a registered mime-type. It is an immutable wrapper for mitk::CustomMime...
Definition: mitkMimeType.h:36