GDCM 2.2.0

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Directories
- Examples

- File List
- File Members

gdcmSystem.h
Go to the documentation of this file.

    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 GDCMSYSTEM_H
    00015 #define GDCMSYSTEM_H
    00016
    00017 #include "gdcmTypes.h"
    00018
    00019 namespace gdcm
    00020 {
    00021
    00026 class GDCM_EXPORT System
    00027 {
    00028 public:
    00030   static bool MakeDirectory(const char *path);
    00032   static bool FileExists(const char* filename);
    00034   static bool FileIsDirectory(const char* name);
    00036   static bool FileIsSymlink(const char* name);
    00038   static bool RemoveFile(const char* source);
    00040   static bool DeleteDirectory(const char *source);
    00041
    00043   static const char *GetLastSystemError();
    00044
    00049   static size_t FileSize(const char* filename);
    00050
    00053   static time_t FileTime(const char* filename);
    00054
    00057   static const char *GetCurrentProcessFileName();
    00058
    00061   static const char *GetCurrentModuleFileName();
    00062
    00065   static const char *GetCurrentResourcesDirectory();
    00066
    00067   // TODO some system calls
    00068   // Chdir
    00069   // copy a file
    00070
    00073   static bool GetHostName(char hostname[255]);
    00074
    00075   // In the following the size '22' is explicitly listed. You need to pass in
    00076   // at least 22bytes of array. If the string is an output it will be
    00077   // automatically padded ( array[21] == 0 ) for you.
    00078   // Those functions: GetCurrentDateTime / FormatDateTime / ParseDateTime do
    00079   // not return the &YYZZ part of the DT structure as defined in DICOM PS 3.5 -
    00080   // 2008 In this case it is simple to split the date[22] into a DA and TM
    00081   // structure
    00082
    00087   static bool GetCurrentDateTime(char date[22]);
    00088
    00092   static bool FormatDateTime(char date[22], time_t t, long milliseconds = 0);
    00093
    00095   static bool ParseDateTime(time_t &timep, const char date[22]);
    00096
    00099   static bool ParseDateTime(time_t &timep, long &milliseconds, const char date[22]);
    00100
    00103   static const char *GetTimezoneOffsetFromUTC();
    00104
    00107   static size_t EncodeBytes(char *out, const unsigned char *data, int size);
    00108
    00110   static int StrCaseCmp(const char *s1, const char *s2);
    00112   static int StrNCaseCmp(const char *s1, const char *s2, size_t n);
    00113
    00118   static const char * GetCWD();
    00119
    00121   static char *StrTokR(char *ptr, const char *sep, char **end);
    00122
    00124   static const char *GetLocaleCharset();
    00125
    00127 /*
    00128   static void SetArgv0(const char *);
    00129   static const char* GetArgv0();
    00130 */
    00131
    00132 protected:
    00133   static bool GetPermissions(const char* file, unsigned short& mode);
    00134   static bool SetPermissions(const char* file, unsigned short mode);
    00135
    00136 private:
    00137 };
    00138
    00139 } // end namespace gdcm
    00140
    00141 #endif //GDCMSYSTEM_H