chxavmediafolderinfo.h
上传用户:dangjiwu
上传日期:2013-07-19
资源大小:42019k
文件大小:3k
源码类别:

Symbian

开发平台:

Visual C++

  1. /************************************************************************
  2.  * chxavmediafolderinfo.h
  3.  * ----------------------
  4.  *
  5.  * Synopsis:
  6.  * Contains the declaration of the CHXAvMediaFolderInfo class.  This class
  7.  * encapsulates all the info regarding the files and folders pressent 
  8.  * in memory or the mmc.
  9.  *
  10.  * Target:
  11.  * Symbian OS
  12.  *
  13.  *
  14.  * (c) 1995-2003 RealNetworks, Inc. Patents pending. All rights reserved.
  15.  *
  16.  *****************************************************************************/
  17. #ifndef _chxavmediafolderinfo_h_
  18. #define _chxavmediafolderinfo_h_
  19. // Helix includes...
  20. #include "hxstring.h"
  21. #include "hxurl.h"
  22. #include "hxwintyp.h"
  23. #include "hxcom.h"
  24. #include "hxcomm.h"
  25. #include "hxmon.h"
  26. // Includes from this project...
  27. #include "chxbody.h"
  28. #include "chxavrefptr.h"
  29. #include "chxavfileutil.h"
  30. #include "chxavmisc.h"
  31. #include "chxavmiscconstants.h"
  32. #include "chxsmartptr.h"
  33. // class CHXAvMediaFolderInfo...
  34. class CHXAvMediaFolderInfo : 
  35.     public CHXBody
  36. {
  37. public:
  38.     // ctor and dtor
  39.     CHXAvMediaFolderInfo();
  40.     virtual ~CHXAvMediaFolderInfo();
  41. private:
  42.     // disallow assignment and copy
  43.     CHXAvMediaFolderInfo(const CHXAvMediaFolderInfo& rhs);
  44.     CHXAvMediaFolderInfo& operator=(const CHXAvMediaFolderInfo& rhs);
  45. public:
  46.     // types
  47.     enum PathCreateType
  48.     {
  49.         PATH_ENSURE,
  50.         PATH_OPTIONAL
  51.     };
  52.     enum StateFlags
  53.     {
  54.         STATE_CHANGED   = 0x01,
  55.         VOLID_CHANGED   = 0x02
  56.     };
  57.     // methods
  58.     void InitL(const TDesC& rootPath, PathCreateType pathType);
  59.     const CHXAvFile::DriveInfo& GetDriveInfo() const;
  60.     void SetCurrentPathL(const TDesC& path);
  61.     const TDesC& GetRoot() const;
  62.     const TDesC& GetCurrentPath() const;
  63.     bool IsMmcFolder() const;
  64.     HBufC* AllocListDescriptionL() const;
  65.     bool IsCurrentPathValid() const;
  66.     void UpdateDriveInfo();
  67.     TUint32 UpdateDriveInfoCheckState();
  68. private:
  69. // implementation
  70. private:
  71. // data
  72.     refptr<HBufC>       m_spRootPath;
  73.     refptr<HBufC>       m_spCurrentPath;
  74.     CHXAvFile::DriveInfo   m_driveInfo;   
  75. };
  76. typedef CHXSmartPtr<CHXAvMediaFolderInfo> CHXAvMediaFolderInfoPtr; 
  77. inline
  78. bool CHXAvMediaFolderInfo::IsMmcFolder() const
  79. {
  80.     return m_driveInfo.idxDrive == CHXAvMisc::KIdxMmcDrive;
  81. }
  82. ///////////////////////////////////
  83. // absolute root path
  84. inline
  85. const TDesC& CHXAvMediaFolderInfo::GetRoot() const
  86. {
  87.     return *m_spRootPath;
  88. }
  89. ///////////////////////////////////
  90. // current folder, relative to root
  91. inline
  92. const TDesC& CHXAvMediaFolderInfo::GetCurrentPath() const
  93. {
  94.     HX_ASSERT(m_spCurrentPath);
  95.     return *m_spCurrentPath;
  96. }
  97. ///////////////////////////////////
  98. // get info from last drive check
  99. inline
  100. void CHXAvMediaFolderInfo::UpdateDriveInfo()
  101. {
  102.     m_driveInfo = CHXAvFile::GetDriveInfo(*m_spRootPath);
  103. }
  104. ///////////////////////////////////
  105. // get info from last drive check
  106. inline
  107. const CHXAvFile::DriveInfo& CHXAvMediaFolderInfo::GetDriveInfo() const
  108. {
  109.     return m_driveInfo;
  110. }
  111. #endif // _chxavmediafolderinfo_h_