Annotation of elwix/tools/oldlzma/SRC/Windows/FileIO.h, revision 1.1

1.1     ! misho       1: // Windows/FileIO.h
        !             2: 
        !             3: #ifndef __WINDOWS_FILEIO_H
        !             4: #define __WINDOWS_FILEIO_H
        !             5: 
        !             6: namespace NWindows {
        !             7: namespace NFile {
        !             8: namespace NIO {
        !             9: 
        !            10: struct CByHandleFileInfo
        !            11: { 
        !            12:   DWORD    Attributes; 
        !            13:   FILETIME CreationTime; 
        !            14:   FILETIME LastAccessTime; 
        !            15:   FILETIME LastWriteTime; 
        !            16:   DWORD    VolumeSerialNumber; 
        !            17:   UINT64   Size;
        !            18:   DWORD    NumberOfLinks; 
        !            19:   UINT64   FileIndex; 
        !            20: };
        !            21: 
        !            22: class CFileBase
        !            23: {
        !            24: protected:
        !            25:   bool _fileIsOpen;
        !            26:   HANDLE _handle;
        !            27:   bool Create(LPCTSTR fileName, DWORD desiredAccess,
        !            28:       DWORD shareMode, DWORD creationDisposition,  DWORD flagsAndAttributes);
        !            29:   #ifndef _UNICODE
        !            30:   bool Create(LPCWSTR fileName, DWORD desiredAccess,
        !            31:       DWORD shareMode, DWORD creationDisposition,  DWORD flagsAndAttributes);
        !            32:   #endif
        !            33: 
        !            34: public:
        !            35:   CFileBase():
        !            36:     _fileIsOpen(false){};
        !            37:   virtual ~CFileBase();
        !            38: 
        !            39:   virtual bool Close();
        !            40: 
        !            41:   bool GetPosition(UINT64 &position) const;
        !            42:   bool GetLength(UINT64 &length) const;
        !            43: 
        !            44:   bool Seek(INT64 distanceToMove, DWORD moveMethod, UINT64 &newPosition) const;
        !            45:   bool Seek(UINT64 position, UINT64 &newPosition); 
        !            46:   bool SeekToBegin(); 
        !            47:   bool SeekToEnd(UINT64 &newPosition); 
        !            48:   
        !            49:   bool GetFileInformation(CByHandleFileInfo &fileInfo) const;
        !            50: };
        !            51: 
        !            52: class CInFile: public CFileBase
        !            53: {
        !            54: public:
        !            55:   bool Open(LPCTSTR fileName, DWORD shareMode, 
        !            56:       DWORD creationDisposition,  DWORD flagsAndAttributes);
        !            57:   bool Open(LPCTSTR fileName);
        !            58:   #ifndef _UNICODE
        !            59:   bool Open(LPCWSTR fileName, DWORD shareMode, 
        !            60:       DWORD creationDisposition,  DWORD flagsAndAttributes);
        !            61:   bool Open(LPCWSTR fileName);
        !            62:   #endif
        !            63:   bool Read(void *data, UINT32 size, UINT32 &processedSize);
        !            64: };
        !            65: 
        !            66: class COutFile: public CFileBase
        !            67: {
        !            68:   // DWORD m_CreationDisposition;
        !            69: public:
        !            70:   // COutFile(): m_CreationDisposition(CREATE_NEW){};
        !            71:   bool Open(LPCTSTR fileName, DWORD shareMode, 
        !            72:       DWORD creationDisposition, DWORD flagsAndAttributes);
        !            73:   bool Open(LPCTSTR fileName, DWORD creationDisposition);
        !            74:   bool Create(LPCTSTR fileName, bool createAlways);
        !            75: 
        !            76:   #ifndef _UNICODE
        !            77:   bool Open(LPCWSTR fileName, DWORD shareMode, 
        !            78:       DWORD creationDisposition, DWORD flagsAndAttributes);
        !            79:   bool Open(LPCWSTR fileName, DWORD creationDisposition);
        !            80:   bool Create(LPCWSTR fileName, bool createAlways);
        !            81:   #endif
        !            82: 
        !            83:   /*
        !            84:   void SetOpenCreationDisposition(DWORD creationDisposition)
        !            85:     { m_CreationDisposition = creationDisposition; }
        !            86:   void SetOpenCreationDispositionCreateAlways()
        !            87:     { m_CreationDisposition = CREATE_ALWAYS; }
        !            88:   */
        !            89: 
        !            90:   bool SetTime(const FILETIME *creationTime,
        !            91:       const FILETIME *lastAccessTime, const FILETIME *lastWriteTime);
        !            92:   bool SetLastWriteTime(const FILETIME *lastWriteTime);
        !            93:   bool Write(const void *data, UINT32 size, UINT32 &processedSize);
        !            94:   bool SetEndOfFile();
        !            95:   bool SetLength(UINT64 length);
        !            96: };
        !            97: 
        !            98: }}}
        !            99: 
        !           100: #endif

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>