TextEncodingConverter.h
上传用户:xjjlds
上传日期:2015-12-05
资源大小:22823k
文件大小:11k
源码类别:

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       TextEncodingConverter.h
  3.  
  4.      Contains:   Text Encoding Conversion Interfaces.
  5.  
  6.      Version:    Technology: Mac OS 9.0
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1994-2001 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:      For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __TEXTENCODINGCONVERTER__
  18. #define __TEXTENCODINGCONVERTER__
  19. #ifndef __MACTYPES__
  20. #include "MacTypes.h"
  21. #endif
  22. #ifndef __TEXTCOMMON__
  23. #include "TextCommon.h"
  24. #endif
  25. #if PRAGMA_ONCE
  26. #pragma once
  27. #endif
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. #if PRAGMA_IMPORT
  32. #pragma import on
  33. #endif
  34. #if PRAGMA_STRUCT_ALIGN
  35.     #pragma options align=mac68k
  36. #elif PRAGMA_STRUCT_PACKPUSH
  37.     #pragma pack(push, 2)
  38. #elif PRAGMA_STRUCT_PACK
  39.     #pragma pack(2)
  40. #endif
  41. typedef OSType                          TECPluginSignature;
  42. typedef UInt32                          TECPluginVersion;
  43. /* plugin signatures */
  44. enum {
  45.     kTECSignature               = FOUR_CHAR_CODE('encv'),
  46.     kTECUnicodePluginSignature  = FOUR_CHAR_CODE('puni'),
  47.     kTECJapanesePluginSignature = FOUR_CHAR_CODE('pjpn'),
  48.     kTECChinesePluginSignature  = FOUR_CHAR_CODE('pzho'),
  49.     kTECKoreanPluginSignature   = FOUR_CHAR_CODE('pkor')
  50. };
  51. /* converter object reference */
  52. typedef struct OpaqueTECObjectRef*      TECObjectRef;
  53. typedef struct OpaqueTECSnifferObjectRef*  TECSnifferObjectRef;
  54. typedef OSType                          TECPluginSig;
  55. struct TECConversionInfo {
  56.     TextEncoding                    sourceEncoding;
  57.     TextEncoding                    destinationEncoding;
  58.     UInt16                          reserved1;
  59.     UInt16                          reserved2;
  60. };
  61. typedef struct TECConversionInfo        TECConversionInfo;
  62. /* return number of encodings types supported by user's configuraton of the encoding converter */
  63. EXTERN_API( OSStatus )
  64. TECCountAvailableTextEncodings  (ItemCount *            numberEncodings);
  65. /* fill in an array of type TextEncoding passed in by the user with types of encodings the current configuration of the encoder can handle. */
  66. EXTERN_API( OSStatus )
  67. TECGetAvailableTextEncodings    (TextEncoding           availableEncodings[],
  68.                                  ItemCount              maxAvailableEncodings,
  69.                                  ItemCount *            actualAvailableEncodings);
  70. /* return number of from-to encoding conversion pairs supported  */
  71. EXTERN_API( OSStatus )
  72. TECCountDirectTextEncodingConversions (ItemCount *      numberOfEncodings);
  73. /* fill in an array of type TextEncodingPair passed in by the user with types of encoding pairs the current configuration of the encoder can handle. */
  74. EXTERN_API( OSStatus )
  75. TECGetDirectTextEncodingConversions (TECConversionInfo  availableConversions[],
  76.                                  ItemCount              maxAvailableConversions,
  77.                                  ItemCount *            actualAvailableConversions);
  78. /* return number of encodings a given encoding can be converter into */
  79. EXTERN_API( OSStatus )
  80. TECCountDestinationTextEncodings (TextEncoding          inputEncoding,
  81.                                  ItemCount *            numberOfEncodings);
  82. /* fill in an array of type TextEncodingPair passed in by the user with types of encodings pairs the current configuration of the encoder can handle. */
  83. EXTERN_API( OSStatus )
  84. TECGetDestinationTextEncodings  (TextEncoding           inputEncoding,
  85.                                  TextEncoding           destinationEncodings[],
  86.                                  ItemCount              maxDestinationEncodings,
  87.                                  ItemCount *            actualDestinationEncodings);
  88. /* get info about a text encoding */
  89. EXTERN_API( OSStatus )
  90. TECGetTextEncodingInternetName  (TextEncoding           textEncoding,
  91.                                  Str255                 encodingName);
  92. EXTERN_API( OSStatus )
  93. TECGetTextEncodingFromInternetName (TextEncoding *      textEncoding,
  94.                                  ConstStr255Param       encodingName);
  95. /* create/dispose converters */
  96. EXTERN_API( OSStatus )
  97. TECCreateConverter              (TECObjectRef *         newEncodingConverter,
  98.                                  TextEncoding           inputEncoding,
  99.                                  TextEncoding           outputEncoding);
  100. EXTERN_API( OSStatus )
  101. TECCreateConverterFromPath      (TECObjectRef *         newEncodingConverter,
  102.                                  const TextEncoding     inPath[],
  103.                                  ItemCount              inEncodings);
  104. EXTERN_API( OSStatus )
  105. TECDisposeConverter             (TECObjectRef           newEncodingConverter);
  106. /* convert text encodings */
  107. EXTERN_API( OSStatus )
  108. TECClearConverterContextInfo    (TECObjectRef           encodingConverter);
  109. EXTERN_API( OSStatus )
  110. TECConvertText                  (TECObjectRef           encodingConverter,
  111.                                  ConstTextPtr           inputBuffer,
  112.                                  ByteCount              inputBufferLength,
  113.                                  ByteCount *            actualInputLength,
  114.                                  TextPtr                outputBuffer,
  115.                                  ByteCount              outputBufferLength,
  116.                                  ByteCount *            actualOutputLength);
  117. EXTERN_API( OSStatus )
  118. TECFlushText                    (TECObjectRef           encodingConverter,
  119.                                  TextPtr                outputBuffer,
  120.                                  ByteCount              outputBufferLength,
  121.                                  ByteCount *            actualOutputLength);
  122. /* one-to-many routines */
  123. EXTERN_API( OSStatus )
  124. TECCountSubTextEncodings        (TextEncoding           inputEncoding,
  125.                                  ItemCount *            numberOfEncodings);
  126. EXTERN_API( OSStatus )
  127. TECGetSubTextEncodings          (TextEncoding           inputEncoding,
  128.                                  TextEncoding           subEncodings[],
  129.                                  ItemCount              maxSubEncodings,
  130.                                  ItemCount *            actualSubEncodings);
  131. EXTERN_API( OSStatus )
  132. TECGetEncodingList              (TECObjectRef           encodingConverter,
  133.                                  ItemCount *            numEncodings,
  134.                                  Handle *               encodingList);
  135. EXTERN_API( OSStatus )
  136. TECCreateOneToManyConverter     (TECObjectRef *         newEncodingConverter,
  137.                                  TextEncoding           inputEncoding,
  138.                                  ItemCount              numOutputEncodings,
  139.                                  const TextEncoding     outputEncodings[]);
  140. EXTERN_API( OSStatus )
  141. TECConvertTextToMultipleEncodings (TECObjectRef         encodingConverter,
  142.                                  ConstTextPtr           inputBuffer,
  143.                                  ByteCount              inputBufferLength,
  144.                                  ByteCount *            actualInputLength,
  145.                                  TextPtr                outputBuffer,
  146.                                  ByteCount              outputBufferLength,
  147.                                  ByteCount *            actualOutputLength,
  148.                                  TextEncodingRun        outEncodingsBuffer[],
  149.                                  ItemCount              maxOutEncodingRuns,
  150.                                  ItemCount *            actualOutEncodingRuns);
  151. EXTERN_API( OSStatus )
  152. TECFlushMultipleEncodings       (TECObjectRef           encodingConverter,
  153.                                  TextPtr                outputBuffer,
  154.                                  ByteCount              outputBufferLength,
  155.                                  ByteCount *            actualOutputLength,
  156.                                  TextEncodingRun        outEncodingsBuffer[],
  157.                                  ItemCount              maxOutEncodingRuns,
  158.                                  ItemCount *            actualOutEncodingRuns);
  159. /* international internet info */
  160. EXTERN_API( OSStatus )
  161. TECCountWebTextEncodings        (RegionCode             locale,
  162.                                  ItemCount *            numberEncodings);
  163. EXTERN_API( OSStatus )
  164. TECGetWebTextEncodings          (RegionCode             locale,
  165.                                  TextEncoding           availableEncodings[],
  166.                                  ItemCount              maxAvailableEncodings,
  167.                                  ItemCount *            actualAvailableEncodings);
  168. EXTERN_API( OSStatus )
  169. TECCountMailTextEncodings       (RegionCode             locale,
  170.                                  ItemCount *            numberEncodings);
  171. EXTERN_API( OSStatus )
  172. TECGetMailTextEncodings         (RegionCode             locale,
  173.                                  TextEncoding           availableEncodings[],
  174.                                  ItemCount              maxAvailableEncodings,
  175.                                  ItemCount *            actualAvailableEncodings);
  176. /* examine text encodings */
  177. EXTERN_API( OSStatus )
  178. TECCountAvailableSniffers       (ItemCount *            numberOfEncodings);
  179. EXTERN_API( OSStatus )
  180. TECGetAvailableSniffers         (TextEncoding           availableSniffers[],
  181.                                  ItemCount              maxAvailableSniffers,
  182.                                  ItemCount *            actualAvailableSniffers);
  183. EXTERN_API( OSStatus )
  184. TECCreateSniffer                (TECSnifferObjectRef *  encodingSniffer,
  185.                                  TextEncoding           testEncodings[],
  186.                                  ItemCount              numTextEncodings);
  187. EXTERN_API( OSStatus )
  188. TECSniffTextEncoding            (TECSnifferObjectRef    encodingSniffer,
  189.                                  TextPtr                inputBuffer,
  190.                                  ByteCount              inputBufferLength,
  191.                                  TextEncoding           testEncodings[],
  192.                                  ItemCount              numTextEncodings,
  193.                                  ItemCount              numErrsArray[],
  194.                                  ItemCount              maxErrs,
  195.                                  ItemCount              numFeaturesArray[],
  196.                                  ItemCount              maxFeatures);
  197. EXTERN_API( OSStatus )
  198. TECDisposeSniffer               (TECSnifferObjectRef    encodingSniffer);
  199. EXTERN_API( OSStatus )
  200. TECClearSnifferContextInfo      (TECSnifferObjectRef    encodingSniffer);
  201. #if CALL_NOT_IN_CARBON
  202. EXTERN_API( OSStatus )
  203. TECSetBasicOptions              (TECObjectRef           encodingConverter,
  204.                                  OptionBits             controlFlags);
  205. #endif  /* CALL_NOT_IN_CARBON */
  206. #if PRAGMA_STRUCT_ALIGN
  207.     #pragma options align=reset
  208. #elif PRAGMA_STRUCT_PACKPUSH
  209.     #pragma pack(pop)
  210. #elif PRAGMA_STRUCT_PACK
  211.     #pragma pack()
  212. #endif
  213. #ifdef PRAGMA_IMPORT_OFF
  214. #pragma import off
  215. #elif PRAGMA_IMPORT
  216. #pragma import reset
  217. #endif
  218. #ifdef __cplusplus
  219. }
  220. #endif
  221. #endif /* __TEXTENCODINGCONVERTER__ */