home *** CD-ROM | disk | FTP | other *** search
/ Adobe Graphics & Publishing SDK 1996 December / Adobe Graphics & Publishing SDK 1996 December.iso / pc / pm65sdk / sourcecode / pagemakerclasslibrary / commands / pprivatedata.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-15  |  1.5 KB  |  52 lines

  1. /*
  2.  *--- PPrivateData.cpp ----------------------------------------------------
  3.  * Copyright (c) 1995-96 Adobe Systems Incorporated.  All rights reserved.
  4.  * Created on Thu, Oct 12, 1995 @ 10:48 PM by Paul Ferguson.
  5.  *
  6.  * Description:  For notes about this class, refer to the
  7.  * PCL documentation file PPrivateData.html
  8.  *-------------------------------------------------------------------------
  9.  */
  10.  
  11. #include <string.h>
  12.  
  13. #include "PMCQErrs.h"
  14. #include "PPrivateData.h"
  15. #include "PRequestBuf.h"
  16. #include "PCommand.h"
  17.  
  18. PPrivateData::PPrivateData
  19.   (    const char *    sDeveloperID,
  20.     const char *    sPluginID,
  21.     short            cTargetClass,
  22.     unsigned long    nTypeFlag,
  23.     unsigned long    nTargetID,
  24.     short            bChange,
  25.     PMHandle        hPrivateData,
  26.     unsigned long    nSize ) throw (PMErr)
  27. {
  28.     if (strlen(sDeveloperID) != 4 || strlen(sPluginID) != 4)
  29.         throw CQ_INVALID_CQ_ARG;
  30.     
  31.     char buf[100];                    // plenty big to hold everything.
  32.     PRequestBuf request(buf);
  33.     request << sDeveloperID
  34.             << sPluginID
  35.             << cTargetClass
  36.             << nTypeFlag
  37.             << (short) 1            // only one add at a time.
  38.             << nTargetID
  39.             << bChange
  40.             << (long) hPrivateData
  41.             << nSize;
  42.  
  43.     // NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE!
  44.     // If the object has private data, and bChange == false,
  45.     // an exception (CQ_PDATA_ALREADY_EXISTS) will be thrown.
  46.     // If you don't want your plug-in to fail, you must
  47.     // handle the exception.
  48.     PCommand command(pm_privatedata, request);    
  49. }
  50.  
  51. // end of PPrivateData.cpp
  52.