home *** CD-ROM | disk | FTP | other *** search
/ The Developer Connection…ice Driver Kit for OS/2 3 / DEV3-D1.ISO / source / bento / headers / linksrc.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-03-02  |  6.1 KB  |  191 lines

  1. /*
  2.     File:        LinkSrc.h
  3.  
  4.     Contains:    The abstract XMPLinkSource class
  5.  
  6.     Written by:    Nick Pilch & Craig Carper
  7.  
  8.     Copyright:    ⌐ 1993 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <1>     1/21/94    CC        first checked in
  13.         <10>     1/14/94    CC        Added Lock(), Unlock(), GetTimeStamp(),
  14.                                     GetStatus(), SetAutoExport(),
  15.                                     IsAutoExport(), Export(),
  16.                                     ShowSourceContent(), type XMPLinkKey; added
  17.                                     key parameter to various routines.
  18.          <9>    12/22/93    CC        Added GetContentStorageUnit(); use
  19.                                     XMPVMethod for public methods.
  20.          <8>    12/16/93    CC        Removed useless overrides of GetID() and
  21.                                     GetStorageUnit().
  22.          <7>    12/14/93    Té        InitLink changes.  Internalize, Initialize
  23.                                     went away.
  24.          <6>     9/29/93    VL        Added InitializePersistent.
  25.          <5>      7/1/93    NP        Abstract/Concrete breakout.
  26.          <4>     4/28/93    NP        File name changes.
  27.          <3>     4/21/93    NP        Added Initialize member.
  28.          <2>     4/13/93    NP        Made to conform to new standards.
  29.          <1>     4/13/93    NP        first checked in
  30.  
  31.     To Do:
  32. */
  33.  
  34. #ifndef _LINKSRC_
  35. #define _LINKSRC_
  36.  
  37. #ifndef _LINK_
  38. #include "Link.h"
  39. #endif
  40.  
  41. #ifndef _PLFMDEF_
  42. #include "PlfmDef.h"
  43. #endif
  44.  
  45. #ifndef _PSTOBJ_
  46. #include "PstObj.h"
  47. #endif
  48.  
  49. //==============================================================================
  50. // Theory of Operation
  51. //==============================================================================
  52.  
  53. /*
  54.     This class is used to represent the source side of OpenDoc links. XMPDrafts
  55.     create and own these links. The source XMPPart will ask the draft to create
  56.     an XMPLinkSource and an XMPLink pair, and return the XMPLink object to the
  57.     the destination part.  The destination part uses the XMPLink object to
  58.     extract the contents of the link.
  59. */
  60.  
  61. //==============================================================================
  62. // Classes defined in this interface
  63. //==============================================================================
  64.  
  65. class XMPAbsLinkSource;
  66.  
  67. //==============================================================================
  68. // Classes used by this interface
  69. //==============================================================================
  70.  
  71. class XMPPart;
  72. class XMPStorageUnit;
  73.  
  74. //==============================================================================
  75. // XMPAbsLinkSource
  76. //==============================================================================
  77.  
  78. class XMPAbsLinkSource : public XMPPersistentObject
  79. {
  80.   public:
  81.  
  82.     XMPVMethod XMPBoolean Lock(XMPULong wait, XMPLinkKey* key)
  83.         = 0;
  84.  
  85.         // Acquire exclusive access to the content storage unit of the link
  86.         // for the current thread. The value kXMPTrue is returned if the lock is
  87.         // granted; the key argument is set to a valid link key.  Access is
  88.         // granted if the current thread already holds the lock.  Nested calls
  89.         // to Lock must be balanced by an equal number of calls to Unlock to 
  90.         // relinquish the lock.
  91.  
  92.     XMPVMethod void Unlock(XMPLinkKey key)
  93.         =0;
  94.         
  95.         // Relinquish exclusive access to the content storage unit of the link.
  96.         // The argument should be a non-zero key returned by Lock.
  97.  
  98.     XMPVMethod XMPStorageUnit* GetContentStorageUnit(XMPLinkKey key)
  99.         = 0;
  100.  
  101.         // used by the source part to get the storage unit containing the 
  102.         //  contents of the link.  The key parameter should be obtained by 
  103.         //  aquiring the lock for this thread. 
  104.         //  formerly named: GetStorageUnit
  105.  
  106.     XMPVMethod void ContentChanged(XMPChangeID id)
  107.         = 0;
  108.  
  109.         // used by the source to make sure all destinations are notified
  110.         //  of the updated link contents
  111.         //  formerly named: Updated
  112.  
  113.     XMPVMethod void Clear(XMPChangeID id, XMPLinkKey key)
  114.         = 0;
  115.  
  116.         // Empties the contents of the link. The key parameter
  117.         // should be obtained by aquiring the lock for this thread.
  118.         // The next call to GetContentStorageUnit returns an empty storage unit.
  119.     
  120.     XMPVMethod XMPChangeID GetChangeID()
  121.         =0;
  122.  
  123.         // Returns the change id of the link content.  Source parts will most likely
  124.         //  cache this value internally rather than use this method.  The returned 
  125.         //  value should be tested for equality only, as there is no implicit 
  126.         //  ordering of change ids.
  127.  
  128.     XMPVMethod void SetAutoExport(XMPBoolean automatic)
  129.         = 0;
  130.  
  131.         // If automatic is kXMPTrue, export updates to other documents when the 
  132.         // link's draft is saved.  If automatic is kXMPFalse, updates are exported
  133.         // only when the Export method is called. This setting defaults to kXMPTrue.
  134.  
  135.     XMPVMethod XMPBoolean IsAutoExport()
  136.         = 0;
  137.  
  138.         // Returns kXMPTrue if updates are automatically exported to other documents
  139.         // when the link's draft is saved.
  140.  
  141.     XMPVMethod XMPLink* GetLink()
  142.         = 0;
  143.         
  144.         // Return the link object associated with this link source.
  145.  
  146.     //---------------------------------
  147.     // For XMPLink objects only
  148.  
  149.     XMPVMethod void ShowSourceContent()
  150.         = 0;
  151.  
  152.         // Causes the source part of the link to become active, makes the source content
  153.         // visible, and displays the link border.  Throws an exception if the source
  154.         // part of the link cannot be located, or if the link has been broken at the
  155.         // source.
  156.  
  157.     //-------------------------------------------------------------------------
  158.     // From Memory protocol
  159.     //-------------------------------------------------------------------------
  160.     
  161.     XMPVMethod XMPSize Purge(XMPSize size)
  162.         = 0;
  163.  
  164.         // Gets rid of any unnecessary memory by purging memory blocks
  165.         //    or flushing structures out to disk
  166.                     
  167.     //-------------------------------------------------------------------------
  168.     // From Persistent Object protocol
  169.     //-------------------------------------------------------------------------
  170.  
  171.     XMPVMethod void Externalize()
  172.         = 0;
  173.  
  174.         // used by the Draft to get the link to externalize the necessary
  175.         //    parts of its persistent store.
  176.     
  177.     //-------------------------------------------------------------------------
  178.     // constructors/destructors
  179.     //-------------------------------------------------------------------------
  180.  
  181.     XMPAbsLinkSource(){}
  182.  
  183.     XMPVMethod    ~XMPAbsLinkSource() {}
  184. };
  185.  
  186. #ifndef _LINKSRCM_
  187. #include "LinkSrcM.h"
  188. #endif
  189.  
  190. #endif // _LINKSRC_
  191.