gdcmSystem.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 GDCMSYSTEM_H
#define GDCMSYSTEM_H
#include "gdcmTypes.h"
namespace gdcm
{
class GDCM_EXPORT System
{
public:
static bool MakeDirectory(const char *path);
static bool FileExists(const char* filename);
static bool FileIsDirectory(const char* name);
static bool FileIsSymlink(const char* name);
static bool RemoveFile(const char* source);
static bool DeleteDirectory(const char *source);
static std::wstring ConvertToUNC(const char *utf8path);
static const char *GetLastSystemError();
static size_t FileSize(const char* filename);
static time_t FileTime(const char* filename);
static const char *GetCurrentProcessFileName();
static const char *GetCurrentModuleFileName();
static const char *GetCurrentResourcesDirectory();
// TODO some system calls
// Chdir
// copy a file
static bool GetHostName(char hostname[255]);
// In the following the size '22' is explicitly listed. You need to pass in
// at least 22bytes of array. If the string is an output it will be
// automatically padded ( array[21] == 0 ) for you.
// Those functions: GetCurrentDateTime / FormatDateTime / ParseDateTime do
// not return the &YYZZ part of the DT structure as defined in DICOM PS 3.5 -
// 2008 In this case it is simple to split the date[22] into a DA and TM
// structure
static bool GetCurrentDateTime(char date[22]);
static bool FormatDateTime(char date[22], time_t t, long milliseconds = 0);
static bool ParseDateTime(time_t &timep, const char date[22]);
static bool ParseDateTime(time_t &timep, long &milliseconds, const char date[22]);
static const char *GetTimezoneOffsetFromUTC();
static size_t EncodeBytes(char *out, const unsigned char *data, int size);
static int StrCaseCmp(const char *s1, const char *s2);
static int StrNCaseCmp(const char *s1, const char *s2, size_t n);
static const char * GetCWD();
static char *StrTokR(char *ptr, const char *sep, char **end);
static char *StrSep(char **stringp, const char *delim);
static const char *GetLocaleCharset();
/*
static void SetArgv0(const char *);
static const char* GetArgv0();
*/
protected:
static bool GetPermissions(const char* file, unsigned short& mode);
static bool SetPermissions(const char* file, unsigned short mode);
private:
};
} // end namespace gdcm
#endif //GDCMSYSTEM_H
gdcm::System
Class to do system operation.
Definition gdcmSystem.h:27
gdcm::System::FileExists
static bool FileExists(const char *filename)
Check whether the specified file exist on the system.
gdcm::System::GetLocaleCharset
static const char * GetLocaleCharset()
return locale charmap
gdcm::System::FormatDateTime
static bool FormatDateTime(char date[22], time_t t, long milliseconds=0)
gdcm::System::SetPermissions
static bool SetPermissions(const char *file, unsigned short mode)
gdcm::System::StrNCaseCmp
static int StrNCaseCmp(const char *s1, const char *s2, size_t n)
gdcm::System::FileTime
static time_t FileTime(const char *filename)
gdcm::System::GetCurrentResourcesDirectory
static const char * GetCurrentResourcesDirectory()
gdcm::System::MakeDirectory
static bool MakeDirectory(const char *path)
Create a directory name path.
gdcm::System::StrTokR
static char * StrTokR(char *ptr, const char *sep, char **end)
strtok_r
gdcm::System::GetCurrentDateTime
static bool GetCurrentDateTime(char date[22])
gdcm::System::ParseDateTime
static bool ParseDateTime(time_t &timep, const char date[22])
Parse a date stored as ASCII text into a time_t structured (discard millisecond if any).
gdcm::System::GetHostName
static bool GetHostName(char hostname[255])
gdcm::System::EncodeBytes
static size_t EncodeBytes(char *out, const unsigned char *data, int size)
gdcm::System::FileIsSymlink
static bool FileIsSymlink(const char *name)
Check whether name is a symlink.
gdcm::System::StrSep
static char * StrSep(char **stringp, const char *delim)
gdcm::System::GetLastSystemError
static const char * GetLastSystemError()
Return the last error.
gdcm::System::ConvertToUNC
static std::wstring ConvertToUNC(const char *utf8path)
gdcm::System::GetCWD
static const char * GetCWD()
gdcm::System::FileSize
static size_t FileSize(const char *filename)
gdcm::System::StrCaseCmp
static int StrCaseCmp(const char *s1, const char *s2)
consistent func for C99 spec of strcasecmp/strncasecmp
gdcm::System::FileIsDirectory
static bool FileIsDirectory(const char *name)
Check whether the file specified is a directory:
gdcm::System::GetCurrentModuleFileName
static const char * GetCurrentModuleFileName()
gdcm::System::ParseDateTime
static bool ParseDateTime(time_t &timep, long &milliseconds, const char date[22])
gdcm::System::RemoveFile
static bool RemoveFile(const char *source)
remove a file named source
gdcm::System::DeleteDirectory
static bool DeleteDirectory(const char *source)
remove a directory named source
gdcm::System::GetPermissions
static bool GetPermissions(const char *file, unsigned short &mode)
NOT THREAD SAFE.
gdcm::System::GetTimezoneOffsetFromUTC
static const char * GetTimezoneOffsetFromUTC()
gdcm::System::GetCurrentProcessFileName
static const char * GetCurrentProcessFileName()
gdcmTypes.h
GDCM_EXPORT
#define GDCM_EXPORT
Definition gdcmWin32.h:34
gdcm
Definition gdcmASN1.h:21