GDCM 2.0.17
|
00001 /*========================================================================= 00002 00003 Program: GDCM (Grassroots DICOM). A DICOM library 00004 Module: $URL$ 00005 00006 Copyright (c) 2006-2010 Mathieu Malaterre 00007 All rights reserved. 00008 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00015 #ifndef GDCMFILENAME_H 00016 #define GDCMFILENAME_H 00017 00018 #include "gdcmTypes.h" 00019 00020 #include <string> 00021 00022 namespace gdcm 00023 { 00028 class GDCM_EXPORT Filename 00029 { 00030 public: 00031 Filename(const char* filename = ""):FileName(filename ? filename : ""),Path(),Conversion() {} 00032 00034 const char *GetFileName() const { return FileName.c_str(); } 00036 const char *GetPath(); 00038 const char *GetName(); 00040 const char *GetExtension(); 00042 const char *ToUnixSlashes(); 00044 const char *ToWindowsSlashes(); 00045 00048 static const char *Join(const char *path, const char *filename); 00049 00051 bool IsEmpty() const { return FileName.empty(); } 00052 00056 operator const char * () const { return GetFileName(); } 00057 00058 // FIXME: I don't like this function 00059 // It hides the realpath call (maybe usefull) 00060 // and it forces file to exist on the disk whereas Filename 00061 // should be independant from file existence. 00062 bool IsIdentical(Filename const &fn) const; 00063 00064 private: 00065 std::string FileName; 00066 std::string Path; 00067 std::string Conversion; 00068 }; 00069 00070 } // end namespace gdcm 00071 00072 #endif //GDCMFILENAME_H