CacheEntry Struct Reference

DownloadCache support structure. Encapsulates an entry into the cache file table. More...

#include <camnet.h>

List of all members.

Public Types

enum  Priority {
  PRIORITY_OTHER = 0, PRIORITY_FONT_FILE, PRIORITY_CLIPART_FILE, PRIORITY_FILL_FILE,
  PRIORITY_CLIPART_THUMBNAIL, PRIORITY_FONT_THUMBNAIL, PRIORITY_FILL_THUMBNAIL, PRIORITY_OLD_CATALOG_FILE,
  PRIORITY_CURRENT_CATALOG_FILE
}

Public Member Functions

 CacheEntry ()
 CacheEntry (const String_256 &strPath)
 
  • constructor

BOOL IsValid ()
INT32 Size () const
INT32 GetPriority () const
BOOL IsFolder ()
BOOL IsFile ()
BOOL operator!= (const CacheEntry &entry)

Public Attributes

_tstat m_FileStat
TCHAR szFilePath [_MAX_PATH]
BOOL m_bIsValid
Priority m_nPriority


Detailed Description

DownloadCache support structure. Encapsulates an entry into the cache file table.

Author:
Adrian_Stoicar (Xara Group Ltd) <camelotdev@xara.com>
Date:
16/06/97

Definition at line 417 of file camnet.h.


Member Enumeration Documentation

enum CacheEntry::Priority
 

Enumerator:
PRIORITY_OTHER 
PRIORITY_FONT_FILE 
PRIORITY_CLIPART_FILE 
PRIORITY_FILL_FILE 
PRIORITY_CLIPART_THUMBNAIL 
PRIORITY_FONT_THUMBNAIL 
PRIORITY_FILL_THUMBNAIL 
PRIORITY_OLD_CATALOG_FILE 
PRIORITY_CURRENT_CATALOG_FILE 

Definition at line 420 of file camnet.h.


Constructor & Destructor Documentation

CacheEntry::CacheEntry  )  [inline]
 

Definition at line 427 of file camnet.h.

00427 {memset(szFilePath, 0x00, sizeof(szFilePath)); m_bIsValid = FALSE;}

CacheEntry::CacheEntry const String_256 strPath  ) 
 

  • constructor

Author:
Adrian_Stoicar (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/06/97
Parameters:
- path of file that that the object represents [INPUTS]
Returns:
-

Definition at line 1952 of file camnet.cpp.

01953 {
01954     camStrcpy(szFilePath, strPath);
01955     if (m_bIsValid = (!_tstat(szFilePath, &m_FileStat))) 
01956     {
01957         String_256 strFilePath(strPath);
01958         strFilePath.toLower();
01959         PathName filePath(strFilePath);
01960         if (filePath.GetType() == _T("txt"))
01961             m_nPriority = PRIORITY_CURRENT_CATALOG_FILE;
01962         else if (filePath.GetType() == _T("old"))
01963             m_nPriority = PRIORITY_OLD_CATALOG_FILE;
01964         else
01965         {
01966             //find out if the file is in a clipart, font or fill folder
01967             INT32 rgTypes[5] = {SGLib_ClipArt, SGLib_Font, SGLib_Fractal, SGLib_ClipArt_WebThemes, SGLib_Blank};
01968             INT32 nLibType;
01969             String_256 strAppDataPath;
01970             GetAppDataPath(&strAppDataPath);
01971             PathName appDataPath(strAppDataPath);
01972             for (INT32 i = 0; i < 5; i++)
01973             {
01974                 nLibType = rgTypes[i];
01975                 if (nLibType == SGLib_Blank)
01976                     break;
01977                 String_256 strCacheSubdir = GetStringField(rgTypes[i], _R(IDS_CACHEDIR));
01978                 String_256 strTypePath(appDataPath.GetLocation(TRUE)); // path of files of type rgTypes[i]
01979                 strTypePath += strCacheSubdir;
01980                 strTypePath.toLower();
01981                 if (camStrstr(strFilePath, strTypePath))
01982                     break;
01983             }
01984             // is the file a thumbnail?
01985             BOOL bIsThumb = (camStrstr(strFilePath, _T("xarainfo"))) && (filePath.GetType() == _T("png"));
01986             switch (nLibType)
01987             {
01988                 case SGLib_ClipArt:
01989                 case SGLib_ClipArt_WebThemes:
01990                     m_nPriority = bIsThumb ? PRIORITY_CLIPART_THUMBNAIL : PRIORITY_CLIPART_FILE;
01991                     break;
01992                 case SGLib_Font:
01993                     m_nPriority = bIsThumb ? PRIORITY_FONT_THUMBNAIL : PRIORITY_FONT_FILE;
01994                     break;
01995                 case SGLib_Fractal:
01996                     m_nPriority = bIsThumb ? PRIORITY_FILL_THUMBNAIL : PRIORITY_FILL_FILE;
01997                     break;
01998                 default:
01999                     m_nPriority = PRIORITY_OTHER;
02000             }
02001         }
02002     }
02003 }


Member Function Documentation

INT32 CacheEntry::GetPriority  )  const [inline]
 

Definition at line 431 of file camnet.h.

00431 {return m_nPriority;}

BOOL CacheEntry::IsFile  )  [inline]
 

Definition at line 433 of file camnet.h.

00433 {return m_bIsValid ? m_FileStat.st_mode &  _S_IFREG : FALSE;}

BOOL CacheEntry::IsFolder  )  [inline]
 

Definition at line 432 of file camnet.h.

00432 {return m_bIsValid ? m_FileStat.st_mode & _S_IFDIR : FALSE;}

BOOL CacheEntry::IsValid  )  [inline]
 

Definition at line 429 of file camnet.h.

00429 {return m_bIsValid;}

BOOL CacheEntry::operator!= const CacheEntry entry  )  [inline]
 

Definition at line 434 of file camnet.h.

00434 { return _tcsicmp(szFilePath, entry.szFilePath);} 

INT32 CacheEntry::Size  )  const [inline]
 

Definition at line 430 of file camnet.h.

00430 {return m_FileStat.st_size;}


Member Data Documentation

BOOL CacheEntry::m_bIsValid
 

Definition at line 425 of file camnet.h.

struct _tstat CacheEntry::m_FileStat
 

Definition at line 423 of file camnet.h.

Priority CacheEntry::m_nPriority
 

Definition at line 426 of file camnet.h.

TCHAR CacheEntry::szFilePath[_MAX_PATH]
 

Definition at line 424 of file camnet.h.


The documentation for this struct was generated from the following files:
Generated on Sat Nov 10 03:51:43 2007 for Camelot by  doxygen 1.4.4