BCM WL 6.30.102.9 (r366174)
[tomato.git] / release / src-rt / linux / linux-2.6 / scripts / squashfs / lzma / C / Windows / FileIO.h
blobde66d7f3a95719eec740cb7053e49f163ecad533
1 // Windows/FileIO.h
3 #ifndef __WINDOWS_FILEIO_H
4 #define __WINDOWS_FILEIO_H
6 #include "../Common/Types.h"
8 namespace NWindows {
9 namespace NFile {
10 namespace NIO {
12 struct CByHandleFileInfo
14 DWORD Attributes;
15 FILETIME CreationTime;
16 FILETIME LastAccessTime;
17 FILETIME LastWriteTime;
18 DWORD VolumeSerialNumber;
19 UInt64 Size;
20 DWORD NumberOfLinks;
21 UInt64 FileIndex;
24 class CFileBase
26 protected:
27 bool _fileIsOpen;
28 HANDLE _handle;
29 bool Create(LPCTSTR fileName, DWORD desiredAccess,
30 DWORD shareMode, DWORD creationDisposition, DWORD flagsAndAttributes);
31 #ifndef _UNICODE
32 bool Create(LPCWSTR fileName, DWORD desiredAccess,
33 DWORD shareMode, DWORD creationDisposition, DWORD flagsAndAttributes);
34 #endif
36 public:
37 CFileBase(): _fileIsOpen(false){};
38 virtual ~CFileBase();
40 virtual bool Close();
42 bool GetPosition(UInt64 &position) const;
43 bool GetLength(UInt64 &length) const;
45 bool Seek(Int64 distanceToMove, DWORD moveMethod, UInt64 &newPosition) const;
46 bool Seek(UInt64 position, UInt64 &newPosition);
47 bool SeekToBegin();
48 bool SeekToEnd(UInt64 &newPosition);
50 bool GetFileInformation(CByHandleFileInfo &fileInfo) const;
53 class CInFile: public CFileBase
55 public:
56 bool Open(LPCTSTR fileName, DWORD shareMode, DWORD creationDisposition, DWORD flagsAndAttributes);
57 bool Open(LPCTSTR fileName);
58 #ifndef _UNICODE
59 bool Open(LPCWSTR fileName, DWORD shareMode, DWORD creationDisposition, DWORD flagsAndAttributes);
60 bool Open(LPCWSTR fileName);
61 #endif
62 bool ReadPart(void *data, UInt32 size, UInt32 &processedSize);
63 bool Read(void *data, UInt32 size, UInt32 &processedSize);
66 class COutFile: public CFileBase
68 // DWORD m_CreationDisposition;
69 public:
70 // COutFile(): m_CreationDisposition(CREATE_NEW){};
71 bool Open(LPCTSTR fileName, DWORD shareMode, DWORD creationDisposition, DWORD flagsAndAttributes);
72 bool Open(LPCTSTR fileName, DWORD creationDisposition);
73 bool Create(LPCTSTR fileName, bool createAlways);
75 #ifndef _UNICODE
76 bool Open(LPCWSTR fileName, DWORD shareMode, DWORD creationDisposition, DWORD flagsAndAttributes);
77 bool Open(LPCWSTR fileName, DWORD creationDisposition);
78 bool Create(LPCWSTR fileName, bool createAlways);
79 #endif
82 void SetOpenCreationDisposition(DWORD creationDisposition)
83 { m_CreationDisposition = creationDisposition; }
84 void SetOpenCreationDispositionCreateAlways()
85 { m_CreationDisposition = CREATE_ALWAYS; }
88 bool SetTime(const FILETIME *creationTime, const FILETIME *lastAccessTime, const FILETIME *lastWriteTime);
89 bool SetLastWriteTime(const FILETIME *lastWriteTime);
90 bool WritePart(const void *data, UInt32 size, UInt32 &processedSize);
91 bool Write(const void *data, UInt32 size, UInt32 &processedSize);
92 bool SetEndOfFile();
93 bool SetLength(UInt64 length);
96 }}}
98 #endif