home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / warphead.zip / H / FSHDR.H < prev    next >
C/C++ Source or Header  |  1997-02-28  |  6KB  |  179 lines

  1. /* @(#)Z 1.4 com/src/bento/FSHdr.h, odstorage, od96os2, odos29646d 96/11/15 15:29:28 (96/10/29 09:12:36) */
  2. /*====START_GENERATED_PROLOG======================================
  3.  */
  4. /*
  5.  *   COMPONENT_NAME: odstorage
  6.  *
  7.  *   CLASSES:   ODFSBentoHandlers
  8.  *
  9.  *   ORIGINS: 82,27
  10.  *
  11.  *
  12.  *   (C) COPYRIGHT International Business Machines Corp. 1995,1996
  13.  *   All Rights Reserved
  14.  *   Licensed Materials - Property of IBM
  15.  *   US Government Users Restricted Rights - Use, duplication or
  16.  *   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  17.  *       
  18.  *   IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  19.  *   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  20.  *   PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  21.  *   CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  22.  *   USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  23.  *   OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
  24.  *   OR PERFORMANCE OF THIS SOFTWARE.
  25.  */
  26. /*====END_GENERATED_PROLOG========================================
  27.  */
  28.  
  29. /*
  30.     File:        FSHdr.h
  31.  
  32.     Contains:    ODFSContainer header
  33.  
  34.     Written by:    Vincent Lo
  35.  
  36.     Copyright:    ⌐ 1993 - 1995 by Apple Computer, Inc., all rights reserved.
  37.  
  38.     Change History (most recent first):
  39.  
  40.          <6>      4/7/95    EL        1225905: More ModDate stuff to container.
  41.          <5>     3/24/95    EL        1225905: Move state information such as mod
  42.                                     date from plfmFile to here
  43.          <4>     3/10/95    EL        1223465: allocate buffer on the heap.
  44.          <3>     2/10/95    VL        1205627: Added fMode to store access mode.
  45.          <2>     1/31/95    EL        1213321: Buffer the Bento file I/O.
  46.          <1>     5/27/94    VL        first checked in
  47.  
  48.     To Do:
  49. */
  50.  
  51. #ifndef _FSHDR_
  52. #define _FSHDR_
  53.  
  54. #ifndef _PLFMDEF_
  55. #include "PlfmDef.h"
  56. #endif
  57.  
  58. #ifndef _ODTYPES_
  59. #include "ODTypes.h"
  60. #endif
  61.  
  62. #ifndef _BENTOHDR_
  63. #include "BentoHdr.h"
  64. #endif
  65.  
  66. #ifndef __CM_API__
  67. #include "CMAPI.h"
  68. #endif
  69.  
  70. #ifndef __CM_API_TYPES__
  71. #include "CMAPITyp.h"
  72. #endif
  73.  
  74. #ifndef _PLFMDEF_
  75. #include "PlfmDef.h"
  76. #endif
  77.  
  78. //==============================================================================
  79. // Theory of Operation
  80. //==============================================================================
  81.  
  82. //==============================================================================
  83. // Constants
  84. //==============================================================================
  85.  
  86. extern const ODType    kODBentoFileTypeName; // = "FileCtr";
  87.  
  88. #define MininumChunkSize         0x100    /* minimum size of file space allocation    */
  89. #define DefaultChunkSize         0x800    /* default size of file space allocation    */
  90.  
  91. //==============================================================================
  92. // Scalar Types
  93. //==============================================================================
  94.  
  95. struct ContainerLabelFmt {            /* Layout of a container label:            */
  96.  ODUByte magicBytes[8];                /* 8 bytes: the magic byte identifier    */
  97.  ODUShort flags;                    /* 2    the label flag                    */
  98.  ODUShort bufSize;                    /* 2    TOC buffer size / 1024            */
  99.  ODUShort majorVersion;                /* 2    major format version number        */
  100.  ODUShort minorVersion;                /* 2    minor format version number        */
  101.  ODULong tocOffset;                    /* 4    offset to start of TOC            */
  102.  ODULong tocSize;                    /* 4    total byte size of the TOC        */
  103. };
  104. typedef struct ContainerLabelFmt ContainerLabelFmt;
  105.  
  106. //==============================================================================
  107. // Classes defined in this interface
  108. //==============================================================================
  109. class ODFSBentoHandlers;
  110.  
  111. //==============================================================================
  112. // Classes used by this interface
  113. //==============================================================================
  114. class PlatformFile;
  115.  
  116. //==============================================================================
  117. // ODFSBentoHandlers
  118. //==============================================================================
  119.  
  120. class ODFSBentoHandlers : public ODBentoHandlers
  121. {
  122. public:
  123.  
  124.     ODFSBentoHandlers(CMSession session, PlatformFile* file);
  125.     ODVMethod ~ODFSBentoHandlers();
  126.     
  127.     ODMethod void Initialize();
  128.     ODMethod CMSession GetCMSession();
  129.     
  130.     ODMethod CMRefCon OpenHandler(CMOpenMode mode);
  131.     ODMethod void CloseHandler();
  132.     ODMethod CMSize FlushHandler();
  133.     ODMethod CMSize SeekHandler(CM_LONG posOff, CMSeekMode mode);
  134.     ODMethod CMSize TellHandler();
  135.     ODMethod CMSize ReadHandler(CMPtr buffer, CMSize elementSize, CMCount theCount);
  136.     ODMethod CMSize WriteHandler(CMPtr buffer, CMSize elementSize, CMCount theCount);
  137.     ODMethod CMEofStatus EOFHandler();
  138.     ODMethod CMBoolean TruncHandler(CMSize containerSize);
  139.     ODMethod CMSize ContainerSizeHandler();
  140.     ODMethod void ReadLabelHandler(CMMagicBytes magicByteSequence,
  141.                         CMContainerFlags *flags, CM_USHORT *bufSize,
  142.                         CM_USHORT *majorVersion, CM_USHORT *minorVersion,
  143.                         CMSize *tocOffset, CMSize *tocSize);
  144.     ODMethod void WriteLabelHandler(CMMagicBytes magicByteSequence,
  145.                         CMContainerFlags flags, CM_USHORT bufSize,
  146.                         CM_USHORT majorVersion, CM_USHORT minorVersion,
  147.                         CMSize tocOffset, CMSize tocSize);
  148.     ODMethod CMValue ReturnParentValueHandler();
  149.     ODMethod CM_UCHAR* ReturnContainerNameHandler();
  150.     ODMethod CMType ReturnTargetTypeHandler(CMContainer container);
  151.     ODMethod void ExtractDataHandler(CMDataBuffer buffer,
  152.                             CMSize size, CMPrivateData data);
  153.     ODMethod void FormatDataHandler(CMDataBuffer buffer,
  154.                             CMSize size,
  155.                             CMPrivateData data);
  156.  
  157. private:
  158.  
  159.     ODMethod    void ReloadBuffer();
  160.     ODMethod    void FlushBuffer();
  161.  
  162.     CMSession    fSession;
  163.     PlatformFile*    fFile;
  164.     ODBoolean    fReverseEndian;
  165.     ODULong        fLogicalPos;
  166.     ODULong        fFileSize;
  167.     ODULong        fPhysicalFileSize;
  168.     ODULong        fWriteLimit;
  169.     ODULong        fChunkSize;
  170.     ODBoolean    fBufferDirty;
  171.     ODBoolean    fOpenReadOnly;
  172.     ODBoolean    fHasLabel;
  173.     ODULong        fBufferBegin;
  174.     ODSByte*    fBuffer;
  175.     ContainerLabelFmt fLabel;
  176. };
  177.  
  178. #endif // _FSHDR_
  179.