Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
usModuleResource.h
Go to the documentation of this file.
1 /*=============================================================================
2 
3  Library: CppMicroServices
4 
5  Copyright (c) German Cancer Research Center,
6  Division of Medical and Biological Informatics
7 
8  Licensed under the Apache License, Version 2.0 (the "License");
9  you may not use this file except in compliance with the License.
10  You may obtain a copy of the License at
11 
12  http://www.apache.org/licenses/LICENSE-2.0
13 
14  Unless required by applicable law or agreed to in writing, software
15  distributed under the License is distributed on an "AS IS" BASIS,
16  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  See the License for the specific language governing permissions and
18  limitations under the License.
19 
20 =============================================================================*/
21 
22 
23 #ifndef USMODULERESOURCE_H
24 #define USMODULERESOURCE_H
25 
26 #include <usCoreExport.h>
27 
28 #include <ostream>
29 #include <vector>
30 
31 US_MSVC_PUSH_DISABLE_WARNING(4396)
32 
33 US_BEGIN_NAMESPACE
34 
35 class ModuleResourcePrivate;
36 class ModuleResourceContainer;
37 
55 class US_Core_EXPORT ModuleResource
56 {
57 
58 private:
59 
60  typedef ModuleResourcePrivate* ModuleResource::*bool_type;
61 
62 public:
63 
67  ModuleResource();
72  ModuleResource(const ModuleResource& resource);
73 
74  ~ModuleResource();
75 
82  ModuleResource& operator=(const ModuleResource& resource);
83 
92  bool operator<(const ModuleResource& resource) const;
93 
102  bool operator==(const ModuleResource& resource) const;
103 
110  bool operator!=(const ModuleResource& resource) const;
111 
121  bool IsValid() const;
122 
126  operator bool_type() const;
127 
140  std::string GetName() const;
141 
156  std::string GetPath() const;
157 
164  std::string GetResourcePath() const;
165 
178  std::string GetBaseName() const;
179 
192  std::string GetCompleteBaseName() const;
193 
209  std::string GetSuffix() const;
210 
226  std::string GetCompleteSuffix() const;
227 
234  bool IsDir() const;
235 
241  bool IsFile() const;
242 
251  std::vector<std::string> GetChildren() const;
252 
261  std::vector<ModuleResource> GetChildResources() const;
262 
268  int GetSize() const;
269 
275  time_t GetLastModified() const;
276 
277 private:
278 
279  ModuleResource(const std::string& file, const ModuleResourceContainer& resourceContainer);
280  ModuleResource(int index, const ModuleResourceContainer& resourceContainer);
281 
282  friend class Module;
283  friend class ModulePrivate;
284  friend class ModuleResourceContainer;
285  friend class ModuleResourceStream;
286 
287  US_HASH_FUNCTION_FRIEND(ModuleResource);
288 
289  std::size_t Hash() const;
290 
291  void* GetData() const;
292 
293  ModuleResourcePrivate* d;
294 
295 };
296 
297 US_END_NAMESPACE
298 
299 US_MSVC_POP_WARNING
300 
304 US_Core_EXPORT std::ostream& operator<<(std::ostream& os, const US_PREPEND_NAMESPACE(ModuleResource)& resource);
305 
306 US_HASH_FUNCTION_NAMESPACE_BEGIN
307 US_HASH_FUNCTION_BEGIN(US_PREPEND_NAMESPACE(ModuleResource))
308  return arg.Hash();
309 US_HASH_FUNCTION_END
310 US_HASH_FUNCTION_NAMESPACE_END
311 
312 #endif // USMODULERESOURCE_H
MITKCORE_EXPORT bool operator!=(const InteractionEvent &a, const InteractionEvent &b)
MITKCORE_EXPORT bool operator==(const InteractionEvent &a, const InteractionEvent &b)
T::Pointer GetData(const std::string &name)
static std::string GetName(std::string fileName, std::string suffix)
US_MSVC_POP_WARNING US_Core_EXPORT std::ostream & operator<<(std::ostream &os, const us::ModuleResource &resource)
US_HASH_FUNCTION_NAMESPACE_BEGIN return arg Hash()