Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef MITKCUSTOMMIMETYPE_H
18 #define MITKCUSTOMMIMETYPE_H
19 
20 #include <MitkCoreExports.h>
21 
22 #include <mitkServiceInterface.h>
23 
24 #include <string>
25 #include <vector>
26 
27 namespace mitk
28 {
29  class MimeType;
30 
49  {
50  public:
52  CustomMimeType(const std::string &name);
53  CustomMimeType(const CustomMimeType &other);
54  explicit CustomMimeType(const MimeType &other);
55 
56  virtual ~CustomMimeType();
57 
58  CustomMimeType &operator=(const CustomMimeType &other);
59  CustomMimeType &operator=(const MimeType &other);
60 
64  std::string GetName() const;
65 
69  std::string GetCategory() const;
70 
74  std::vector<std::string> GetExtensions() const;
75 
79  std::string GetComment() const;
80 
87  virtual bool AppliesTo(const std::string &path) const;
88 
94  bool MatchesExtension(const std::string &path) const;
95 
102  std::string GetExtension(const std::string &path) const;
103 
110  std::string GetFilenameWithoutExtension(const std::string &path) const;
111 
112  void SetName(const std::string &name);
113  void SetCategory(const std::string &category);
114  void SetExtension(const std::string &extension);
115  void AddExtension(const std::string &extension);
116  void SetComment(const std::string &comment);
117 
118  void Swap(CustomMimeType &r);
119 
120  virtual CustomMimeType *Clone() const;
121 
122  private:
123  // returns true if an extension was found
124  bool ParsePathForExtension(const std::string &path, std::string &extension, std::string &filename) const;
125 
126  struct Impl;
127  Impl *d;
128  };
129 
130  void swap(CustomMimeType &l, CustomMimeType &r);
131 }
132 
133 MITK_DECLARE_SERVICE_INTERFACE(mitk::CustomMimeType, "org.mitk.CustomMimeType")
134 
135 #endif // MITKCUSTOMMIMETYPE_H
Pointer Clone() const
#define MITKCORE_EXPORT
DataCollection - Class to facilitate loading/accessing structured data.
The CustomMimeType class represents a custom mime-type which may be registered as a service object...
static const std::string filename
void swap(CustomMimeType &l, CustomMimeType &r)
The MimeType class represens a registered mime-type. It is an immutable wrapper for mitk::CustomMimeT...
Definition: mitkMimeType.h:45
static std::string GetName(std::string fileName, std::string suffix)
MITK_DECLARE_SERVICE_INTERFACE(mitk::ISimulationService,"org.mitk.ISimulationService")