gdcmFilename.h
Go to the documentation of this file.
/*=========================================================================
Program: GDCM (Grassroots DICOM). A DICOM library
Copyright (c) 2006-2011 Mathieu Malaterre
All rights reserved.
See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#ifndef GDCMFILENAME_H
#define GDCMFILENAME_H
#include "gdcmTypes.h"
#include <string>
namespace gdcm
{
class GDCM_EXPORT Filename
{
public:
Filename(const char* filename = ""):FileName(filename ? filename : ""),Path(),Conversion() {}
const char *GetFileName() const { return FileName.c_str(); }
const char *GetPath();
const char *GetName();
const char *GetExtension();
const char *ToUnixSlashes();
const char *ToWindowsSlashes();
static const char *Join(const char *path, const char *filename);
bool IsEmpty() const { return FileName.empty(); }
operator const char * () const { return GetFileName(); }
// FIXME: I don't like this function
// It hides the realpath call (maybe useful)
// and it forces file to exist on the disk whereas Filename
// should be independent from file existence.
bool IsIdentical(Filename const &fn) const;
bool EndWith(const char ending[]) const;
private:
std::string FileName;
std::string Path;
std::string Conversion;
};
} // end namespace gdcm
#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