GDCM 2.2.1

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

- File List
- File Members

gdcmSystem.h
Go to the documentation of this file.
1 /*=========================================================================
2
3 Program: GDCM (Grassroots DICOM). A DICOM library
4
5 Copyright (c) 2006-2011 Mathieu Malaterre
6 All rights reserved.
7 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notice for more information.
12
13 =========================================================================*/
14 #ifndef GDCMSYSTEM_H
15 #define GDCMSYSTEM_H
16
17 #include "gdcmTypes.h"
18
19 namespace gdcm
20 {
21
26 class GDCM_EXPORT System
27 {
28 public:
30 static bool MakeDirectory(const char *path);
32 static bool FileExists(const char* filename);
34 static bool FileIsDirectory(const char* name);
36 static bool FileIsSymlink(const char* name);
38 static bool RemoveFile(const char* source);
40 static bool DeleteDirectory(const char *source);
41
43 static const char *GetLastSystemError();
44
49 static size_t FileSize(const char* filename);
50
53 static time_t FileTime(const char* filename);
54
57 static const char *GetCurrentProcessFileName();
58
61 static const char *GetCurrentModuleFileName();
62
65 static const char *GetCurrentResourcesDirectory();
66
67 // TODO some system calls
68 // Chdir
69 // copy a file
70
73 static bool GetHostName(char hostname[255]);
74
75 // In the following the size '22' is explicitly listed. You need to pass in
76 // at least 22bytes of array. If the string is an output it will be
77 // automatically padded ( array[21] == 0 ) for you.
78 // Those functions: GetCurrentDateTime / FormatDateTime / ParseDateTime do
79 // not return the &YYZZ part of the DT structure as defined in DICOM PS 3.5 -
80 // 2008 In this case it is simple to split the date[22] into a DA and TM
81 // structure
82
87 static bool GetCurrentDateTime(char date[22]);
88
92 static bool FormatDateTime(char date[22], time_t t, long milliseconds = 0);
93
95 static bool ParseDateTime(time_t &timep, const char date[22]);
96
99 static bool ParseDateTime(time_t &timep, long &milliseconds, const char date[22]);
100
103 static const char *GetTimezoneOffsetFromUTC();
104
107 static size_t EncodeBytes(char *out, const unsigned char *data, int size);
108
110 static int StrCaseCmp(const char *s1, const char *s2);
112 static int StrNCaseCmp(const char *s1, const char *s2, size_t n);
113
118 static const char * GetCWD();
119
121 static char *StrTokR(char *ptr, const char *sep, char **end);
122
124 static const char *GetLocaleCharset();
125
127 /*
128 static void SetArgv0(const char *);
129 static const char* GetArgv0();
130 */
131
132 protected:
133 static bool GetPermissions(const char* file, unsigned short& mode);
134 static bool SetPermissions(const char* file, unsigned short mode);
135
136 private:
137 };
138
139 } // end namespace gdcm
140
141 #endif //GDCMSYSTEM_H