GDCM: gdcmFilename.h Source File

GDCM 3.2.5

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{
27 class GDCM_EXPORT Filename
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
gdcm::Filename::Filename
Filename(const char *filename="")
Definition gdcmFilename.h:30
gdcm::Filename::Join
static const char * Join(const char *path, const char *filename)
gdcm::Filename::IsIdentical
bool IsIdentical(Filename const &fn) const
gdcm::Filename::IsEmpty
bool IsEmpty() const
return whether the filename is empty
Definition gdcmFilename.h:50
gdcm::Filename::EndWith
bool EndWith(const char ending[]) const
Does the filename ends with a particular string ?
gdcm::Filename::GetName
const char * GetName()
return only the name part of a filename
gdcm::Filename::ToUnixSlashes
const char * ToUnixSlashes()
Convert backslash (windows style) to UNIX style slash.
gdcm::Filename::ToWindowsSlashes
const char * ToWindowsSlashes()
Convert forward slash (UNIX style) to windows style slash.
gdcm::Filename::GetPath
const char * GetPath()
Return only the path component of a filename.
gdcm::Filename::GetExtension
const char * GetExtension()
return only the extension part of a filename
gdcm::Filename::GetFileName
const char * GetFileName() const
Return the full filename.
Definition gdcmFilename.h:33
gdcmTypes.h
GDCM_EXPORT
#define GDCM_EXPORT
Definition gdcmWin32.h:34
gdcm
Definition gdcmASN1.h:21