GDCM 2.2.1

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

gdcmFilename.h
Go to the documentation of this file.
1 /*=========================================================================
2
3 Program: GDCM (Grassroots DICOM). A DICOM library
4
5 Copyright (c) 2006-2011 Mathieu Malaterre
6 All rights reserved.
7 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notice for more information.
12
13 =========================================================================*/
14 #ifndef GDCMFILENAME_H
15 #define GDCMFILENAME_H
16
17 #include "gdcmTypes.h"
18
19 #include <string>
20
21 namespace gdcm
22 {
27 class GDCM_EXPORT Filename
28 {
29 public:
30 Filename(const char* filename = ""):FileName(filename ? filename : ""),Path(),Conversion() {}
31
33 const char *GetFileName() const { return FileName.c_str(); }
35 const char *GetPath();
37 const char *GetName();
39 const char *GetExtension();
41 const char *ToUnixSlashes();
43 const char *ToWindowsSlashes();
44
47 static const char *Join(const char *path, const char *filename);
48
50 bool IsEmpty() const { return FileName.empty(); }
51
55 operator const char * () const { return GetFileName(); }
56
57 // FIXME: I don't like this function
58 // It hides the realpath call (maybe usefull)
59 // and it forces file to exist on the disk whereas Filename
60 // should be independant from file existence.
61 bool IsIdentical(Filename const &fn) const;
62
64 bool EndWith(const char ending[]) const;
65
66 private:
67 std::string FileName;
68 std::string Path;
69 std::string Conversion;
70 };
71
72 } // end namespace gdcm
73
74 #endif //GDCMFILENAME_H