PixelLightAPI  .
FileHttp.h
Go to the documentation of this file.
00001 /*********************************************************\
00002  *  File: FileHttp.h                                     *
00003  *
00004  *  Copyright (C) 2002-2011 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_HTTP_H__
00024 #define __PLCORE_FILE_HTTP_H__
00025 #pragma once
00026 
00027 
00028 //[-------------------------------------------------------]
00029 //[ Includes                                              ]
00030 //[-------------------------------------------------------]
00031 #include "PLCore/File/FileImpl.h"
00032 #include "PLCore/File/HttpHandle.h"
00033 
00034 
00035 //[-------------------------------------------------------]
00036 //[ Namespace                                             ]
00037 //[-------------------------------------------------------]
00038 namespace PLCore {
00039 
00040 
00041 //[-------------------------------------------------------]
00042 //[ Classes                                               ]
00043 //[-------------------------------------------------------]
00044 /**
00045 *  @brief
00046 *    HTTP 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 *  @see
00052 *    - 'HttpHandle'-class
00053 */
00054 class FileHttp : public FileImpl {
00055 
00056 
00057     //[-------------------------------------------------------]
00058     //[ Friends                                               ]
00059     //[-------------------------------------------------------]
00060     friend class FileObject;
00061 
00062 
00063     //[-------------------------------------------------------]
00064     //[ Private functions                                     ]
00065     //[-------------------------------------------------------]
00066     private:
00067         /**
00068         *  @brief
00069         *    Constructor
00070         *
00071         *  @param[in] cUrl
00072         *    URL of the file
00073         *  @param[in] pAccess
00074         *    Additional file access information (can be a null pointer)
00075         */
00076         FileHttp(const Url &cUrl, const FileAccess *pAccess);
00077 
00078         /**
00079         *  @brief
00080         *    Destructor
00081         */
00082         virtual ~FileHttp();
00083 
00084 
00085     //[-------------------------------------------------------]
00086     //[ Private virtual FileImpl functions                    ]
00087     //[-------------------------------------------------------]
00088     private:
00089         virtual bool Exists() const override;
00090         virtual bool IsFile() const override;
00091         virtual bool IsDirectory() const override;
00092         virtual bool CopyTo(const String &sDest, bool bOverwrite) const override;
00093         virtual bool MoveTo(const String &sDest) override;
00094         virtual bool Rename(const String &sName) override;
00095         virtual bool CreateNewFile(bool bAlways) override;
00096         virtual bool CreateNewDirectory() override;
00097         virtual bool Delete() override;
00098         virtual bool DeleteDirectory() override;
00099         virtual void Close() override;
00100         virtual bool Open(uint32 nAccess, String::EFormat nStringFormat = String::ASCII) override;
00101         virtual bool IsOpen() const override;
00102         virtual bool IsReadable() const override;
00103         virtual bool IsWritable() const override;
00104         virtual String::EFormat GetStringFormat() const override;
00105         virtual bool IsEof() const override;
00106         virtual int GetC() override;
00107         virtual bool PutC(int nChar) override;
00108         virtual String GetS() override;
00109         virtual int PutS(const String &sString) override;
00110         virtual uint32 Read(void *pBuffer, uint32 nSize, uint32 nCount) override;
00111         virtual uint32 Write(const void *pBuffer, uint32 nSize, uint32 nCount) override;
00112         virtual bool Flush() override;
00113         virtual bool Seek(int32 nOffset, uint32 nLocation) override;
00114         virtual int32 Tell() const override;
00115         virtual uint32 GetSize() const override;
00116         virtual FileSearchImpl *CreateSearch() override;
00117 
00118 
00119     //[-------------------------------------------------------]
00120     //[ Private data                                          ]
00121     //[-------------------------------------------------------]
00122     private:
00123         uint32      m_nAccess;  /**< File access modes (see EAccess) */
00124         HttpHandle  m_cHttp;    /**< Http connection handle */
00125 
00126 
00127 };
00128 
00129 
00130 //[-------------------------------------------------------]
00131 //[ Namespace                                             ]
00132 //[-------------------------------------------------------]
00133 } // PLCore
00134 
00135 
00136 #endif // __PLCORE_FILE_HTTP_H__


PixelLight PixelLight 0.9.10-R1
Copyright (C) 2002-2011 by The PixelLight Team
Last modified Fri Dec 23 2011 15:50:53
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported