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