home *** CD-ROM | disk | FTP | other *** search
- /*
- File: StorageU.h
-
- Contains: definition of XMPStorageUnit
-
- Written by: Vincent Lo, Tantek I. éelik
-
- Copyright: ⌐ 1992-1994 by Apple Computer, Inc., all rights reserved.
-
- Change History (most recent first):
-
- <39> 2/8/94 VL Got rid of friends.
- <38> 2/4/94 VL Moved to PPC Header and began code cleanup.
- <37> 1/27/94 VL Changed CloneTo which takes XMPDraftKey and
- initiatingFrameSU and returns a
- XMPStorageUnit*. Added CloneInto which also
- takes XMPDraftKey and initiatingFrameSU.
- <36> 1/12/94 VL Added GetSession.
- <35> 12/21/93 VL Changed GetValueSize to GetValue. Added
- GetObjectID.
- <34> 12/16/93 VL Fixed problems associated with DocSU.
- <33> 12/14/93 VL Replaced Initialize with InitStorageUnit.
- Added GetCMContainer.
- <32> 11/23/93 VL Made XMPStorageUnit pool-aware.
- <31> 11/12/93 PH ResolveAllPromises
- <30> 11/9/93 PH Add private by convention calls
- <29> 11/5/93 PH Add Get/SetPromiseInfo calls
- <28> 11/5/93 VL Changed CopyFrom to CopyTo.
- <27> 11/4/93 PH Add new promise api calls
- <26> 11/1/93 VL Replaced GetStorageUnitRef with
- GetStrongStorageUnitRef and
- GetWeakStorageUnitRef. Added
- IsStrongStorageUnitRef and
- IsWeakStorageUnitRef. Replaced CloneFrom
- with CloneTo.
- <25> 10/21/93 PH Add ResolvePromise method
- <24> 10/20/93 PH Add promise changes
- <23> 10/18/93 CG Added #define id for ASLM
- <22> 9/23/93 VL Added CountValues and CountProperties.
- <21> 9/14/93 VL Added Lock and Unlock to be used as
- semaphore.
- <20> 9/8/93 VL Added new fields to handle flushing of
- Bento Container.
- <19> 8/19/93 VL Added ::RemoveStorageUnitRef.
- <18> 8/18/93 VL Added private CleanupAndFail.
- <17> 8/13/93 CG Added ASLM define for exported class.
- <16> 8/12/93 VL Added Exists.
- <15> 8/11/93 VL XMPStorageUnitRefIterator should have
- IsNotComplete (instead of IsComplete).
- <14> 8/6/93 PH Storage integration
- <13> 7/29/93 VL StorageUnitName should be XMPISOStr.
- <12> 7/28/93 PH Added iterator code
- <11> 7/21/93 VL Implemented Clone. Added
- XMPStorageUnitRefIterator. Removed Revert.
- <10> 7/2/93 Té change GetName to return XMPName* not
- XMPName
- <9> 7/1/93 VL Added fID for Prototype.
- <8> 6/23/93 Té change XMPPropertyName from XMPName to
- XMPISOStr
- <7> 6/22/93 VL fObject is also fID.
- <6> 4/29/93 VL 8.3 Name Change.
- <5> 4/9/93 VL XMPStorageUnit should be subclassed from
- XMPRefCntObject.
- <4> 4/7/93 VL Initialize should return void.
- <3> 4/7/93 VL Added Initialize method.
- <2> 4/6/93 VL Made compilable.
- <1> 4/6/93 VL first checked in
-
- To Do:
- 1) kXMPIndexAll should be XMPValueIndex.
- 2) Should we separate this class to StorUM.cp and StorageU.cp?
- */
-
- #ifndef _STORAGEU_
- #define _STORAGEU_
-
- #ifndef _XMPTYPES_
- #include "XMPTypes.h"
- #endif
-
- #ifndef _REFCTOBJ_
- #include "RefCtObj.h"
- #endif
-
- #ifndef __CM_API__
- #include "CMAPI.h"
- #endif
-
- //==============================================================================
- // Constants
- //==============================================================================
-
- typedef enum {
- kXMPPosUndefined = -1,
- kXMPPosSame = 0x00,
- kXMPPosAll = 1,
- kXMPPosFirstSib = 2,
- kXMPPosLastSib = 3,
- kXMPPosNextSib = 4,
- kXMPPosPrevSib = 5,
- kXMPPosFirstBelow = 6,
- kXMPPosLastBelow = 7,
- kXMPPosFirstAbove = 8,
- kXMPPosLastAbove = 9,
- kXMPPosReserved11 = 10,
- kXMPPosReserved12 = 11,
- kXMPPosReserved13 = 12,
- kXMPPosReserved14 = 13,
- kXMPPosReserved15 = 14,
-
- kXMPPosMWrap = 0x10,
- kXMPPosMOtherTypes = 0x20
- } XMPPositionCode;
-
- const XMPID kXMPIDAll = 0;
- const XMPID kXMPIndexAll= 0;
- const XMPValueType kXMPTypeAll = 0;
- const XMPID kXMPIDWild = 0;
-
- //==============================================================================
- // Scalar Types
- //==============================================================================
-
- typedef void* XMPValue;
- typedef XMPID XMPValueIndex;
- typedef XMPISOStr XMPPropertyName;
- typedef XMPID XMPStorageUnitID;
- typedef XMPISOStr XMPStorageUnitName;
- typedef XMPID XMPStorageUnitRef;
- typedef XMPULong XMPStorageUnitKey;
- typedef XMPULong XMPDraftKey;
-
- //==============================================================================
- // Classes defined in this interface
- //==============================================================================
-
- class XMPStorageUnit;
-
- //==============================================================================
- // Classes used by this interface
- //==============================================================================
-
- class XMPDraft;
- class XMPSession;
- class XMPPart;
- class XMPStorageUnitCursor;
- class XMPStorageUnitView;
- class XMPAEHashTable;
-
- class XMPRefTable;
- class XMPRefCollection;
-
- //==============================================================================
- // XMPStorageUnit
- //==============================================================================
-
- #define kXMPStorageUnitID "appl:xmpstorageunit$class,1.0.0"
-
- class XMPStorageUnit : public XMPRefCntObject {
-
- friend class XMPStorageUnitRefIterator;
-
- public:
-
- XMPMethod XMPDraft* GetDraft();
-
- XMPMethod XMPSession* GetSession();
-
- XMPMethod void IncrementRefCount();
-
- XMPMethod void Release();
-
- XMPMethod XMPSize Purge(XMPSize size);
-
- XMPMethod XMPBoolean Exists(XMPPropertyName propertyName,
- XMPValueType valueType,
- XMPValueIndex valueIndex);
-
- XMPMethod XMPBoolean Exists(XMPStorageUnitCursor* cursor);
-
- XMPMethod XMPULong CountProperties();
- XMPMethod XMPULong CountValues();
-
- XMPMethod XMPStorageUnit* Focus(XMPPropertyName propertyName,
- XMPPositionCode propertyPosCode,
- XMPValueType valueType,
- XMPValueIndex valueIndex,
- XMPPositionCode valuePosCode);
-
- XMPMethod XMPStorageUnit* Focus(XMPStorageUnitCursor* cursor);
-
- XMPMethod XMPStorageUnitCursor* CreateCursor();
-
- XMPMethod XMPStorageUnit* Externalize();
-
- XMPMethod XMPStorageUnit* Internalize();
-
- XMPMethod XMPID GetID();
-
- XMPMethod XMPStorageUnitName GetName();
-
- XMPMethod void SetName(XMPStorageUnitName name);
-
- XMPMethod XMPStorageUnit* AddProperty(XMPPropertyName propertyName);
-
- XMPMethod XMPStorageUnit* AddValue(XMPValueType type);
-
- XMPMethod XMPStorageUnit* Remove();
-
- XMPMethod void CopyTo(XMPStorageUnit* toSU);
-
- XMPMethod XMPStorageUnit* CloneTo(XMPDraftKey key, XMPDraft* destDraft, XMPStorageUnit* initiatingFrame);
-
- XMPMethod void CloneInto(XMPDraftKey key, XMPStorageUnit* destStorageUnit, XMPStorageUnit* initiatingFrame);
-
- XMPMethod XMPStorageUnitView* CreateView(XMPStorageUnitCursor* cursor);
-
- XMPMethod XMPPropertyName GetProperty();
-
- XMPMethod XMPValueType GetType();
- XMPMethod void SetType(XMPValueType valueType);
-
- XMPMethod void SetOffset(XMPULong offset);
- XMPMethod XMPULong GetOffset();
-
- XMPMethod XMPULong GetValue(XMPULong length, XMPValue value);
- XMPMethod void SetValue(XMPULong length, XMPValue value);
- XMPMethod void InsertValue(XMPULong length, XMPValue value);
- XMPMethod void DeleteValue(XMPULong length);
-
- XMPMethod XMPULong GetSize();
-
- XMPMethod XMPStorageUnitRef GetStrongStorageUnitRef(XMPStorageUnit* embeddedSU);
- XMPMethod XMPStorageUnitRef GetWeakStorageUnitRef(XMPStorageUnit* embeddedSU);
- XMPMethod XMPBoolean IsStrongStorageUnitRef(XMPStorageUnitRef ref);
- XMPMethod XMPBoolean IsWeakStorageUnitRef(XMPStorageUnitRef ref);
- XMPMethod XMPStorageUnit* RemoveStorageUnitRef(XMPStorageUnitRef aRef);
- XMPMethod XMPStorageUnitID GetIDFromStorageUnitRef(XMPStorageUnitRef aRef);
-
- XMPMethod XMPStorageUnitRefIterator* GetStorageUnitRefIterator();
-
- XMPMethod XMPULong GetGenerationNumber();
- XMPMethod XMPULong IncrementGenerationNumber();
-
- XMPMethod XMPBoolean IsPromiseValue();
- XMPMethod void SetPromiseValue(XMPValueType valueType,
- XMPULong offset,
- XMPULong length,
- XMPValue value,
- XMPPart *sourcePart);
- XMPMethod XMPULong GetPromiseValue(XMPValueType valueType,
- XMPULong offset,
- XMPULong length,
- XMPValue value,
- XMPPart **sourcePart);
- XMPMethod void ClearAllPromises();
-
- XMPStorageUnitKey Lock(XMPStorageUnitKey key);
- void Unlock(XMPStorageUnitKey key);
-
- protected:
-
- CMContainer fCMContainer;
- CMObject fObject;
-
- XMPVMethod void SetChangedFromPrevFlag(XMPBoolean changed);
- XMPVMethod CMContainer GetCMContainer();
-
- private:
-
- void CleanupAndFail(XMPError err);
- XMPStorageUnitRef GetStorageUnitRef(XMPStorageUnit* embeddedSU, XMPBoolean strong);
- XMPStorageUnitRef GetNextStorageUnitRef();
- void GetClonedSUs(XMPAEHashTable* clonedSUIDs, XMPStorageUnit* initiatingFrameSU);
- XMPStorageUnitRef SetStorageUnitRef(XMPStorageUnit* embeddedSU, XMPStorageUnitRef ref);
-
- XMPDraft* fDraft;
- XMPStorageUnitID fID;
-
- CMObjectID fObjectID;
- CMProperty fCurProperty;
- XMPBoolean fHasPropertyLooped;
- XMPValueIndex fCurValueIndex;
- CMValue fCurValue;
- XMPValueType fCurValueType;
- XMPULong fOffset;
- CMType fCurType;
- XMPBoolean fHasValueLooped;
- XMPULong fPromiseCount;
-
- XMPULong fCurrentKey;
- XMPULong fLockCount;
-
- XMPULong fCurrentSURef;
-
- XMPHeap fHeap;
-
-
- public: // Private by convention calls:
-
- XMPStorageUnit();
-
- XMPVMethod ~XMPStorageUnit();
-
- XMPVMethod void InitStorageUnit(XMPDraft* draft, XMPStorageUnitID suid);
-
- XMPMethod void Clone(XMPDraftKey key, XMPStorageUnit* fromSU, XMPAEHashTable* clonedSUIDs);
- XMPMethod void ResolvePromise();
- XMPMethod void ResolveAllPromises();
- XMPMethod XMPPtr GetPromiseInfo();
- XMPMethod void SetPromiseInfo(XMPPtr theInfo);
- XMPMethod void IncrementPromiseCount();
- XMPMethod void DecrementPromiseCount();
-
- XMPMethod XMPHeap GetHeap();
-
- XMPMethod XMPID GetObjectID();
-
- XMPMethod CMValue GetCurValue();
- };
-
-
- #endif // _STORAGEU_
-