minifileobj.h
Upload User: dangjiwu
Upload Date: 2013-07-19
Package Size: 42019k
Code Size: 7k
Category:

Symbian

Development Platform:

Visual C++

  1. /* ***** BEGIN LICENSE BLOCK *****
  2.  * Source last modified: $Id: minifileobj.h,v 1.2.32.1 2004/07/09 02:04:12 hubbe Exp $
  3.  * 
  4.  * Portions Copyright (c) 1995-2004 RealNetworks, Inc. All Rights Reserved.
  5.  * 
  6.  * The contents of this file, and the files included with this file,
  7.  * are subject to the current version of the RealNetworks Public
  8.  * Source License (the "RPSL") available at
  9.  * http://www.helixcommunity.org/content/rpsl unless you have licensed
  10.  * the file under the current version of the RealNetworks Community
  11.  * Source License (the "RCSL") available at
  12.  * http://www.helixcommunity.org/content/rcsl, in which case the RCSL
  13.  * will apply. You may also obtain the license terms directly from
  14.  * RealNetworks.  You may not use this file except in compliance with
  15.  * the RPSL or, if you have a valid RCSL with RealNetworks applicable
  16.  * to this file, the RCSL.  Please see the applicable RPSL or RCSL for
  17.  * the rights, obligations and limitations governing use of the
  18.  * contents of the file.
  19.  * 
  20.  * Alternatively, the contents of this file may be used under the
  21.  * terms of the GNU General Public License Version 2 or later (the
  22.  * "GPL") in which case the provisions of the GPL are applicable
  23.  * instead of those above. If you wish to allow use of your version of
  24.  * this file only under the terms of the GPL, and not to allow others
  25.  * to use your version of this file under the terms of either the RPSL
  26.  * or RCSL, indicate your decision by deleting the provisions above
  27.  * and replace them with the notice and other provisions required by
  28.  * the GPL. If you do not delete the provisions above, a recipient may
  29.  * use your version of this file under the terms of any one of the
  30.  * RPSL, the RCSL or the GPL.
  31.  * 
  32.  * This file is part of the Helix DNA Technology. RealNetworks is the
  33.  * developer of the Original Code and owns the copyrights in the
  34.  * portions it created.
  35.  * 
  36.  * This file, and the files included with this file, is distributed
  37.  * and made available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY
  38.  * KIND, EITHER EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS
  39.  * ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES
  40.  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET
  41.  * ENJOYMENT OR NON-INFRINGEMENT.
  42.  * 
  43.  * Technology Compatibility Kit Test Suite(s) Location:
  44.  *    http://www.helixcommunity.org/content/tck
  45.  * 
  46.  * Contributor(s):
  47.  * 
  48.  * ***** END LICENSE BLOCK ***** */
  49. #ifndef _MINIFILEOBJ_H_
  50. #define _MINIFILEOBJ_H_
  51. /****************************************************************************
  52.  * Includes
  53.  */
  54. #include "hxfiles.h"  /* IHXFileObject, IHXRequestHandler, etc. */
  55. #if defined (_WINDOWS ) && defined (_WIN32)
  56. #include <winbase.h>
  57. #endif
  58. /****************************************************************************
  59.  *
  60.  *  CHXMiniFileObject Class
  61.  *
  62.  *  This class inherits the interfaces required to create a File Object,
  63.  *  which is used by the File System plug-in to handle file I/O. This class
  64.  *  implements the IHXFileObject interface which handles the actual low
  65.  *  level file access. The IHXRequestHandler interface is used to obtain
  66.  *  the requested URL; while the IHXFileExists interface determines if the
  67.  *  requested file actually exists. Since we are using COM, this class also
  68.  *  inherits COM's IUnknown interface to handle reference counting and
  69.  *  interface query.
  70.  */
  71. class CHXMiniFileObject :  public IHXFileObject,
  72.    public IHXDirHandler,
  73.    public IHXRequestHandler,
  74.    public IHXFileExists,
  75.    public IHXFileStat,
  76.    public IHXGetFileFromSamePool
  77. {
  78. public:
  79.     CHXMiniFileObject(IHXCommonClassFactory* pClassFactory,
  80.       const char* pBasePath);
  81.     ~CHXMiniFileObject(void);
  82.     /************************************************************************
  83.      *  IHXFileObject Interface Methods
  84.      */
  85.     STDMETHOD(Init       ) (THIS_ UINT32 access,IHXFileResponse* pFileResp);
  86.     STDMETHOD(GetFilename) (THIS_ REF(const char*) pFileName);
  87.     STDMETHOD(Read       ) (THIS_ UINT32 byteCount);
  88.     STDMETHOD(Write      ) (THIS_ IHXBuffer* pDataToWrite);
  89.     STDMETHOD(Seek       ) (THIS_ UINT32 offset, BOOL bRelative);
  90.     STDMETHOD(Advise     ) (THIS_ UINT32 useage);
  91.     STDMETHOD(Close      ) (THIS);
  92.     /************************************************************************
  93.      *  IHXRequestHandler Interface Methods
  94.      */
  95.     STDMETHOD(SetRequest) (THIS_     IHXRequest*  pRequest);
  96.     STDMETHOD(GetRequest) (THIS_ REF(IHXRequest*) pRequest);
  97.     /************************************************************************
  98.      *  IHXFileExists Interface Methods
  99.      */
  100.     STDMETHOD(DoesExist)(THIS_ const char* pFilePath,
  101.  IHXFileExistsResponse* pFileResponse);
  102.     /************************************************************************
  103.      *  IUnknown COM Interface Methods
  104.      */
  105.     STDMETHOD (QueryInterface ) (THIS_ REFIID ID, void** ppInterfaceObj);
  106.     STDMETHOD_(UINT32, AddRef ) (THIS);
  107.     STDMETHOD_(UINT32, Release) (THIS);
  108.     /************************************************************************
  109.      *  IHXFileStat Interface Methods
  110.      */
  111.     STDMETHOD(Stat)(THIS_ IHXFileStatResponse* pFileStatResponse);
  112.     /************************************************************************
  113.      *  IHXDirHandler Interface Methods
  114.      */
  115.     STDMETHOD(InitDirHandler)(THIS_ IHXDirHandlerResponse* pDirResponse);
  116.     /************************************************************************
  117.      *  IHXDirHandler Interface Methods
  118.      */
  119.     STDMETHOD(CloseDirHandler) (THIS);
  120.     /************************************************************************
  121.      *  IHXDirHandler Interface Methods
  122.      */
  123.     STDMETHOD(MakeDir) (THIS);
  124.     /************************************************************************
  125.      *  IHXDirHandler Interface Methods
  126.      */
  127.     STDMETHOD(ReadDir) (THIS);
  128.     /************************************************************************
  129.      *  IHXGetFileFromSamePool Interface Methods
  130.      */
  131.     STDMETHOD(GetFileObjectFromPool) (THIS_ IHXGetFileFromSamePoolResponse* response);
  132. private:
  133.     /****** Private Class Variables ****************************************/
  134.     INT32                   m_RefCount;       // Object's reference count
  135.     IHXCommonClassFactory*  m_pClassFactory;  // Creates common classes
  136.     IHXFileResponse*        m_pFileResponse;  // Provides completion notif.
  137.     FILE*                   m_pFile;          // Actual file pointer
  138.     char*     m_pFilename;      // Object's copy of file name
  139.     IHXRequest*             m_pRequest;       // Used to get requested URL
  140.     char*                   m_pBasePath;      // Platform's root path
  141.     UINT32                  m_FileAccessMode; // Current file access mode
  142.     IHXDirHandlerResponse*  m_pDirResponse;   // Target for dir functions
  143. #if defined (_WINDOWS ) && defined (_WIN32)
  144.     HANDLE m_hFileHandle; // Used for WIN32 ReadDir()
  145.     WIN32_FIND_DATA m_FileInfo;            // Used for WIN32 ReadDir()
  146. #endif
  147.     BOOL m_bInReadDone;
  148.     IHXBuffer* m_pPendingReadBuf;
  149.     /****** Private Class Methods ******************************************/
  150.     STDMETHOD(OpenFile)  (THIS_ UINT32 fileMode);
  151.     STDMETHOD(ConvertToPlatformPath)(THIS_ REF(char*)  pFilePathPlatform,
  152.      const char* pFilePath);
  153. };
  154. #endif  /* _MINIFILEOBJ_H_ */