InetUtils Namespace Reference

Allows string resource sharing. More...


Functions

TCHARGetStringField (UINT32 nIndex, UINT32 nCompositeStringID)
String_256 MakeURL (const String_256 &rRelativePath, const String_256 &rRootURL)
 Allows us to obtain the URL of a file knowing its relative path (from the main clipart index file) and the root URL. The URL is necessary to download the file.
String_256 MakeLocalPath (const String_256 &rRelPath)
BOOL GetTempInetDir (String_256 *pTempDir)
 Get path to the internet cache directory used to download web clipart files.
BOOL GetAppDataPath (String_256 *pPath)
BOOL GetAppCachePath (String_256 *pPath)
BOOL DeleteDirectoryTree (const String_256 &rPath)
 remove a directory tree from the hard drive


Detailed Description

Allows string resource sharing.

Author:
Adrian_Stoicar (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/01/97
Parameters:
nCompositeStringID - ID of the composite string [INPUTS] nIndex - relative position of the field within the composite string
Returns:
a pointer to a buffer containing the field, NULL if the string is not valid/composite
Note: The composite string is limited to 1024 characters


Function Documentation

BOOL InetUtils::DeleteDirectoryTree const String_256 rPath  ) 
 

remove a directory tree from the hard drive

Author:
Adrian_Stoicar (Xara Group Ltd) <camelotdev@xara.com>
Date:
1712/96
Parameters:
reference to String_256 containing the path to the root directory [INPUTS] of the tree to be removed.
Returns:
TRUE if successful, FALSE in case of total or partial failure (some of the files are locked etc.)
See also: PathNameEx::RemoveRecursively()

Definition at line 3153 of file sgliboil.cpp.

03154 {
03155     PathNameEx dirPath(rPath);
03156     return dirPath.Remove();
03157 }}

BOOL InetUtils::GetAppCachePath String_256 pPath  ) 
 

Definition at line 3123 of file sgliboil.cpp.

03124 {
03125     if (!GetAppDataPath(pPath))
03126         return FALSE;
03127 
03128     *pPath += String_256(_R(IDS_CACHEPATH)); // _R(IDS_CACHEPATH) == "Cache\\"
03129 
03130     return TRUE;
03131 }

BOOL InetUtils::GetAppDataPath String_256 pPath  ) 
 

Definition at line 3095 of file sgliboil.cpp.

03096 {
03097 #if defined(__WXMSW__)
03098     if (!SUCCEEDED(SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA | CSIDL_FLAG_CREATE,
03099                         NULL, 0, static_cast<TCHAR *>(*pPath))))
03100         return FALSE;
03101 #else
03102 #pragma error( "No equiverlent for SHGetFolderPath" )
03103 #endif
03104 
03105     *pPath += wxT("\\");
03106     *pPath += String_256(PRODUCT_MANUFACTURER); // PRODUCT_MANUFACTURER == "Xara"
03107     *pPath += wxT("\\");
03108     *pPath += String_256(PROGRAM_NAME); // PROGRAM_NAME == "Xara X" || "Xara X (debug)"
03109     *pPath += wxT("\\");
03110 
03111     return TRUE;
03112 }

TCHAR * InetUtils::GetStringField UINT32  nIndex,
UINT32  nCompositeStringID
 

Definition at line 2979 of file sgliboil.cpp.

02980 {
02981     PORTNOTETRACE("dialog","GetStringField - do nothing");
02982 #ifndef EXCLUDE_FROM_XARALX
02983     TCHAR rgtchBuff[1024];
02984     BOOL bLoad = ::LoadString(AfxGetResourceHandle(), nCompositeStringID, rgtchBuff, sizeof(rgtchBuff));
02985     ERROR3IF(!bLoad, "Failed to load string from resource");
02986     TCHAR* szField = _tcstok(rgtchBuff, _T("|"));
02987     for (UINT32 i = 0; i < nIndex && szField; i++)
02988         szField = _tcstok(NULL, _T("|"));
02989     return szField;
02990 #else
02991     return NULL;
02992 #endif
02993 }

BOOL InetUtils::GetTempInetDir String_256 pTempDir  ) 
 

Get path to the internet cache directory used to download web clipart files.

> BOOL InetUtils::GetTempInetDir(String_256* pTempDir)

Author:
Adrian_Stoicar (Xara Group Ltd) <camelotdev@xara.com> (rewritten by Jonathan)
Date:
1712/96 (rewritten 31 Jan 2001)
Parameters:
pTempDir (out) - string returning the path to the OS temporary internet [INPUTS]
Returns:
TRUE if successful, FALSE otherwise

Definition at line 3071 of file sgliboil.cpp.

03072 {
03073 #if defined(__WXMSW__)
03074     if (!SUCCEEDED(SHGetFolderPath(NULL, CSIDL_INTERNET_CACHE | CSIDL_FLAG_CREATE,
03075                         NULL, 0, static_cast<TCHAR *>(*pTempDir))))
03076         return FALSE;
03077 #else
03078 #pragma error( "No equiverlent for SHGetFolderPath" )
03079 #endif
03080 
03081     *pTempDir += wxT("\\");
03082 
03083     return TRUE;
03084 }

String_256 InetUtils::MakeLocalPath const String_256 rRelPath  ) 
 

Definition at line 3049 of file sgliboil.cpp.

03050 {
03051     String_256 strAppDataPath;
03052     GetAppDataPath(&strAppDataPath);
03053     if (strAppDataPath.IsEmpty()) // failed to get the path for some reason
03054         return strAppDataPath;
03055     PathNameEx appDataPath(strAppDataPath);
03056     String_256 strLocalPath = appDataPath.GetLocation(TRUE);
03057     strLocalPath += String_256(_R(IDS_CACHEPATH));
03058     strLocalPath += rRelPath;
03059     return strLocalPath;
03060 }

String_256 InetUtils::MakeURL const String_256 rRelativePath,
const String_256 rRootURL
 

Allows us to obtain the URL of a file knowing its relative path (from the main clipart index file) and the root URL. The URL is necessary to download the file.

Author:
Adrian_Stoicar (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/12/96
Params: rRelativePath (in) - const reference to string holding a relative file path (no leading slash), ex. "clipart\\drawings\\xarainfo\\xaraclip.txt" rRootURL (in) - const reference to string holding the root clipart URL on our web site, currently "http://www.xara.com/"

Returns:
URL of file on our site as a String_256 object. Note that this has no lvalue and should only be used as an initializer for a local string.

Definition at line 3017 of file sgliboil.cpp.

03018 {
03019     String_256 strURL = rRootURL;
03020     INT32 nCharCount = rRelativePath.Length();
03021     if (camStrstr( (const TCHAR *)strURL, _T("file://") ) )
03022         strURL += rRelativePath;
03023     else for (INT32 i = 0; i < nCharCount; i++)
03024     {
03025         // Walk down the relative path string, appending characters to the URL as we go along
03026         // Backslashes are converted to normal slashes
03027         if (rRelativePath[i] == _T('\\'))
03028             strURL += _T('/');
03029         else
03030             strURL += camTolower( rRelativePath[i] );
03031     }
03032     return strURL;
03033 }


Generated on Sat Nov 10 04:03:31 2007 for Camelot by  doxygen 1.4.4