GDCM 3.0.24
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
21namespace gdcm
22{
28{
29public:
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 useful)
59 // and it forces file to exist on the disk whereas Filename
60 // should be independent from file existence.
61 bool IsIdentical(Filename const &fn) const;
62
64 bool EndWith(const char ending[]) const;
65
66private:
67 std::string FileName;
68 std::string Path;
69 std::string Conversion;
70};
71
72} // end namespace gdcm
73
74#endif //GDCMFILENAME_H
Class to manipulate file name's.
Definition gdcmFilename.h:28
Filename(const char *filename="")
Definition gdcmFilename.h:30
static const char * Join(const char *path, const char *filename)
bool IsIdentical(Filename const &fn) const
bool IsEmpty() const
return whether the filename is empty
Definition gdcmFilename.h:50
bool EndWith(const char ending[]) const
Does the filename ends with a particular string ?
const char * GetName()
return only the name part of a filename
const char * ToUnixSlashes()
Convert backslash (windows style) to UNIX style slash.
const char * ToWindowsSlashes()
Convert forward slash (UNIX style) to windows style slash.
const char * GetPath()
Return only the path component of a filename.
const char * GetExtension()
return only the extension part of a filename
const char * GetFileName() const
Return the full filename.
Definition gdcmFilename.h:33
#define GDCM_EXPORT
Definition gdcmWin32.h:34
Definition gdcmASN1.h:21