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

多媒体编程

开发平台:

Visual C++

  1. /*
  2.      File:       QD3DStorage.h
  3.  
  4.      Contains:   Abstraction to deal with various types of stream-based storage devices
  5.  
  6.      Version:    Technology: Quickdraw 3D 1.6
  7.                  Release:    QuickTime 6.0.2
  8.  
  9.      Copyright:  (c) 1995-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 __QD3DSTORAGE__
  18. #define __QD3DSTORAGE__
  19. #ifndef __QD3D__
  20. #include "QD3D.h"
  21. #endif
  22. #if TARGET_OS_MAC
  23. #ifndef __MACTYPES__
  24. #include "MacTypes.h"
  25. #endif
  26. #ifndef __FILES__
  27. #include "Files.h"
  28. #endif
  29. #endif  /* TARGET_OS_MAC */
  30. #if TARGET_OS_WIN32
  31.    #include "windows.h"
  32. #endif /* TARGET_OS_WIN32 */
  33. #include "stdio.h"
  34. #if PRAGMA_ONCE
  35. #pragma once
  36. #endif
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40. #if PRAGMA_IMPORT
  41. #pragma import on
  42. #endif
  43. #if PRAGMA_STRUCT_ALIGN
  44.     #pragma options align=power
  45. #elif PRAGMA_STRUCT_PACKPUSH
  46.     #pragma pack(push, 2)
  47. #elif PRAGMA_STRUCT_PACK
  48.     #pragma pack(2)
  49. #endif
  50. #if PRAGMA_ENUM_ALWAYSINT
  51.     #if defined(__fourbyteints__) && !__fourbyteints__ 
  52.         #define __QD3DSTORAGE__RESTORE_TWOBYTEINTS
  53.         #pragma fourbyteints on
  54.     #endif
  55.     #pragma enumsalwaysint on
  56. #elif PRAGMA_ENUM_OPTIONS
  57.     #pragma option enum=int
  58. #elif PRAGMA_ENUM_PACK
  59.     #if __option(pack_enums)
  60.         #define __QD3DSTORAGE__RESTORE_PACKED_ENUMS
  61.         #pragma options(!pack_enums)
  62.     #endif
  63. #endif
  64. /******************************************************************************
  65.  **                                                                          **
  66.  **                             Storage Routines                             **
  67.  **                                                                          **
  68.  *****************************************************************************/
  69. #if CALL_NOT_IN_CARBON
  70. EXTERN_API_C( TQ3ObjectType )
  71. Q3Storage_GetType               (TQ3StorageObject       storage);
  72. EXTERN_API_C( TQ3Status )
  73. Q3Storage_GetSize               (TQ3StorageObject       storage,
  74.                                  unsigned long *        size);
  75. /* 
  76.  *  Reads "dataSize" bytes starting at offset in storage, copying into data. 
  77.  *  sizeRead returns the number of bytes filled in. 
  78.  *  
  79.  *  You may assume if *sizeRead < dataSize, then EOF is at offset + *sizeRead
  80.  */
  81. EXTERN_API_C( TQ3Status )
  82. Q3Storage_GetData               (TQ3StorageObject       storage,
  83.                                  unsigned long          offset,
  84.                                  unsigned long          dataSize,
  85.                                  unsigned char *        data,
  86.                                  unsigned long *        sizeRead);
  87. /* 
  88.  *  Write "dataSize" bytes starting at offset in storage, copying from data. 
  89.  *  sizeWritten returns the number of bytes filled in. 
  90.  *  
  91.  *  You may assume if *sizeRead < dataSize, then EOF is at offset + *sizeWritten
  92.  */
  93. EXTERN_API_C( TQ3Status )
  94. Q3Storage_SetData               (TQ3StorageObject       storage,
  95.                                  unsigned long          offset,
  96.                                  unsigned long          dataSize,
  97.                                  const unsigned char *  data,
  98.                                  unsigned long *        sizeWritten);
  99. /******************************************************************************
  100.  **                                                                          **
  101.  **                          Memory Storage Prototypes                       **
  102.  **                                                                          **
  103.  *****************************************************************************/
  104. EXTERN_API_C( TQ3ObjectType )
  105. Q3MemoryStorage_GetType         (TQ3StorageObject       storage);
  106. /*
  107.  * These calls COPY the buffer into QD3D space
  108.  */
  109. EXTERN_API_C( TQ3StorageObject )
  110. Q3MemoryStorage_New             (const unsigned char *  buffer,
  111.                                  unsigned long          validSize);
  112. EXTERN_API_C( TQ3Status )
  113. Q3MemoryStorage_Set             (TQ3StorageObject       storage,
  114.                                  const unsigned char *  buffer,
  115.                                  unsigned long          validSize);
  116. /*
  117.  * These calls use the pointer given - you must dispose it when you're through
  118.  */
  119. #endif  /* CALL_NOT_IN_CARBON */
  120. #if CALL_NOT_IN_CARBON
  121. EXTERN_API_C( TQ3StorageObject )
  122. Q3MemoryStorage_NewBuffer       (unsigned char *        buffer,
  123.                                  unsigned long          validSize,
  124.                                  unsigned long          bufferSize);
  125. EXTERN_API_C( TQ3Status )
  126. Q3MemoryStorage_SetBuffer       (TQ3StorageObject       storage,
  127.                                  unsigned char *        buffer,
  128.                                  unsigned long          validSize,
  129.                                  unsigned long          bufferSize);
  130. EXTERN_API_C( TQ3Status )
  131. Q3MemoryStorage_GetBuffer       (TQ3StorageObject       storage,
  132.                                  unsigned char **       buffer,
  133.                                  unsigned long *        validSize,
  134.                                  unsigned long *        bufferSize);
  135. #endif  /* CALL_NOT_IN_CARBON */
  136. #if TARGET_OS_MAC
  137. /******************************************************************************
  138.  **                                                                          **
  139.  **                             Macintosh Handles Prototypes                 **
  140.  **                                                                          **
  141.  *****************************************************************************/
  142. /* Handle Storage is a subclass of Memory Storage */
  143. #if CALL_NOT_IN_CARBON
  144. EXTERN_API_C( TQ3StorageObject )
  145. Q3HandleStorage_New             (Handle                 handle,
  146.                                  unsigned long          validSize);
  147. EXTERN_API_C( TQ3Status )
  148. Q3HandleStorage_Set             (TQ3StorageObject       storage,
  149.                                  Handle                 handle,
  150.                                  unsigned long          validSize);
  151. EXTERN_API_C( TQ3Status )
  152. Q3HandleStorage_Get             (TQ3StorageObject       storage,
  153.                                  Handle *               handle,
  154.                                  unsigned long *        validSize);
  155. /******************************************************************************
  156.  **                                                                          **
  157.  **                             Macintosh Storage Prototypes                 **
  158.  **                                                                          **
  159.  *****************************************************************************/
  160. EXTERN_API_C( TQ3StorageObject )
  161. Q3MacintoshStorage_New          (short                  fsRefNum);
  162. /* Note: This storage is assumed open */
  163. EXTERN_API_C( TQ3Status )
  164. Q3MacintoshStorage_Set          (TQ3StorageObject       storage,
  165.                                  short                  fsRefNum);
  166. EXTERN_API_C( TQ3Status )
  167. Q3MacintoshStorage_Get          (TQ3StorageObject       storage,
  168.                                  short *                fsRefNum);
  169. EXTERN_API_C( TQ3ObjectType )
  170. Q3MacintoshStorage_GetType      (TQ3StorageObject       storage);
  171. /******************************************************************************
  172.  **                                                                          **
  173.  **                         Macintosh FSSpec Storage Prototypes              **
  174.  **                                                                          **
  175.  *****************************************************************************/
  176. EXTERN_API_C( TQ3StorageObject )
  177. Q3FSSpecStorage_New             (const FSSpec *         fs);
  178. EXTERN_API_C( TQ3Status )
  179. Q3FSSpecStorage_Set             (TQ3StorageObject       storage,
  180.                                  const FSSpec *         fs);
  181. EXTERN_API_C( TQ3Status )
  182. Q3FSSpecStorage_Get             (TQ3StorageObject       storage,
  183.                                  FSSpec *               fs);
  184. #endif  /* CALL_NOT_IN_CARBON */
  185. #endif  /* TARGET_OS_MAC */
  186. #if TARGET_OS_WIN32
  187. /******************************************************************************
  188.  **                                                                          **
  189.  **                         Win32 HANDLE Storage Prototypes                  **
  190.  **                                                                          **
  191.  *****************************************************************************/
  192. #if CALL_NOT_IN_CARBON
  193. EXTERN_API_C( TQ3StorageObject )
  194. Q3Win32Storage_New              (HANDLE                 hFile);
  195. EXTERN_API_C( TQ3Status )
  196. Q3Win32Storage_Set              (TQ3StorageObject       storage,
  197.                                  HANDLE                 hFile);
  198. EXTERN_API_C( TQ3Status )
  199. Q3Win32Storage_Get              (TQ3StorageObject       storage,
  200.                                  HANDLE *               hFile);
  201. #endif  /* CALL_NOT_IN_CARBON */
  202. #endif  /* TARGET_OS_WIN32 */
  203. /******************************************************************************
  204.  **                                                                          **
  205.  **                                 Unix Prototypes                          **
  206.  **             The Unix Storage prototypes have been obsoleted.             **
  207.  **                                                                          **
  208.  *****************************************************************************/
  209. /******************************************************************************
  210.  **                                                                          **
  211.  **                             Unix Path Prototypes                         **
  212.  **                                                                          **
  213.  *****************************************************************************/
  214. #if CALL_NOT_IN_CARBON
  215. EXTERN_API_C( TQ3StorageObject )
  216. Q3UnixPathStorage_New           (const char *           pathName);
  217. /* C string */
  218. EXTERN_API_C( TQ3Status )
  219. Q3UnixPathStorage_Set           (TQ3StorageObject       storage,
  220.                                  const char *           pathName);
  221. /* C string */
  222. EXTERN_API_C( TQ3Status )
  223. Q3UnixPathStorage_Get           (TQ3StorageObject       storage,
  224.                                  char *                 pathName);
  225. /* pathName is a buffer */
  226. #endif  /* CALL_NOT_IN_CARBON */
  227. #if PRAGMA_ENUM_ALWAYSINT
  228.     #pragma enumsalwaysint reset
  229.     #ifdef __QD3DSTORAGE__RESTORE_TWOBYTEINTS
  230.         #pragma fourbyteints off
  231.     #endif
  232. #elif PRAGMA_ENUM_OPTIONS
  233.     #pragma option enum=reset
  234. #elif defined(__QD3DSTORAGE__RESTORE_PACKED_ENUMS)
  235.     #pragma options(pack_enums)
  236. #endif
  237. #if PRAGMA_STRUCT_ALIGN
  238.     #pragma options align=reset
  239. #elif PRAGMA_STRUCT_PACKPUSH
  240.     #pragma pack(pop)
  241. #elif PRAGMA_STRUCT_PACK
  242.     #pragma pack()
  243. #endif
  244. #ifdef PRAGMA_IMPORT_OFF
  245. #pragma import off
  246. #elif PRAGMA_IMPORT
  247. #pragma import reset
  248. #endif
  249. #ifdef __cplusplus
  250. }
  251. #endif
  252. #endif /* __QD3DSTORAGE__ */