hxinternetconfigutils.h
Upload User: zhongxx05
Upload Date: 2007-06-06
Package Size: 33641k
Code Size: 6k
Category:

Symbian

Development Platform:

C/C++

  1. /* ***** BEGIN LICENSE BLOCK ***** 
  2.  * Version: RCSL 1.0/RPSL 1.0 
  3.  *  
  4.  * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved. 
  5.  *      
  6.  * The contents of this file, and the files included with this file, are 
  7.  * subject to the current version of the RealNetworks Public Source License 
  8.  * Version 1.0 (the "RPSL") available at 
  9.  * http://www.helixcommunity.org/content/rpsl unless you have licensed 
  10.  * the file under the RealNetworks Community Source License Version 1.0 
  11.  * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl, 
  12.  * in which case the RCSL will apply. You may also obtain the license terms 
  13.  * directly from RealNetworks.  You may not use this file except in 
  14.  * compliance with the RPSL or, if you have a valid RCSL with RealNetworks 
  15.  * applicable to this file, the RCSL.  Please see the applicable RPSL or 
  16.  * RCSL for the rights, obligations and limitations governing use of the 
  17.  * contents of the file.  
  18.  *  
  19.  * This file is part of the Helix DNA Technology. RealNetworks is the 
  20.  * developer of the Original Code and owns the copyrights in the portions 
  21.  * it created. 
  22.  *  
  23.  * This file, and the files included with this file, is distributed and made 
  24.  * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 
  25.  * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES, 
  26.  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS 
  27.  * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 
  28.  * 
  29.  * Technology Compatibility Kit Test Suite(s) Location: 
  30.  *    http://www.helixcommunity.org/content/tck 
  31.  * 
  32.  * Contributor(s): 
  33.  *  
  34.  * ***** END LICENSE BLOCK ***** */ 
  35. #pragma once
  36. #ifndef _MAC_MACHO
  37. #include <InternetConfig.h>
  38. #endif
  39. #include "hxstring.h"
  40. // All methods are static
  41. // Mac OS X note: InternetConfig settings are per-user, not per-machine
  42. class HXInternetConfigMac
  43. {
  44. public:
  45. static Boolean  IsInternetConfigAvailable(void); // optional
  46. static ICInstance GetInstance(void); // gets our InternetConfig component instance
  47. static OSType GetFileTypeFromName(ConstStr255Param fileName);
  48. static OSType GetFileCreatorFromName(ConstStr255Param fileName);
  49. static OSErr GetFileExtensionFromType(OSType fType, OSType fCreator, ConstStr255Param fileName, StringPtr extension);
  50. static OSErr LaunchURL(const char *url);
  51. static OSErr GetFTPHelper(OSType *signature, StringPtr helperName);
  52. static OSErr GetHTTPHelper(OSType *signature, StringPtr helperName);
  53. static BOOL  GetEmailAddress(CHXString& strEmail);
  54. static BOOL  GetICPreferenceString(ConstStr255Param keyPascalString, CHXString& strResult);
  55. static BOOL  GetICPreferenceStringList(ConstStr255Param keyPascalString, char outputSeparator,
  56. CHXString& strResult);
  57. static BOOL  GetICPreferenceBoolean(ConstStr255Param keyPascalString, BOOL& outBool);
  58. // file mapping (downloaded file helpers)
  59. //
  60. // GetICMapEntryMatchingTemplate search
  61. //   for speed, put StartUsingIC and StopUsingIC around searches
  62. //
  63. //   pass 0 for searchFromIndex initially, then pass outICMapEntryIndex for subsequent searches
  64. //
  65. //   initialize templateICMapEntry to 0 except for fields to be compared (OSType fields, extension, or MIMType)
  66. //
  67. //   comparison of the extension field is a substring search (like looking for .rm parameter in .rm,.ram,.rpm map entry)
  68. //
  69. //   outEntryPos can be passed to SetICMapEntry to replace the existing map entry
  70. static OSErr GetICMapEntryMatchingTemplate(UInt32 searchFromIndex, const ICMapEntry& templateICMapEntry, 
  71. ICMapEntry& outICMapEntry, UInt32& outICMapEntryIndex, SInt32& outEntryPos);
  72. // SetICMapEntry
  73. //
  74. // SetICMapEntry adds or replaces a file helper entry
  75. //
  76. // optional app data is included with the entry if pAppData is non-nil
  77. //
  78. // pass -1 for entryPos to add a new entry
  79. static OSErr SetICMapEntry(const ICMapEntry * theICMapEntry, SInt32 entryPos, const void* pAppData, 
  80. Size appDataSize); // entryPos of -1 means add new entry
  81. //  helpers handle the protocols
  82. //
  83. //  example: protocol="rtsp" protocolDescString="Real-Time Streaming Protocol"
  84. //           appName="RealPlayer" appSignature="PNst"
  85. //
  86. //  To remove a protocol helper, use SetHelper with appSignature of 0
  87. static OSErr SetHelper(ConstStr255Param protocol, ConstStr255Param protocolDescString, 
  88. ConstStr255Param appName, OSType appSignature, BOOL bReplaceExisting);
  89. static OSErr  GetHelper(ConstStr255Param protocol, StringPtr outAppName,
  90. OSType *outAppSignature, StringPtr outProtocolDesc);
  91. // SetMappingsToLaunchDownloadedFiles runs through the file helper mappings looking for
  92. // the specified app, and if it finds mappings to the app, modifies the mappings to
  93. // launch the app when the file type is downloaded (and changes the app name in the mapping
  94. // to appName). Implemented on Carbon only.
  95. static OSErr  SetMappingsToOpenDownloadedFiles(OSType appSignature, ConstStr255Param appName);
  96. // put StartUsingIC/StopUsingIC calls around the other IC routines
  97. // if the others will be made repeatedly
  98. static Boolean StartUsingIC(void); // optional; call before batches of IC calls
  99. static void StopUsingIC(void); // balances the Start call
  100. // put StartReadingICPrefs/StartWritingICPrefs - StopUsingIC calls around calls that read or write IC prefs
  101. // if the calls will be made repeatedly. This avoid repeated opening and
  102. // closing of the IC preferences file. 
  103. //
  104. // Do not call WaitNextEvent between these calls.
  105. //
  106. // There's no need to call StartUsingIC/StopUsingIC if
  107. // you make these start/stop calls.
  108. static Boolean StartReadingICPrefs(void); // optional; call before batches of IC prefs calls
  109. static Boolean  StartWritingICPrefs(void); // same as previous but for writing prefs
  110. static void  StopUsingICPrefs(void);    // balances the preceding two calls
  111. private:
  112. static ICInstance m_icInstance;
  113. static UInt32 m_refcount;
  114. };