00001
00002
00003
00004
00005
00006 #if !defined(AFX_VMSFILEUTIL_H__A3E2F9DA_BF0E_43B9_AF5C_84C1AB7A72A6__INCLUDED_)
00007 #define AFX_VMSFILEUTIL_H__A3E2F9DA_BF0E_43B9_AF5C_84C1AB7A72A6__INCLUDED_
00008
00009 #if _MSC_VER > 1000
00010 #pragma once
00011 #endif
00012
00013 #include "vmsFile.h"
00014 using namespace vmsFDM;
00015
00016 class vmsFileUtil
00017 {
00018 public:
00019
00020 static void BuildPath (LPCSTR pszPath);
00021
00022 static fsString GetPathFromPathName (LPCSTR pszPathName);
00023
00024 static void BuildPathToFile (LPCSTR pszFileName);
00025
00026 static void GetAppDataPath (LPCSTR pszAppName, LPSTR szPath);
00027
00028 static void MakePathOK (LPSTR szPath, bool bNeedBackslashAtEnd = true);
00029
00030 static void ReadHeader (vmsFile& file, fsString& strDesc, WORD& wVersion);
00031
00032 static void WriteHeader (vmsFile& file, LPCSTR pszDesc, WORD wVersion);
00033
00034 static void ReadString (vmsFile& file, fsString &str);
00035 static void WriteString (vmsFile& file, LPCSTR psz);
00036 };
00037
00038 inline void vmsFILE_SAVE(vmsFile& file, LPCSTR psz) {vmsFileUtil::WriteString (file, psz);}
00039 inline void vmsFILE_SAVE(vmsFile& file, int iValue){file.Write (&iValue, sizeof (int));}
00040 inline void vmsFILE_SAVE(vmsFile& file, UINT uValue){file.Write (&uValue, sizeof (UINT));}
00041 inline void vmsFILE_SAVE(vmsFile& file, DWORD uValue){file.Write (&uValue, sizeof (DWORD));}
00042 inline void vmsFILE_SAVE(vmsFile& file, double fValue){file.Write (&fValue, sizeof (double));}
00043 inline void vmsFILE_SAVE(vmsFile& file, __int64 iValue){file.Write (&iValue, sizeof (__int64));}
00044
00045 inline void vmsFILE_READ(vmsFile& file, fsString& str) {vmsFileUtil::ReadString (file, str);}
00046 inline void vmsFILE_READ(vmsFile& file, int& iValue){file.Read (&iValue, sizeof (int));}
00047 inline void vmsFILE_READ(vmsFile& file, UINT& uValue){file.Read (&uValue, sizeof (UINT));}
00048 inline void vmsFILE_READ(vmsFile& file, DWORD& uValue){file.Read (&uValue, sizeof (DWORD));}
00049 inline void vmsFILE_READ(vmsFile& file, double& fValue){file.Read (&fValue, sizeof (double));}
00050 inline void vmsFILE_READ(vmsFile& file, __int64& iValue){file.Read (&iValue, sizeof (__int64));}
00051
00052 #endif