PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: FileWindows.h * 00003 * 00004 * Copyright (C) 2002-2012 The PixelLight Team (http://www.pixellight.org/) 00005 * 00006 * This file is part of PixelLight. 00007 * 00008 * PixelLight is free software: you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License as published by 00010 * the Free Software Foundation, either version 3 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * PixelLight is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public License 00019 * along with PixelLight. If not, see <http://www.gnu.org/licenses/>. 00020 \*********************************************************/ 00021 00022 00023 #ifndef __PLCORE_FILE_WINDOWS_H__ 00024 #define __PLCORE_FILE_WINDOWS_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include "PLCore/File/StdIo.h" 00032 #include "PLCore/File/FileImpl.h" 00033 00034 00035 //[-------------------------------------------------------] 00036 //[ Namespace ] 00037 //[-------------------------------------------------------] 00038 namespace PLCore { 00039 00040 00041 //[-------------------------------------------------------] 00042 //[ Classes ] 00043 //[-------------------------------------------------------] 00044 /** 00045 * @brief 00046 * Windows implementation of 'FileImpl' 00047 * 00048 * @note 00049 * - Implementation of the state design pattern, this class is a concrete state of the 'FileImpl'-state of the 'FileObject'-context 00050 */ 00051 class FileWindows : public FileImpl { 00052 00053 00054 //[-------------------------------------------------------] 00055 //[ Friends ] 00056 //[-------------------------------------------------------] 00057 friend class FileObject; 00058 00059 00060 //[-------------------------------------------------------] 00061 //[ Private functions ] 00062 //[-------------------------------------------------------] 00063 private: 00064 /** 00065 * @brief 00066 * Constructor 00067 * 00068 * @param[in] cUrl 00069 * URL of the file or directory 00070 * @param[in] pAccess 00071 * Additional file access information (can be a null pointer) 00072 */ 00073 FileWindows(const Url &cUrl, const FileAccess *pAccess); 00074 00075 /** 00076 * @brief 00077 * Destructor 00078 */ 00079 virtual ~FileWindows(); 00080 00081 00082 //[-------------------------------------------------------] 00083 //[ Private virtual FileImpl functions ] 00084 //[-------------------------------------------------------] 00085 private: 00086 virtual bool Exists() const override; 00087 virtual bool IsFile() const override; 00088 virtual bool IsDirectory() const override; 00089 virtual bool CopyTo(const String &sDest, bool bOverwrite) const override; 00090 virtual bool MoveTo(const String &sDest) override; 00091 virtual bool Rename(const String &sName) override; 00092 virtual bool CreateNewFile(bool bAlways) override; 00093 virtual bool CreateNewDirectory() override; 00094 virtual bool Delete() override; 00095 virtual bool DeleteDirectory() override; 00096 virtual void Close() override; 00097 virtual bool Open(uint32 nAccess, String::EFormat nStringFormat = String::ASCII) override; 00098 virtual bool IsOpen() const override; 00099 virtual bool IsReadable() const override; 00100 virtual bool IsWritable() const override; 00101 virtual String::EFormat GetStringFormat() const override; 00102 virtual bool IsEof() const override; 00103 virtual int GetC() override; 00104 virtual bool PutC(int nChar) override; 00105 virtual String GetS() override; 00106 virtual int PutS(const String &sString) override; 00107 virtual uint32 Read(void *pBuffer, uint32 nSize, uint32 nCount) override; 00108 virtual uint32 Write(const void *pBuffer, uint32 nSize, uint32 nCount) override; 00109 virtual bool Flush() override; 00110 virtual bool Seek(int32 nOffset, uint32 nLocation) override; 00111 virtual int32 Tell() const override; 00112 virtual uint32 GetSize() const override; 00113 virtual FileSearchImpl *CreateSearch() override; 00114 00115 00116 //[-------------------------------------------------------] 00117 //[ Private data ] 00118 //[-------------------------------------------------------] 00119 private: 00120 String m_sFilename; /**< File name (in Windows notation) */ 00121 uint32 m_nAccess; /**< File access modes (see EAccess) */ 00122 String::EFormat m_nStringFormat; /**< String encoding format to use when dealing with string functions */ 00123 FILE *m_pFile; /**< Pointer to input stream, can be a null pointer */ 00124 00125 00126 }; 00127 00128 00129 //[-------------------------------------------------------] 00130 //[ Namespace ] 00131 //[-------------------------------------------------------] 00132 } // PLCore 00133 00134 00135 #endif // __PLCORE_FILE_WINDOWS_H__
|